I have a data like this, ticks feed on three groups of treated mouses, compare whether the treatment has an effect on ticks' bacteria load.

when I made a mixed model like:

lmer.model01 = lmer(log10.load ~ treat + (1|mouse.id/tick.id))

The screen says:

Error: number of levels of each grouping factor must be < number of observations

What happened and how can I change my model?

  • 5
    $\begingroup$ Without being able to look at the data, I suspect that you have not enough replicates given your nested grouping structure, i.e. (1|mouse.id) + (1|mouse.id : tick.id). Have a look here or here for more examples/answers. $\endgroup$ – Stefan Dec 13 '15 at 18:45

@Stefan is probably right. If you have a single measurement per tick then you should leave the explicit mouse.id:tick.id grouping variable out of the model, i.e. use log10.load ~ treat + (1|mouse.id). Alternatively, if this is a nested design (each mouse gets one treatment, each tick is fed on a single mouse, multiple ticks per mice) you could also follow Murtaugh 2007 "Simplicity and complexity in ecological data analysis" Ecology 88 and simply compute the average load per mouse, then use a simple lm(log10.load~treat,data=aggregated_data). (If you insist on fitting the model the way it is you can use control=lmerControl(check.nobs.vs.nlev="ignore"), but I don't advise it.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.