[R] Crossed random effects in lme

anord andreas.nord at zooekol.lu.se
Mon Oct 18 14:06:18 CEST 2010


Dear all, 

I am trying to fit a model with crossed random effects using lme. In this
experiment, I have been measuring oxygen consumption (mlmin) in bird
nestlings, originating from three different treatments (treat), in a
respirometer with 7 different channels (ch). I have also measured body mass
(mass) for these birds. 

id	        nest	treat	year	mlmin	                mass	ch	hack
1EP51711	17	H	2008	1.401719138	10.7	4	2008:17
1EP51709	17	H	2008	1.257163112	9.7	5	2008:17
1EP51716	17	H	2008	1.050170714	10.2	6	2008:17
1EP51712	17	H	2008	1.330495314	9.6	7	2008:17
1EP51791	687	M	2008	1.07625708	        9.7	3	2008:687
1EP51772	823	H	2008	1.336820232	10.2	4	2008:823
1EP51778	613	L	2008	1.300814516	10.7	5	2008:613
1EP52336	207	M	2008	1.071775936	10.7	3	2008:207
1EP52403	808	H	2008	1.142389688	10.3	5	2008:808
1ER17603	838	M	2009	0.984225217	9.6	3	2009:838
1ER17607	838	M	2009	1.045058894	9.3	4	2009:838
1ER17600	247	L	2009	1.047603048	9.2	5	2009:247
1ER17299	247	L	2009	0.974569658	9.2	6	2009:247
1ER17292	617	H	2009	1.271260094	10.5	7	2009:617
1ER17206	7009	M	2009	1.074791644	10.7	2	2009:7009
1ER17221	730	H	2009	1.423266177	10.2	4	2009:730
1ER17275	863	L	2009	1.433076022	10.7	4	2009:863
1ER17277	863	L	2009	1.165236024	9.7	5	2009:863
1ER17283	863	L	2009	1.139311895	10.4	6	2009:863
1ER17280	863	L	2009	1.056161196	10.4	7	2009:863
CK59991	690	H	2010	0.994878996	9.5	2	2010:690
CK59806	161	M	2010	1.070052025	9.7	6	2010:161
CK59859	545	M	2010	1.456680579	9.9	4	2010:545
CK59862	545	M	2010	1.350698793	9.9	5	2010:545
CK59871	223	L	2010	0.830582186	8.3	6	2010:223
CK59868	223	L	2010	0.776241825	8	7	2010:223
CL77343	365	M	2010	1.352454484	10.3	4	2010:365
CL77338	365	M	2010	1.327691628	9.6	5	2010:365
CL77356	191	H	2010	1.212796979	11.3	1	2010:191
CL77361	191	H	2010	0.882307732	11.4	2	2010:191
CL77355	191	H	2010	1.137097586	10.9	3	2010:191

I want to include both nesting attempt (hack) and respirometer channel (ch)
as random factors in a model trying to explain variation in oxygen
consumption. From Pinheiro & Bates (2000), I've gathered that this model
could be fit making use of pdBlocked and pdIdent, so I've tried fitting the
below model:

m1.bmr<-with(bmred.df,lme(mlmin~treat*year+massout,random=pdBlocked(list(pdIdent(~hack-1),pdIdent(~ch-1)))
))

However, my model fails with the following error message:
Error in getGroups.data.frame(dataMix, groups) : 
  Invalid formula for groups

I would much appreciate any input on this! 

Kind regards, 
Andreas Nord
Sweden





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



More information about the R-help mailing list