[R-sig-ME] lmer L.ratio

Ben Bolker bbolker at gmail.com
Fri Apr 15 04:45:26 CEST 2011


On 11-04-14 10:22 PM, Sujal Phadke wrote:
> Cross-posting here because it was suggested so.
> 
> I am using the following model
> 
> model1=lmer(PairFrequency~MatingPair+(1|DrugPair)+(1|DrugPair:MatingPair),
> data=MateChoice, REML=F)
> 
> 1. After reading
> https://stat.ethz.ch/pipermail/r-sig-mixed-models/2009q1/001966.html,
> I have learned that the above code is the right way to analyze a
> mixed model with the MatingPair as the fixed effect, DrugPair as the
> random effect and the interaction between these two as the random
> effect as well. Please confirm if that seems correct.

  Did you read the answer I provided on r-help?  I do not believe that
(1|DrugPair:MatingPair) is correct, I think you should use
(MatingPair|DrugPair).  Actually, you don't need
(1|DrugPair)+(MatingPair|DrugPair), because the latter term contains an
implicit intercept term.  Leave out (1|DrugPair)
> 
> 2. Assuming the above code is correct, I have model2 in which I
> remove the interaction term, model3 in which I remove the DrugPair
> term and model4 in which I only keep the fixed effect of MatingPair.

  There appears to be no question here ...

> 
> 3. I would like to know how would the same model(s), especially the
> interaction term, be written in lme rather than lmer.
> (MatingPair|DrugPair) was suggested but I am under the impression
> that this represents nesting. Please confirm. *Most posts I have
> found deal with nesting but there is absolutely no nesting in my
> data*

  This does *not* represent nesting.  It represents variation in the
effect of mating pair across levels of drug pair.  Nesting is typically
expressed as a/b or b %in% a.

> or do I have to use pdBlocked and pdIdent (Pinheiro-Bates 2000,
> P.163-167)...I still could not figure it out? or will the following
> do?

  No, you don't have to.
> 
> lme(PairFrequency~MatingPair,
> random=~(1|DrugPair)+(1|DrugPair:MatingPair), data=MateChoice,
> method="ML")...is this a right way for lme?

  This should be random=~MatingPair|DrugPair

  As I said above (and in my response on r-help), you should use
(MatingPair|DrugPair).  If you wanted to treat MatingPair as
a *random* effect, and you *wanted* MatingPair to be nested
within DrugPair, then the syntax above would be correct.

  You could just try it and see that you get essentially the
same answer as in lmer ...


> 
> Sujal. P. p.s: If it matters how data are arranged, then I have one
> vector called MatingPair which has 3 levels and another vector
> DrugPair which also has 3 levels. The PairFrequency data is a count
> data and is normally distributed. The data are huge, hence I am not
> able to post it here. Levels of DrugPair represent three randomly
> chosen genotypes from a population of many.

  As I already said on r-help, trying to fit a random effect to 3 levels
will be problematic.  Even though they are *philosophically*
random effects, it won't work well.

> 
> lmer gives me the following output which I guess suggests that model1
> gives best fit?
> 
> Data: MateChoice Models: model2: PairFrequency ~ MatingPair + (1 |
> DrugPair) model3: PairFrequency ~ MatingPair + (1 |
> DrugPair:MatingPair) model1: PairFrequency ~ MatingPair + (1 |
> DrugPair) + (1 | DrugPair:MatingPair)
> 
> Df    AIC    BIC  logLik  Chisq Chi Df Pr(>Chisq) model2  5 274.90
> 282.82 -132.45 model3  5 282.44 290.36 -136.22 0.0000      0
> 1.00000 model1  6 276.90 286.40 -132.45 7.5443      1    0.00602 ** 
> --- Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> 
>




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