Matthew Forister
2005-Oct-30 16:02 UTC
[R] Help with Subtracting an effect from a Mixed Model
Hi Everyone, I posted a similar question about a week ago, but haven't gotten any replies -- I'm afraid that's because my previous question was too vague. Let me try again with a more specific question, and I hope someone can help. NOTE, I know I should be using the newer lme4 package, I just haven't had a chance to update my version of R yet, so the question below relates to nmle. I have data from a classical quantitative genetics experiment, with 33 sires mated each to 2 dams, with 15 progeny from each dam raised on 5 host plants (3 larvae per host). So the model I would like to run has the following factors: Host (fixed) Sire (random) Dam [nested within sire] (random) Host * Sire (random interaction) Host * Dam [nested within sire] (random interaction) This is the code I am using for that complete model: lme1=lme(gain~host,random=~host|sire/dam) I would like to try the model with and without each of those random interactions (host*sire and host*dam-nested-within-sire). WHAT IS THE SYNTAX FOR SUBTRACTING AN EFFECT FROM THE RANDOM STATEMENT? I have tried: lme1=lme(gain~host,random=~host|sire/dam-sire:host) But I get an "Invalid formula for groups" error. Alternatively, I tried reorganizing the code, so that the interaction would be left out. But there is no way to take out host*sire while still leaving in host*dam nested within sire. any help will be greatly appreciated! 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 - - -
Spencer Graves
2005-Nov-06 22:03 UTC
[R] Help with Subtracting an effect from a Mixed Model
1. Have you considered specifying the random effect as a list? This is mentioned in the help file and discussed in Pinheiro and Bates (2000) Mixed-Effects Models in S and S-Plus (Springer). On p. 40, they discuss the following example that might help you: lme(pixel~day+day^2, data=Pixel, random=list(Dog=~day, Side=~1). (I highly recommend this book, by the way.) 2. Doug Bates has made several contributions to this within the past year or so, which you can find by purusing the documentation for the functions in the lme4 and using RSiteSearch. The following was useful for me with an apparently similar issue: "http://finzi.psych.upenn.edu/R/Rhelp02a/archive/47423.html". 3. If you'd like further help from this list, I encourage you to read the posting guide, "www.R-project.org/posting-guide.html", especially the part about submitting a self-contained toy example that illustrates your question. If someone can copy a few lines of code from your email into R and try a few things in a couple of minutes, I believe it will increase the chances that you will get quick, useful answers. hope this helps. spencer graves Matthew Forister wrote:> Hi Everyone, > > I posted a similar question about a week ago, but haven't gotten any > replies -- I'm afraid that's because my previous question was too > vague. Let me try again with a more specific question, and I hope > someone can help. NOTE, I know I should be using the newer lme4 > package, I just haven't had a chance to update my version of R yet, so > the question below relates to nmle. > > I have data from a classical quantitative genetics experiment, with 33 > sires mated each to 2 dams, with 15 progeny from each dam raised on 5 > host plants (3 larvae per host). So the model I would like to run has > the following factors: > Host (fixed) > Sire (random) > Dam [nested within sire] (random) > Host * Sire (random interaction) > Host * Dam [nested within sire] (random interaction) > > This is the code I am using for that complete model: > lme1=lme(gain~host,random=~host|sire/dam) > I would like to try the model with and without each of those random > interactions (host*sire and host*dam-nested-within-sire). > > WHAT IS THE SYNTAX FOR SUBTRACTING AN EFFECT FROM THE RANDOM STATEMENT? > I have tried: > lme1=lme(gain~host,random=~host|sire/dam-sire:host) > But I get an "Invalid formula for groups" error. > Alternatively, I tried reorganizing the code, so that the interaction > would be left out. But there is no way to take out host*sire while > still leaving in host*dam nested within sire. > > any help will be greatly appreciated! > 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 > - - - > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html-- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA spencer.graves at pdf.com www.pdf.com <http://www.pdf.com> Tel: 408-938-4420 Fax: 408-280-7915
Possibly Parallel Threads
- syntax for interactions in lme
- lme4 problem: model defining and effect estimation ------ question from new bird to R community from SAS community
- Pedigree / Identifying Immediate Family of Index Animal
- Recoding multiple columns consistently
- loop over large dataset