tag:blogger.com,1999:blog-6288862798546085706.post8155587864575283628..comments2019-07-15T06:54:11.085-04:00Comments on Econometrics By Simulation: A simple simulation of Hierarchical Linear Modelling (HLM) using two different R packages - intercept only REFrancishttp://www.blogger.com/profile/16658586705916884436noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-6288862798546085706.post-19233143799686735732014-03-19T18:19:16.030-04:002014-03-19T18:19:16.030-04:00Dear Dr. Smart,
I have a similar data analyzes ch...Dear Dr. Smart,<br /><br />I have a similar data analyzes challenge (ecological data) but maybe with a little more complexity. I have 27 sites, each with 3 plots (27 x 3 = 81 rows in my data). So plots are nested within sites. I want to analyze the effect of 3 environmental variables on the abundance of insects found in each of those plots/sites. So lets call those variables X1, X2, X3. At least two of the 3 environmental variables (X2, X3) was taken at plot level so it can differentiate between plots within the same site. The other environmental were taken at site level so they have the same value for the 3 plots within a site. This is just a description about why I have been using mixed models.<br /><br />The tricky part - which is the reason of my post - is the way to enter X3 in the analyzes, which is an index describing the landscape 2000 meters around each site. Previously I have been entering it just as a mean value for every site. That is, I took the mean of all the pixel values 2000 meters around each site. That's pretty straigth forward. However I think using a mean is a pretty coarse measure. Instead of that I would like to weigth the values of all the pixels by its distance to the site. To do that I want the model to estimate a parameter for that term during the weighting process. In other words, my model was:<br /><br />Y = b1.X1 + b2.X2 + b3.X3,<br /><br />where b's are the parameters estimated for the model and X3 was a mean of Lanscape around<br /><br />Now I want,<br /><br />Y = b1.X1 + b2.X2 + exp((Dist/b3)*X3), <br /><br />where X3 and Dist are the pixel value and its distance (for all the 14.000 pixels around each plot).<br /><br />In few words, in order the model to run, it has to analyze the values of Y, X1 and X2 from every line in data set #1 (81 rows = 81 plots), and for each of those 81 rows, to analyze X3, it has to go to the data set #2 (1'134.000 rows) and analyze the rows that correspond to the particular plot (row) in data set #1.<br /><br />I know the situation could sounds complicated, but is not... if I was clear enough. What could be complicated is the way to analyze the data in the way I explained. Any advice about how to run this analyzis, potential R packages to use, will be appreciated. I thionk it could be done with Maxim-Likelihhod or maybe better with MCMC... but don't know exactly how to implement that in R.<br /><br />Thanks in advance!!!Jaimirrishttps://www.blogger.com/profile/17807624060610349636noreply@blogger.comtag:blogger.com,1999:blog-6288862798546085706.post-91765137981725759412013-03-28T01:42:50.622-04:002013-03-28T01:42:50.622-04:00This is a good point. Independence is a large ass...This is a good point. Independence is a large assumption that should not be lightly made. I will post more on this is the future.Francis Smarthttps://www.blogger.com/profile/16658586705916884436noreply@blogger.comtag:blogger.com,1999:blog-6288862798546085706.post-87369015836530738702013-03-27T22:12:13.894-04:002013-03-27T22:12:13.894-04:00As you show, it's relatively straightforward t...As you show, it's relatively straightforward to simulate independent data. But what about a situation where student and class are not independent of each other? Taking it to an even more complex level, what about simulating student-level and classroom-level covariates that are perhaps intercorrelated with other predictors and with the outcome in a regression model? It would be interesting to learn how to simulate data with dependencies such as these. Does R provide an easy way to create such simulations?Anonymousnoreply@blogger.com