[R] nested random factor using lme produces errors

Ben Bolker bbolker at gmail.com
Sun Feb 17 18:33:14 CET 2013

melswed <amelie.truchy <at> slu.se> writes:

> Hi,
> I am running a mixed-effect model with a nested-random effect. I am
> interested in gut parasites in moose. I has three different type of
> treatment that I applied to moose which are from different "families". My
> response variable is gut parasites and the factors are moose families which
> is nested within treatment. My data is balanced.
> To answer this question, I used the lme function like this :
> model=lme(parasite~drug,random=~1|drug/family)
> But doing a summary on this model gives me warning message :
> In pt(-abs(tTable[, "t-value"]), tTable[, "DF"]) : NaNs produced
> I don't understand why ?! I noticed that the p-values are not computed and
> have NAs values for drug2 and drug3 (from the summary of this model)
> Moreover, in the summary, I noticed that in the random effects line I have
> standard deviation for Formula: ~1 | drug and for Formula: ~1 | family %in%
> drug. Does R consider drug as a random factor as well ?
> And last question, how can I know if my random factor has a significant
> effect on the gut parasites ?

  This belongs on r-sig-mixed-models at r-project.org.  Hint: it very rarely
makes sense to include a categorical predictor such as drug as both
a random and a fixed effect ... this model is overspecified.  For 
computational and philosophical reasons, it seems unwise and odd 
(respectively) to treat drug as a random effect.

  I might have more to say but will say it (perhaps) if you repost on
r-sig-mixed-models .

More information about the R-help mailing list