[R-sig-ME] Random intercept for subgroup

Luca Corlatti luca.corlatti at boku.ac.at
Mon Dec 19 09:50:32 CET 2016


Dear list members, 
suppose I have a case study with 2 different populations, A and B. For
both groups I have data on body mass, length and sex of a given species.
For group A data were collected over different years, and I may be
interested to include the cohort in the analysis as a random effect,
while for group B I have no such information. The dataframe would look
something like:

Pop		Coh		Weight	Length	Sex
A		2010	12.1		34		m
A		2011	13.4		42		m
A		2012	10.3		36		f
A		2010	10.5		32		m
A		2013	12.1		37		f
A		2014	12.4		35		f
A		2011	14.1		32		f
...
B		NA		13.1		36		m
B		NA		10.5		35		f
B		NA		12.4		32		fB		NA		12.6		35		m
…

Let's now suppose I want to investigate the relationship between Weight
and Length, for males and females of different populations, i.e. using a
3-way interaction.  Would it still be possible to run the analysis in
one single mixed model with a random intercept (cohort) only for group
A, or would I be forced to use 2 different models, one for population A
(random intercept model) and one for population B (fixed effect model)?

With my actual dataset, a lmer (Weight~Length*Sex*Pop + (1 + Pop | Coh)
) fitted changing NA to 1 seems to give the same estimate for Population
B as the lm (Weight~Length*Sex*Pop), but I am not quite sure this is the
correct approach.

Thanks,

Luca




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