I suspect the answer is yes. I explored this with a simulation. The coefficient and standard error are identical in the first model (the fixed effects regression) and the second model (the model with mean centered predictor and random effects). The goal is to estimate the within-"person" effect of x
.
library(lme4)
K <- 50; N <- 5 #50 people, 5 measurements per person.
ID = rep(1:K,each=N)
x=NULL
for(k in 1:K) x <- c(x, runif(N)+0.1*k)
y=NULL
for(k in 1:K) y <- c(y, runif(N)+0.1*k)
mod2 = lm(y ~ -1 + factor(ID) + x)
xc = NULL
for(k in 1:K)
{
ix = c(1:5) + (k-1)*5
xc = c(xc, x[ix]-mean(x[ix]))
}
summary(mod2)
summary(lmer(y~xc+(1|ID)))
If these two models are equivalent for estimating the within-person effect, I don't understand why. And, I don't understand why this doesn't seem to be mentioned by statisticians that have researched the "fixed effects model" in depth, such as Paul Allison. I've always been taught that the random effects model is not sufficient for estimating the within-person effect like this.
Any thoughts on this are appreciated.
x
is confounded withk
? Usually, one wants (but can't always obtain in a nonexperimental setting) treatment to be independent of subject. $\endgroup$