[R-sig-ME] lmer model specification

Gustavo Betini betinig at uoguelph.ca
Fri Aug 19 23:32:30 CEST 2011


Dear Thierry, 

thanks for your comments. 

>2) I would recode the data and add a couple ID (assuming each person in only part of one couple in your dataset). lmer(y ~ f1 + f2 + f3 + temp * sex + (temp|couple) + (1|ID), data) 

That seems to be a reasonable approach. However, I would like to plot the behaviour of each sexes against temperature using the conditional modes (something similar to what D. Bates did in chapter 4 of his book with the sleepstudy data), because I have reasons to believe that males and females respond differently to changes in temperature. That is why I specified "(temp|id)" and used two separate models, one for males and one for females. Using couple ID as you suggested would give me a single conditional mode for each male and female from the same couple. Why was wondering if there is a way to specify this model without using the mate's behaviour as a fixed effect, which seems to be incorrect. 

Thanks, 

Gustavo S. Betini 



On 11-08-19 4:53 PM, ONKELINX, Thierry wrote: 

Dear Gustavo,

1) id:sex makes only sense if for a given id, multiple levels of sex are possible. So an individual can be male at one occasion and female at the next occasion. That's probably not what you want.

I would rather add a temperature:sex interaction to the fixed effects.
lmer(y ~ f1 + f2 + f3 + temp*sex + (temp|id), data)

Fitting the sexes seperatly is not needed.

2) I would recode the data and add a couple ID (assuming each person in only part of one couple in your dataset).
lmer(y ~ f1 + f2 + f3 + temp * sex + (temp|couple) + (1|ID),  data)

The couple random intercept and slope takes care of the within couple correlation. The ID random effect takes care of variability within the couple.

Best regards,

Thierry 

-----Oorspronkelijk bericht-----
Van: r-sig-mixed-models-bounces at r-project.org [ mailto:r-sig-mixed-models - bounces at r-project.org ] Namens Gustavo Betini
Verzonden: vrijdag 19 augustus 2011 20:53
Aan: r-sig-mixed-models at r-project.org Onderwerp: [R-sig-ME] lmer model specification

Dear all,

1. lets say that I want to look at the interaction between individual ID and
temperature. The response variable is some behaviour, lets say aggression.
Males and females might differ in the way they respond to temperature, so I
want to take it into account. Should I run two different models, one for male
and the other one for female, or should I include both in the same model:

mf1<-lmer(y ~ f1 + f2 + f3 + (temp|id:sex), data) - is this specification correct?

or

mfmales<-lmer(y ~ f1 + f2 + f3 + (temp|idmale), datamale) mffemales<-lmer(y ~
f1 + f2 + f3 + (temp|idfemale), datafemale)


2. I also want to investigate if behaviour of the male affects the behaviour of
the female. So I included the mate's behaviour as a fixed
effect:

mfmales<-lmer(y ~ f1 + f2 + f3 + female's behaiour + (temp|idmale),
datamale)

mffemales<-lmer(y ~ f1 + f2 + f3 + male's behaviour + (temp|idfemale),
datafemale)

However, the variance and SD for the individual ID random effect is almost the
same in both models (var=1.89 and SD=1.37), which tells me that there is
something wrong. Both males and females were measured together and their
behaviour is positive correlated (0.4). Should I include the mate's behaviour as a
fixed effect?

Any help would be much appreciated.

Gustavo S. Betini



*Male:*

Linear mixed model fit by REML
Formula: pclm ~ datejcm + stagecm + mtempcm + windscm + pclf + (1 |
site) +      (1 + mtempcm | id)
    Data: ndm
   AIC  BIC logLik deviance REMLdev
  2149 2197  -1064     2096    2127
Random effects:
  Groups   Name        Variance  Std.Dev. Corr
  id       (Intercept) 1.8947271 1.37649
           mtempcm     0.0074944 0.08657  0.428
  site     (Intercept) 0.1562428 0.39528
  Residual             1.4360044 1.19833
Number of obs: 589, groups: id, 83; site, 6

Fixed effects:
             Estimate Std. Error t value
(Intercept)  0.75545    0.23841   3.169
datejcm     -0.08297    0.02369  -3.503
stagecm      0.11100    0.02415   4.596
mtempcm      0.03910    0.02129   1.837
windscm     -0.08140    0.01944  -4.187
pclf         0.27352    0.03963   6.902




*Female:*

Linear mixed model fit by REML
Formula: pclf ~ datejcf + stagecf + mtempcf + windscf + pclm + (mtempcf
|      id)
    Data: ndf
   AIC  BIC logLik deviance REMLdev
  2149 2193  -1065     2096    2129
Random effects:
  Groups   Name        Variance  Std.Dev. Corr
  id       (Intercept) 1.8914944 1.375316
           mtempcf     0.0055747 0.074664 0.640
  Residual             1.5423388 1.241909
Number of obs: 589, groups: id, 68

Fixed effects:
             Estimate Std. Error t value
(Intercept)  0.62346    0.17896   3.484
datejcf     -0.02476    0.01536  -1.612
stagecf      0.06675    0.01584   4.213
mtempcf      0.01501    0.02129   0.705
windscf      0.02313    0.02014   1.149
pclm         0.30024    0.03726   8.057



	[[alternative HTML version deleted]]

_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models




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