[R-sig-ME] Testing interaction between fixed effect and random effect nested within another random effect

Eoin Duffy eoinduffy0000 at googlemail.com
Tue Oct 28 22:14:04 CET 2014


Hello mixed model list


I am working on a mixed model using lmer in R and I am a bit stuck on some
coding. I have measured male and female fitness in Drosophila from 35
inbred lines (genotype) over three blocks.

My response variable is 'fitness' with n=10 individuals/sex/line/block
tested.

Sex is fixed, Block is random and Line nested within block is random. I
primarily interested in the interaction between sex and line. Therefore my
model looks like

m1<-lmer(FitnessCured~Sex+(1|Block/Line)+(1|Block)+(1|Sex:Line),noNAdata)

If I wanted to tested the significance of the Sex:Line interaction my plan
is to just compare the above model to a model without the interaction and
use anova to compare the two models

e.g. m2<-lmer(FitnessCured~Sex+(1|Block/Line)+(1|Block),noNAdata)
anova(m1,m2)

However what I am wondering is if I am testing the significance of the
Sex:Line interaction (included as a random effect) will R know Line is
nested within Block ???

How do I specify the interaction between Sex by Line nested within Block ??

Should it be something like

 m1T<-lmer(FitnessCured~Sex+(1|Block/Line)+(1|Block)+(1|Sex:Block:Line)

Any thoughts would be appreciated. I have included a sample of my data below

     Block Line Sex FitnessInfected FitnessCured2        1    2   M
      1.4573       0.22153        1    2   M          1.1551
1.13794        1    2   M          1.4573       1.13797        1    2
 M          1.4573       0.41089        1    2   M         -1.5648
  1.137911       1    2   F         -0.2669      -1.247312       1
2   F          0.2785      -1.247313       1    2   F         -0.5396
    -1.247314       1    2   F         -0.5396       0.460215       1
  2   F          1.8237      -1.247316       1    2   F
0.7330       0.496517       1    2   F          1.5511      -1.247318
     1    2   F         -0.5396       1.477419       1    2   F
  1.0966       1.186820       1    2   F         -0.5396
-1.247321       1    3   M          1.2054       0.716222       1    3
  M          1.2585       0.314624       1    3   M         -1.5648
   0.267226       1    3   M         -0.8932      -0.861527       1
3   M          0.5047       1.137928       1    3   M          0.7704
     1.137929       1    3   M         -1.5648      -1.768931       1
  3   F         -0.5396       0.678232       1    3   F
-0.5396      -1.247333       1    3   F         -0.5396       1.077834
      1    3   F         -0.5396      -1.247335       1    3   F
  -0.5396      -1.247336       1    3   F         -0.5396
0.714537       1    3   F         -0.5396       0.7508

-- 
Eoin Duffy

PhD Researcher
Institute of Environmental Sciences
Jagiellonian University
Gronostajowa 7
30-387, Krakow
Poland

	[[alternative HTML version deleted]]



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