[R] syntax for interactions in lme

Matthew Forister forister at life.bio.sunysb.edu
Wed Oct 26 18:33:33 CEST 2005



Hello,

I am trying to make the switch from SAS, and I have a fairly elemental 
problem with syntax using the nlme package for analyzing mixed models.  
There was a previous question on this topic posted to this list, so I 
apologize for redundancy, but I didn't understand the advice given to 
that inquiry.  The model I want to run has the following factors:

Host (fixed)
Sire (random)
Dam nested within Sire (random)
Host * Sire (random)
Host * Dam within Sire (random)

So without the interactions I have:

hogmodel = lme(gain ~ host, random = ~1|sire/dam)

If I understand correctly, that "sire/dam" term gives me both Sire and 
Dam within Sire as random factors.  OK, so now I want to add the two 
interactions (listed above)...

In SAS, I would just enter them as random factors, but I can't seem to 
make that work.  I think I need to make a list that includes Sire/Dam, 
Host:Sire, and Host:Sire/Dam.  Two questions:

1) Is it sufficient to have simply Host:Sire/Dam in order to code for 
both interactions (host*sire and host*dam-within-sire)?

2) In any event, WHAT IS THE SYNTAX FOR MAKING A LIST OF RANDOM FACTORS?

I have looked in section 1.3 of Pinheiro&Bates, which was helpful, but 
I wasn't able to answer my question.  Thanks in advance, your help will 
keep me from running back to SAS!

--Matt



- - -
Matthew L Forister
Department of Ecology and Evolution
State University of New York at Stony Brook
650 Life Sciences Building
Stony Brook, New York 11794-5245
Email: forister at life.bio.sunysb.edu
Webpage: http://life.bio.sunysb.edu/~forister/
Lab phone: (631) 632-8609
Fax: (631) 632-7626
- - -




More information about the R-help mailing list