1
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ Is it deliberate that x is confounded with k? Usually, one wants (but can't always obtain in a nonexperimental setting) treatment to be independent of subject. $\endgroup$ Aug 23, 2017 at 0:05
  • $\begingroup$ @Kodiologist, Yes. This was intended as an example of there being no within-person effect, but a large overall effect (i.e. a situation where fixed effects regression is good at identifying that there is no within-person effect). I was taught that fixed effects, but not random effects, are good at handling this situation. But, it appears the models are equivalent when you center the predictor--my question is whether or not that's true. $\endgroup$ Aug 23, 2017 at 0:24
  • $\begingroup$ If I answered your question to your satisfaction, you can accept my answer by clicking on the check mark under the voting arrows. $\endgroup$ Aug 25, 2017 at 19:06

2 Answers 2

0
$\begingroup$

They are equivalent in linear models. See reference: https://academic.oup.com/ije/article/43/1/264/732283 "An alternative and computationally less demanding way to calculate the linear fixed effects model is the mean-centring approach. In this case the mean (over time) of measurements for each individual is subtracted from all the individual’s measurements. The time-invariant terms (which are not independently identifiable) are eliminated in the mean-centring Equation (2), and only parameters associated with time-varying covariates can be estimated by the model"

$\endgroup$
0
$\begingroup$

The models aren't equivalent. The coefficient for x equals the coefficient for xc, but these are different predictors because of the mean-centering; moreover, the coefficient of each group is estimated differently for the two models, which leads to different predictions of y for the same x and group, even when the models are asked to predict y in their own training data.

So why do x and cx end up with the same coefficient? First notice that tail(coef(mod2), 1) and coef(lm(y ~ -1 + xc)) are equal. That is, if you remove group from the OLS model but center x within groups, the coefficient ends up the same. This makes sense considering that the effect of group (according to the first model) is just to add a constant value to the dependent variable for each group. In fact, once you center x within groups, adding groups back into the model, whether as random or fixed effects, won't change the coefficient of xc, because (I believe) xc is uncorrelated with group.

$\endgroup$
8
  • $\begingroup$ Thanks! Maybe "are the models equivalent" is the wrong question then--what I want to know is if both are equivalent methods of estimating the "within group" effect, which is the goal of the associated real data problem that brought this up. $\endgroup$ Aug 23, 2017 at 0:53
  • $\begingroup$ @within_person If by "estimating the 'within group' effect" you mean "getting a coefficient", then yes, it's the same coefficient. $p$-values, confidence intervals, and other inferences may difer. $\endgroup$ Aug 23, 2017 at 1:22
  • $\begingroup$ Is that true though? Or did I just identify a weird special case? I'm only skeptical because statisticians who have worked on this problem a lot over the last few decades (e.g. Paul Allison has written many papers on this, and even a book, I think) and I've never seen mention of the fixed effects model (which is a fixture in social sciences and economics) being equivalent to a random effects model with mean centered predictors... I guess that's the thrust of my question. $\endgroup$ Aug 23, 2017 at 1:27
  • $\begingroup$ @within_person This phenomenon has nothing to do with random versus fixed effects, as I described, so why would it come up in a discussion of random effects? $\endgroup$ Aug 23, 2017 at 4:38
  • $\begingroup$ I think I can see why the point estimate is the same as long as you center the predictor within person. I don't understand why the inference about beta is identical in the two models, when I've been told that you must use fixed effects regression to do proper inference on the within-subject effect. That's where my confusion is coming from $\endgroup$ Aug 23, 2017 at 4:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.