Discussion:
[R-sig-ME] Fixed vs random effects with lme4
Yashree Mehta
2018-08-23 15:09:24 UTC
Permalink
Hello,

Is there a way to conduct the Hausman test on models which have been
estimated using lme4?

To be more specific,

My model assumption is that the plot size(X covariate) is correlated with
the random intercept ( estimated from Household_ID) which will be
estimated. So I have to find out how to tell lmer to consider this
correlation. I would also, similarly, want to carry random effects where
this correlation assumption is done away with. Finally, I want to conduct
the Hausman test for model choice.

Thank you,

Regards,
Yashree

[[alternative HTML version deleted]]
John Poe
2018-08-23 15:43:17 UTC
Permalink
Yep,

Peter Westfall wrote up how to do it in an example script
http://westfall.ba.ttu.edu/ISQS5349/Hausman_test_inR.txt

Please be aware that the test does not imply that you shouldn't use random
effects if there is correlation between a group-varying intercept and a
lower level variable. It just means that you need to do something to
properly model that correlation. That could be a within-group only model
with dummy variables for groups (standard Fixed Effects models) or a
group-mean centered model a la much of multilevel modeling. In econ this is
known as a Hausman Taylor model (yes, the same Hausman as the test) or a
correlated random effects model. You could also use a random slopes model
to allow the variability in Xi across groups but it's less effective at
debiasing than the other choices.
Post by Yashree Mehta
Hello,
Is there a way to conduct the Hausman test on models which have been
estimated using lme4?
To be more specific,
My model assumption is that the plot size(X covariate) is correlated with
the random intercept ( estimated from Household_ID) which will be
estimated. So I have to find out how to tell lmer to consider this
correlation. I would also, similarly, want to carry random effects where
this correlation assumption is done away with. Finally, I want to conduct
the Hausman test for model choice.
Thank you,
Regards,
Yashree
[[alternative HTML version deleted]]
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
--
Thanks,
John


John Poe, Ph.D.
Postdoctoral Scholar / Research Methodologist
Center for Public Health Services & Systems Research
University of Kentucky
www.johndavidpoe.com

[[alternative HTML version deleted]]
Yashree Mehta
2018-08-23 17:05:43 UTC
Permalink
Thank you very much for your reply.

I see that the function "lm" is used for fixed effects and lmer for random
effects. I want to use lmer and specify a random intercept for the fixed
effects model. (In the terminology of efficiency analysis, it can be called
" fixed effects-random intercept" model.
To be more specific,

A random intercept based on the Household_id is to be included for both
models:
1) Where it is assumed that the random intercept is correlated with
X-covariates (Fixed effects)
2)Where this not assumed. i.e. a correlation of 0. (Random effects)

Having estimated the two models, I want to conduct the Hausman test.

Thanks again,

Regards,
Yashree
Post by John Poe
Yep,
Peter Westfall wrote up how to do it in an example script
http://westfall.ba.ttu.edu/ISQS5349/Hausman_test_inR.txt
Please be aware that the test does not imply that you shouldn't use random
effects if there is correlation between a group-varying intercept and a
lower level variable. It just means that you need to do something to
properly model that correlation. That could be a within-group only model
with dummy variables for groups (standard Fixed Effects models) or a
group-mean centered model a la much of multilevel modeling. In econ this is
known as a Hausman Taylor model (yes, the same Hausman as the test) or a
correlated random effects model. You could also use a random slopes model
to allow the variability in Xi across groups but it's less effective at
debiasing than the other choices.
Post by Yashree Mehta
Hello,
Is there a way to conduct the Hausman test on models which have been
estimated using lme4?
To be more specific,
My model assumption is that the plot size(X covariate) is correlated with
the random intercept ( estimated from Household_ID) which will be
estimated. So I have to find out how to tell lmer to consider this
correlation. I would also, similarly, want to carry random effects where
this correlation assumption is done away with. Finally, I want to conduct
the Hausman test for model choice.
Thank you,
Regards,
Yashree
[[alternative HTML version deleted]]
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
--
Thanks,
John
John Poe, Ph.D.
Postdoctoral Scholar / Research Methodologist
Center for Public Health Services & Systems Research
University of Kentucky
www.johndavidpoe.com
[[alternative HTML version deleted]]
John Poe
2018-08-23 17:42:44 UTC
Permalink
I'm getting a bit confused by your language.

A fixed effects model can either refer to a model with one intercept making
no allowance for group variability (so all the effects are assumed fixed
for the population) or a model where all between group variance is removed
from the main variables via dummy variables, the within transform, first
differencing or some other method and thus the betas represent the portion
of the effect common to the population and thus fixed.

If you want to do a hausman test you are comparing beta in a model with a
group varying intercept random effect and beta in a model where between
group effects are segregated via the above techniques. You do not include a
random effect in both models.

The hausman test is completely useless as a model specification tool if
you're going to use both a group mean centered (within transform) to get
the equivalent of a within group effects beta along with a group varying
intercept (random effect).

On Aug 23, 2018 1:05 PM, "Yashree Mehta" <***@gmail.com> wrote:

Thank you very much for your reply.

I see that the function "lm" is used for fixed effects and lmer for random
effects. I want to use lmer and specify a random intercept for the fixed
effects model. (In the terminology of efficiency analysis, it can be called
" fixed effects-random intercept" model.
To be more specific,

A random intercept based on the Household_id is to be included for both
models:
1) Where it is assumed that the random intercept is correlated with
X-covariates (Fixed effects)
2)Where this not assumed. i.e. a correlation of 0. (Random effects)

Having estimated the two models, I want to conduct the Hausman test.

Thanks again,

Regards,
Yashree
Post by John Poe
Yep,
Peter Westfall wrote up how to do it in an example script
http://westfall.ba.ttu.edu/ISQS5349/Hausman_test_inR.txt
Please be aware that the test does not imply that you shouldn't use random
effects if there is correlation between a group-varying intercept and a
lower level variable. It just means that you need to do something to
properly model that correlation. That could be a within-group only model
with dummy variables for groups (standard Fixed Effects models) or a
group-mean centered model a la much of multilevel modeling. In econ this is
known as a Hausman Taylor model (yes, the same Hausman as the test) or a
correlated random effects model. You could also use a random slopes model
to allow the variability in Xi across groups but it's less effective at
debiasing than the other choices.
Post by Yashree Mehta
Hello,
Is there a way to conduct the Hausman test on models which have been
estimated using lme4?
To be more specific,
My model assumption is that the plot size(X covariate) is correlated with
the random intercept ( estimated from Household_ID) which will be
estimated. So I have to find out how to tell lmer to consider this
correlation. I would also, similarly, want to carry random effects where
this correlation assumption is done away with. Finally, I want to conduct
the Hausman test for model choice.
Thank you,
Regards,
Yashree
[[alternative HTML version deleted]]
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
--
Thanks,
John
John Poe, Ph.D.
Postdoctoral Scholar / Research Methodologist
Center for Public Health Services & Systems Research
University of Kentucky
www.johndavidpoe.com
[[alternative HTML version deleted]]
Yashree Mehta
2018-09-03 13:32:03 UTC
Permalink
Thanks for your explanation.

I now understand the two different references of the fixed effects model. I
want to conduct the Hausman test as described by you , " comparing beta in
a model with a group varying intercept random effect and beta in a model
where between group effects are segregated". The confusion arose because I
was referring to the household-specific within-transformation parameter
(fixed effect) as the random intercept.

The link which you provided is very helpful.

Regards,
Yashree
Post by John Poe
I'm getting a bit confused by your language.
A fixed effects model can either refer to a model with one intercept
making no allowance for group variability (so all the effects are assumed
fixed for the population) or a model where all between group variance is
removed from the main variables via dummy variables, the within transform,
first differencing or some other method and thus the betas represent the
portion of the effect common to the population and thus fixed.
If you want to do a hausman test you are comparing beta in a model with a
group varying intercept random effect and beta in a model where between
group effects are segregated via the above techniques. You do not include a
random effect in both models.
The hausman test is completely useless as a model specification tool if
you're going to use both a group mean centered (within transform) to get
the equivalent of a within group effects beta along with a group varying
intercept (random effect).
Thank you very much for your reply.
I see that the function "lm" is used for fixed effects and lmer for random
effects. I want to use lmer and specify a random intercept for the fixed
effects model. (In the terminology of efficiency analysis, it can be called
" fixed effects-random intercept" model.
To be more specific,
A random intercept based on the Household_id is to be included for both
1) Where it is assumed that the random intercept is correlated with
X-covariates (Fixed effects)
2)Where this not assumed. i.e. a correlation of 0. (Random effects)
Having estimated the two models, I want to conduct the Hausman test.
Thanks again,
Regards,
Yashree
Post by John Poe
Yep,
Peter Westfall wrote up how to do it in an example script
http://westfall.ba.ttu.edu/ISQS5349/Hausman_test_inR.txt
Please be aware that the test does not imply that you shouldn't use
random effects if there is correlation between a group-varying intercept
and a lower level variable. It just means that you need to do something to
properly model that correlation. That could be a within-group only model
with dummy variables for groups (standard Fixed Effects models) or a
group-mean centered model a la much of multilevel modeling. In econ this is
known as a Hausman Taylor model (yes, the same Hausman as the test) or a
correlated random effects model. You could also use a random slopes model
to allow the variability in Xi across groups but it's less effective at
debiasing than the other choices.
Post by Yashree Mehta
Hello,
Is there a way to conduct the Hausman test on models which have been
estimated using lme4?
To be more specific,
My model assumption is that the plot size(X covariate) is correlated with
the random intercept ( estimated from Household_ID) which will be
estimated. So I have to find out how to tell lmer to consider this
correlation. I would also, similarly, want to carry random effects where
this correlation assumption is done away with. Finally, I want to conduct
the Hausman test for model choice.
Thank you,
Regards,
Yashree
[[alternative HTML version deleted]]
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
--
Thanks,
John
John Poe, Ph.D.
Postdoctoral Scholar / Research Methodologist
Center for Public Health Services & Systems Research
University of Kentucky
www.johndavidpoe.com
[[alternative HTML version deleted]]

Loading...