Re: [R] How to run interaction between to categoric variables in lme()?

From: Dieter Menne <>
Date: Wed, 30 Jan 2008 15:13:03 +0000 (UTC)

Falco tinnunculus <kestrel78 <at>> writes:

> How do I run interaction between to categoric variables in lme()?
> I tried this:
> > lmefit1<- lme(Handling ~Mass+factor(Prey)+factor (Decap)+
> factor(Prey)*factor(Decap), random = ~ 1 |Place, data=nestling1)
> Error in MEEM(object, conLin, control$niterEM) :
> Singularity in backsolve at level 0, block 1

First, I would suggest that you make Prey, Decap factors in your data frame. Makes for a much easier reading, and fewer errors if you test

nestling1$Prey = as.factor(nestling1$Prey) nestling1$Decap = as.factor(nestling1$Decap) lmefit1<- lme(Handling ~Mass+Decap*Prey, random = ~ 1 |Place, data=nestling1)

You should not write


I you want to do it explicitly, used the colon instead


or, let lme do the dirty (i.e. in most cases correct) work:


which will expand to what you need. If you still get the error message, it's your data: you want to much from them. Check if you have enough degrees of freedom left, or if the data set is degenerate by not including a sufficient number of pairing.

Dieter mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 30 Jan 2008 - 15:17:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 Jan 2008 - 16:30:10 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive