ancova function in package HH
2
0
Entering edit mode
Qian Liu ▴ 110
@qian-liu-4216
Last seen 10.2 years ago
Hi there, I tried to use the function ancova to analyze covariance in my model. my model is like the following; I want to include two treatments(trt1, trt2) , their interaction and one covariate (covar1) y ~ trt1+trt2+trt1*trt2+ covar1 R code: mydata$trt1=factor(mydata$trt1) # 2 levels contrasts(mydata$trt1)=contr.treatment(2) mydata$trt2=factor(mydata$trt2) # 2 levels contrasts(mydata$trt2)=contr.treatment(2) mydata$trt1.trt2=interaction(mydata$trt1,mydata$trt2) contrasts(mydata$trt1.trt2) <- contr.treatment(4) model=ancova(y ~ trt1*trt2+ covar1, data=mydata) # there is no error message model1=ancova(y ~ trt1+trt1*trt2+covar1, data=mydata) there is error message *Error in ancova(DELTA_PANSS ~ drug + drug.SULT + BASE, data = mydata_drug) : ancova requires exactly one factor and exactly one numeric variable. * model2=ancova(y ~ trt1+trt2+trt1*trt2+covar1, data=mydata) *Error in .subset2(x, i, exact = exact) : recursive indexing failed at level 2 In addition: Warning message: In formula.plot[[3]][2:3] <- formula[[3]][2 + classes] : number of items to replace is not a multiple of replacement length * It will be really helpful if you could point out my mistake or point me to the right model and function I should use. Thank you, Qian [[alternative HTML version deleted]]
• 1.7k views
ADD COMMENT
0
Entering edit mode
Qian Liu ▴ 110
@qian-liu-4216
Last seen 10.2 years ago
Hi there, I tried to use the function ancova to analyze covariance in my model. my model is like the following; I want to include two treatments(trt1, trt2) , their interaction and one covariate (covar1) y ~ trt1+trt2+trt1*trt2+ covar1 R code: mydata$trt1=factor(mydata$trt1) # 2 levels contrasts(mydata$trt1)=contr.treatment(2) mydata$trt2=factor(mydata$trt2) # 2 levels contrasts(mydata$trt2)=contr.treatment(2) mydata$trt1.trt2=interaction(mydata$trt1,mydata$trt2) contrasts(mydata$trt1.trt2) <- contr.treatment(4) model=ancova(y ~ trt1*trt2+ covar1, data=mydata) # there is no error message model1=ancova(y ~ trt1+trt1*trt2+covar1, data=mydata) there is error message *Error in ancova(DELTA_PANSS ~ drug + drug.SULT + BASE, data = mydata_drug) : ancova requires exactly one factor and exactly one numeric variable. * model2=ancova(y ~ trt1+trt2+trt1*trt2+covar1, data=mydata) *Error in .subset2(x, i, exact = exact) : recursive indexing failed at level 2 In addition: Warning message: In formula.plot[[3]][2:3] <- formula[[3]][2 + classes] : number of items to replace is not a multiple of replacement length * It will be really helpful if you could point out my mistake or point me to the right model and function I should use. Thank you, Qian [[alternative HTML version deleted]]
ADD COMMENT
0
Entering edit mode
@herve-pages-1542
Last seen 2 days ago
Seattle, WA, United States
Hi Qian, Sorry but the HH package is a CRAN package, not a Bioconductor package. You might want to ask on the R-help mailing list or contact its maintainer directly. Don't forget to provide your sessionInfo(). Cheers, H. On 03/15/2011 09:21 AM, Qian Liu wrote: > Hi there, > > I tried to use the function ancova to analyze covariance in my model. > my model is like the following; I want to include two treatments(trt1, trt2) > , their interaction and one covariate (covar1) > y ~ trt1+trt2+trt1*trt2+ covar1 > > R code: > mydata$trt1=factor(mydata$trt1) # 2 levels > contrasts(mydata$trt1)=contr.treatment(2) > mydata$trt2=factor(mydata$trt2) # 2 levels > contrasts(mydata$trt2)=contr.treatment(2) > mydata$trt1.trt2=interaction(mydata$trt1,mydata$trt2) > contrasts(mydata$trt1.trt2)<- contr.treatment(4) > > model=ancova(y ~ trt1*trt2+ covar1, data=mydata) # there is no error > message > > model1=ancova(y ~ trt1+trt1*trt2+covar1, data=mydata) there is error message > > *Error in ancova(DELTA_PANSS ~ drug + drug.SULT + BASE, data = mydata_drug) > : > ancova requires exactly one factor and exactly one numeric variable. > * > model2=ancova(y ~ trt1+trt2+trt1*trt2+covar1, data=mydata) > > *Error in .subset2(x, i, exact = exact) : > recursive indexing failed at level 2 > In addition: Warning message: > In formula.plot[[3]][2:3]<- formula[[3]][2 + classes] : > number of items to replace is not a multiple of replacement length > * > It will be really helpful if you could point out my mistake or point me to > the right model and function I should use. > Thank you, > Qian > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M2-B876 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpages at fhcrc.org Phone: (206) 667-5791 Fax: (206) 667-1319
ADD COMMENT

Login before adding your answer.

Traffic: 901 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6