Meredith, Christy S -FS
2013-Sep-06 16:57 UTC
[R] using correlation compound correlation structure with nlme; how to incorporate multple random effects?
Hello, I have developed this model to test change in PTFines6 over time. I have random effects of watershed (HUC3) and management type (mgmt3), and then I have the YrC/SiteID random effect which is the longitudinal time effect. But I recently found out that I need to incorporate a compound correlation structure. I found examples of this where there is just one random effect, but not my case where I have multiple. I am not sure if I just include YrC|SiteID or the entire random effect. I have tried both, and get error messages: Original code: model5.15_e=lme(PTFines6~HUC3 + YrC*mgmt3 + Bf* mgmt3 + LnGrad * mgmt3+ Precip ,random=list( ~1|HUC3,~1|mgmt3,1~(YrC)|SiteID),na.action=na.omit, data=habitat2,method="REML",control=control1) #22835 no precip interaction I have tried: model5.15_e=lme(PTFines6~HUC3 + YrC*mgmt3 + Bf* mgmt3 + LnGrad * mgmt3+ Precip ,random=list( ~1|HUC3,~1|mgmt3,1~(YrC)|SiteID),na.action=na.omit, data=habitat2, correlation=corCompSymm(form=1~(YrC)|SiteID),method="REML",control=control1) #22835 no precip interaction I get the message: incompatible formulas for groups in "random" and "correlation" I have tried: model5.15_e=lme(PTFines6~HUC3 + YrC*mgmt3 + Bf* mgmt3 + LnGrad * mgmt3+ Precip ,random=list( ~1|HUC3,~1|mgmt3,1~(YrC)|SiteID),na.action=na.omit, data=habitat2, correlation=corCompSymm(form=~1|HUC3,~1|mgmt3,1~(YrC)|SiteID),method="REML",control=control1) #22835 no precip interaction I get the error message "non-numeric argument to mathematical function Thanks for any help. Christy Meredith This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately. [[alternative HTML version deleted]]
Bert Gunter
2013-Sep-06 17:19 UTC
[R] using correlation compound correlation structure with nlme; how to incorporate multple random effects?
You would do better to post this on the R-sig-mixed-models or R-sig-ecology list. Cheers, Bert On Fri, Sep 6, 2013 at 9:57 AM, Meredith, Christy S -FS < csmeredith@fs.fed.us> wrote:> > > Hello, > I have developed this model to test change in PTFines6 over time. I have > random effects of watershed (HUC3) and management type (mgmt3), and then I > have the YrC/SiteID random effect which is the longitudinal time effect. > But I recently found out that I need to incorporate a compound correlation > structure. I found examples of this where there is just one random effect, > but not my case where I have multiple. I am not sure if I just include > YrC|SiteID or the entire random effect. I have tried both, and get error > messages: > Original code: > > model5.15_e=lme(PTFines6~HUC3 + YrC*mgmt3 + Bf* mgmt3 + LnGrad * mgmt3+ > Precip ,random=list( > ~1|HUC3,~1|mgmt3,1~(YrC)|SiteID),na.action=na.omit, > data=habitat2,method="REML",control=control1) #22835 no precip interaction > > > > I have tried: > > model5.15_e=lme(PTFines6~HUC3 + YrC*mgmt3 + Bf* mgmt3 + LnGrad * mgmt3+ > Precip ,random=list( > ~1|HUC3,~1|mgmt3,1~(YrC)|SiteID),na.action=na.omit, data=habitat2, > correlation=corCompSymm(form=1~(YrC)|SiteID),method="REML",control=control1) > #22835 no precip interaction > > I get the message: incompatible formulas for groups in "random" and > "correlation" > > > > I have tried: > model5.15_e=lme(PTFines6~HUC3 + YrC*mgmt3 + Bf* mgmt3 + LnGrad * mgmt3+ > Precip ,random=list( > ~1|HUC3,~1|mgmt3,1~(YrC)|SiteID),na.action=na.omit, data=habitat2, > correlation=corCompSymm(form=~1|HUC3,~1|mgmt3,1~(YrC)|SiteID),method="REML",control=control1) > #22835 no precip interaction > I get the error message "non-numeric argument to mathematical function > > > Thanks for any help. > > Christy Meredith > > > > > This electronic message contains information generated by the USDA solely > for the intended recipients. Any unauthorized interception of this message > or the use or disclosure of the information it contains may violate the law > and subject the violator to civil or criminal penalties. If you believe you > have received this message in error, please notify the sender and delete > the email immediately. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm [[alternative HTML version deleted]]