Dear All,

 

I am working with linear mixed-effects models using the lme4 package in
R. I created a model with the lmer function including some main effects,
a two-way interaction and a random effect. Now I am searching how I
could incorporate an interaction between the random effect and one of
the fixed effects.

 

I tried to express the interaction in:

recap_random3<-lmer(breath~handling+stress+stress:handling+(1|rnr)+(0|rn
r:stress))

however R gives me the following error message

:

Error in eval(expr, envir, enclos) : fl[[2]] must be a factor of length
1744

In addition: Warning messages:

1: numerical expression has 1744 elements: only the first used in:
rnr:stress 

2: numerical expression has 1744 elements: only the first used in:
rnr:stress

 

If I fit this model in SPSS, this gives me output, but I don't know
whether I can trust that.

 

 

Therefore I went to look for an alternative:

After looking at the help function in R for lmer I deduced these models.


Examples from R

(fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy))
(fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject),
sleepstudy))
anova(fm1, fm2)

 

 

My models would then look like this:

 

recap_random0<-lmer(breath~handling+stress (1|rnr))

recap_random1<-lmer(breath~handling+stress (1|rnr)+(0+stress|rnr))

 

However, I do not know how to interpret the results. Does the model see
stress|rnr as an interaction between stress and rnr, or did it take
stress nested in rnr.

 

> summary(recap_random1)

Linear mixed-effects model fit by REML 

Formula: breath ~ handling + stress + stress:handling + (1 | rnr) + (0 +
stress | rnr) 

  AIC  BIC logLik MLdeviance REMLdeviance

 9748 9781  -4868       9719         9736

Random effects:

 Groups   Name        Variance Std.Dev.

 rnr      (Intercept) 55.6711  7.4613                       # BUT

 rnr      stress      15.2805  3.9090                       # Does this
output line express the interaction??? 

 Residual              7.4567  2.7307                    # If not, how
should the interaction output look like?

number of obs: 1744, groups: rnr, 217; rnr, 217

 

Fixed effects:

                 Estimate Std. Error t value

(Intercept)     28.164471   0.716359   39.32

handling         0.012477   0.012330    1.01

stress           0.636979   0.416011    1.53

 

Correlation of Fixed Effects:

            (Intr) hndlng stress

handling    -0.645              

stress      -0.517  0.667       

 

 

Could anybody please give me an advice how to solve this problem? Which
way is correct to express interaction in the random factors? How should
the output look like?

 

Thank you in advance,

Eva Fucikova

 

********************************************

Msc. Eva Fucikova 
Netherlands Institute of Ecology (NIOO-KNAW) 
PO Box 40 
6666 ZG Heteren 
The Netherlands 
tel.: +31 (0)26 4791248 
Email:E.Fucikova@nioo.knaw.nl 

*******************************************

 


	[[alternative HTML version deleted]]


