[R-sig-ME] Xj correlated with Uj?

Markus Jäntti markus.jantti at iki.fi
Wed Apr 4 11:17:45 CEST 2012


On 04/03/2012 08:10 PM, Malcolm Fairbrother wrote:
> Dear list,
>
> Code below simulates a simple two-level dataset, but where a level-2 covariate (Xj) is correlated with the level-2 random effects (Uj). In fitting the model, using the call below, the estimate for the fixed effect of Xj is substantially biased.
>
> Is there a way to recover the correct parameter (1)? Presumably it's possible if one knows the variance-covariance matrix "s", but could it be done without that knowledge?
>
> Any thoughts (particularly though not only suggested code) would be much appreciated.
>

In an ordinary least-squares setting, this is the school-book example of a 
violation of the assumption that the error term in the regression is 
uncorrelated with the covariate.

To estimate the parameters consistently, you would require and instrument, a 
variable that is correlated with Xj but not Uj. Whether instrumental-variable 
estimation has been implemented in a multi-level setting I can not say, but it 
would probably be possible to do this "manually" by estimating an IV-regression 
with no regard to multi-level, using the residuals from that to estimate the 
variance components, then use the implied variance structure to transform the 
original data and re-estimate the IV-regression. This presupposes the existence 
of an instrument however, which is usually a big problem.

Best
Markus

> - Malcolm
>
>
> library(lme4); library(multicore); library(mnormt)
> N<- 25
> T<- 30
> s<- matrix(c(2,0.7,0.7,3), ncol=2)
> dgp<- function(N, T, s) {
> 	dat<- data.frame(group=1:N, rmnorm(n=N, varcov=s))[rep(1:N,each=T),]
> 	names(dat)[2:3]<- c("Xj", "Uj")
> 	dat$y<- 1 + dat$Xj + dat$Uj + rnorm(nrow(dat))
> 	dat
> 	}
> res1<- do.call("rbind", mclapply(1:100, function(yy) fixef(lmer(y ~ Xj + (1 | group), dgp(N=N, T=T, s=s)))))
> colMeans(res1)
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>


-- 
Markus Jantti
Professor of Economics
Swedish Institute for Social Research
Stockholm University




More information about the R-sig-mixed-models mailing list