[R-sig-ME] mixed model with crossed effects

Sharif S. Aly saly at ucdavis.edu
Thu Nov 15 08:02:40 CET 2007


Dear list,
If you please help me with the R command for a 4 level random effects 
model I would be grateful.  I chose to put the details of my study at 
the end of the email as some may prefer not to read it.

My outcome is continuous (normally distributed). All levels are factor 
levels. The lowest level (veterinarian) is crossed with level 2 (day of 
sampling) which is crossed with level 3 (sampled pen or location on 
farm) which is nested in level 4 (dairy).

I understand I have to specify the grouping structure of the data before 
the model command, is that correct?  My model so far is:

XCoutcome<-GroupedData: outcome~ Dairy | Pen.number | cons

lme(AvgPCR~ 1, random = ~ 1 | Dairy /Pen.number / 
pdBlocked(list(pdIdent(~ENV),pdIdent(~Veterinarian))), data=XCoutcome)

Best regards,
Sharif

Description of study design:
My data is comprised of bacteria counts in samples collected by 2 
veterinarians over 3 days from different pens (stalls that house cows) 
nested in different dairies. Vet is crossed with day which is crossed 
with pen (because vet 1 is the same vet 1 who sampled on all days (as is 
vet 2), and day 1 is the same day 1 of sampling in all pens (as is days 
2 and 3)); pens however are nested in dairies, meaning that pen 1 in 
dairy 1 is different that pen 1 in dairy 2, 3 and 4.
My objective was to estimate the similarity in bacterial counts in 
samples collected by 2 vets, in the same pen, in the same dairy (that 
specific intraclass correlation coefficient) and for reasons I can 
explain, I chose to have only a fixed effect intercept (basically we are 
not interested in the effect of any particular vet, pen or dairy or day, 
i.e. we do not wish to estimate the effect of Nov 16 per say)



Sharif Aly,
Graduate group in Epidemiology,
University of California, Davis




More information about the R-sig-mixed-models mailing list