[R] Nesting random effects in lmer

MRak mrakhovs at gmail.com
Tue Mar 8 05:09:58 CET 2011


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-tp3340623p3340623.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list