[R] Nesting random effects in lmer

From: MRak <mrakhovs_at_gmail.com>
Date: Mon, 07 Mar 2011 21:25:55 -0800 (PST)


Dear R experts,

Could you please tell me how to nest random effects in an lmer model?

Right now, my function looks like this:
Full<-lmer(Consortship~((1|Male)+(1|Female))+MaleRank+MaleAge+MMGroom+MMAggrRankControl+FemaleRank+FemaleAge+MFAggrMating+GroomBirth07+MatNoConsortGroomF, family=poisson)

However, a) I'm not sure if placing the two random effects (Male and Female) in parentheses actually achieves nesting, and b) I get an error message about variable MMGroom (Error in model.frame.default(formula = Consortship ~ ((1 + Male) + (1 + :
  invalid type (S4) for variable 'MMGroom'

Here are a few lines of my data set (unfortunately, my table has 12 columns and doesn't fit well):

Male MaleRank MaleAge MMGroom MMAggrRankControl Female FemaleRank FemaleAge MFAggrMating GroomBirth07 MatNoConsortGroomF Consortship

03D 0.756097561 13.48 0 0 15O 0.663157895 8.413415469 0.109289617 0 0 0
03D 0.756097561 13.48 0 0 22S 0.926315789 6.491444216 0.109289617 0 0 0
03D 0.756097561 13.48 0 0 35B 0.442105263 15.36481862 0 0 0.218579235 0
03D 0.756097561 13.48 0 0 38E 0.98 12.35318275 0 0 0.43715847 0.218579235
13I 0.49 10.15 0 0.022537751 25Z 0.27 4.410677618 0.383141762 0 0 0
13I 0.49 10.15 0 0.022537751 35F 0.21 12.3559206 0 1.53256705 0
14A 0.512195122 16.23 0 0 20R 0.59375 6.349075975 0.225225225 0 0

Also is it possible to calculate the RSS of GLMMs? If so, how can I do that?

Thank you for your help,

Maria

--
View this message in context: http://r.789695.n4.nabble.com/Nesting-random-effects-in-lmer-tp3340672p3340672.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_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.
Received on Tue 08 Mar 2011 - 08:54:37 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 Tue 08 Mar 2011 - 09:10:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive