# Simulating variables with predefined correlation and autocorrelation

7 messages
Open this post in threaded view
|

## Simulating variables with predefined correlation and autocorrelation

 Hello everyone, I'm trying to simulate a set of variables by specifying correlations. For the simulated data, I also want to specify autocorrelations. Basically I am trying to simulate data assuming spatial durbin model (a model which accounts for autocorrelation in both Y and X). I came across the post on ‘*Simulating spatially autocorrelated data*’ in R-sig-geo ( https://stat.ethz.ch/pipermail/r-sig-geo/2011-September/012728.html) where similar query was discussed, however the focus there was on generating autocorrelated dependent variable. Can anyone assist me on this? Thanks in advance.         [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Open this post in threaded view
|

## Re: Simulating variables with predefined correlation and autocorrelation

 Dear Amitha, I'm not sure I understand well your question (but then, I don't know this Durbin model). From what I quickly looked up it follows this formulation: y = \rho W y + \alpha 1_n + X \beta + W X \theta + \varepsilon where y are the observations (thus, what you are trying to simulate if I understood correctly), W, X and 1_n are fixed and known matrices, and the greek letters are the unknown parameters. For simulating y from this model, you should assign values to the greek letters and compute: y = (I_n - \rho W)^{-1} [\alpha 1_n + X \beta + W X \theta + \varepsilon] Does this help? ƒacu.- On 8/21/19 8:52 AM, Amitha Puranik wrote: > Hello everyone, > > I'm trying to simulate a set of variables by specifying correlations. For > the simulated data, I also want to specify autocorrelations. Basically I am > trying to simulate data assuming spatial durbin model (a model which > accounts for autocorrelation in both Y and X). I came across the post > on ‘*Simulating > spatially autocorrelated data*’ in R-sig-geo ( > https://stat.ethz.ch/pipermail/r-sig-geo/2011-September/012728.html) where > similar query was discussed, however the focus there was on generating > autocorrelated dependent variable. > > Can anyone assist me on this? Thanks in advance. > > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-Geo mailing list > [hidden email] > https://stat.ethz.ch/mailman/listinfo/r-sig-geo        [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Open this post in threaded view
|

## Re: Simulating variables with predefined correlation and autocorrelation

 In reply to this post by AMITHA PURANIK Dear Prof Facundo Muñoz, Thank you for a quick response. I am sorry for not phrasing my query clearly. I am interested to simulate 2 variables Y and X in such a way that the resultant variables should possess the correlation coefficient of 0.6 between Y and X and autocorrelation of 0.7 in Y and 0.4 in X. The query posted in the link ( https://stat.ethz.ch/pipermail/r-sig-geo/2011-September/012728.html) focussed on only the autocorrelation of Y (spatial lag model) whereas I would like to introduce some autocorrelation in X too (spatial durbin model). Is there a way to do this? Should a covariance structure defining both correlation and autocorrelation be specified while simulating variables? If so, how to define such covariance structure? I will be grateful for your assistance. Thanks in advance. Amitha Puranik         [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Open this post in threaded view
|

## Re: Simulating variables with predefined correlation and autocorrelation

 Administrator Could you please explain why you want to do this and whether you want to use the same weights for y and x? Maybe refer to https://doi.org/10.1111/j.1538-4632.1991.tb00235.x and work referred to there; I'll try to find other references later. Roger Bivand Norwegian School of Economics Bergen, Norway Fra: Amitha Puranik Sendt: torsdag 22. august, 12.41 Emne: Re: [R-sig-Geo]  Simulating variables with predefined correlation and autocorrelation Til: [hidden email] Kopi: [hidden email] Dear Prof Facundo Muñoz, Thank you for a quick response. I am sorry for not phrasing my query clearly. I am interested to simulate 2 variables Y and X in such a way that the resultant variables should possess the correlation coefficient of 0.6 between Y and X and autocorrelation of 0.7 in Y and 0.4 in X. The query posted in the link ( https://stat.ethz.ch/pipermail/r-sig-geo/2011-September/012728.html) focussed on only the autocorrelation of Y (spatial lag model) whereas I would like to introduce some autocorrelation in X too (spatial durbin model). Is there a way to do this? Should a covariance structure defining both correlation and autocorrelation be specified while simulating variables? If so, how to define such covariance structure? I will be grateful for your assistance. Thanks in advance. Amitha Puranik [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo        [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo Roger Bivand Department of Economics Norwegian School of Economics Helleveien 30 N-5045 Bergen, Norway
Open this post in threaded view
|