Martin Batholdy
2013-Oct-15 10:32 UTC
[R] cluster option in stata for random intercept model in the R language?
Dear R-list, I am currently working on a dataset with a colleague who uses stata. We fit a random intercept model to the data (decisions clustered in participants) and get closely the same results in stata (using xtreg re) and R (using the lme4 or multilevel package). Now in stata, there is an additional option for the regression to control for clustering; the vce(cluster clustvar) option, which changes the standard errors quite a bit. (see http://www.stata.com/support/faqs/statistics/standard-errors-and-vce-cluster-option/ or http://www.stata.com/manuals13/xtxtreg.pdf). Unfortunately I don't understand what this 'correction' does and why it yields different results. First I thought it would control for autocorrelations over time (decisions), but if I model this directly with a random-intercept random-slope model, I don't get nearly the same results. Can someone help me understand what stata is doing here? And what would be the equivalent in R to get similar results? thanks!
David Winsemius
2013-Oct-15 13:50 UTC
[R] cluster option in stata for random intercept model in the R language?
On Oct 15, 2013, at 3:32 AM, Martin Batholdy wrote:> Dear R-list, > > I am currently working on a dataset with a colleague who uses stata. > We fit a random intercept model to the data (decisions clustered in > participants) and get closely the same results in stata (using xtreg > re) and R (using the lme4 or multilevel package). > > > Now in stata, there is an additional option for the regression to > control for clustering; the vce(cluster clustvar) option, which > changes the standard errors quite a bit. > (see http://www.stata.com/support/faqs/statistics/standard-errors-and-vce-cluster-option/ > or http://www.stata.com/manuals13/xtxtreg.pdf). > > Unfortunately I don't understand what this 'correction' does and why > it yields different results. > First I thought it would control for autocorrelations over time > (decisions), but if I model this directly with a random-intercept > random-slope model, I don't get nearly the same results. > > Can someone help me understand what stata is doing here? > And what would be the equivalent in R to get similar results?http://www.stata.com/statalist/> _______ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius, MD Alameda, CA, USA