Reed, Nicola <nr232 <at> exeter.ac.uk> writes: > I was hoping to get some advice regarding the testing of interactions, > when one factor is modelled as a > random effect... > I have a model with binomial error structure where the response > variable is the proportion of time spent at > the main sett (animals were tracked for 28 consecutive days > in each season, and were recorded either at the > main sett or an outlier sett, so the response variable is a number out of 28). > Animals from 9 social groups were tracked for 28 days in each of > the four seasons of the year. > Thus, in my model, 'individual' nested within 'social group' > are my random error terms. > > model<-lmer(binom~season+(1|group/individual),binomial,data=data1) > > Group explains some variation in the sett use patterns, > and what i was wanting to test and display was an > interaction between season and group, as the raw data suggests > that different groups may behave > differently in different seasons. Is there a way to do this in > the lmer package? > > When i put it in directly: > > model<-lmer(binom~season*group+(1|group/individual),binomial,data=data1) > > I get an error messgae: > Warning message: > In mer_finalize(ans) : gr cannot be computed at initial par (65) > I think you want
binom~season + (season|group) + (1|individual) [assuming that individuals are coded uniquely, i.e. you don't have an 'individual A' in each group] If you had enough data to consider testing variation in seasonality among individuals, you could try binom~season + (season|group/individual) was the switch from 'individual' above to 'badger' below a slip? Thanks for the clear description. Ben Bolker ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.