Dear all, I'm trying to compare two sets of variables, the first set is composed exclusively of numerical variables and the second regroups factors and numerical variables. I can't use a Manova because of this inclusion of numerical variables in the second set. The solution should be to perform a Mancova, but I didn't find any package that allow this type of test. I've already looked in this forum and on the net to find answers, but the only thing I've found is the following: lm(as.matrix(Y) ~ x+z) x and z could be numerical and factors. The problem with that is it actually only perform a succession of lm (or glm), one for each numerical variable contained in the Y matrix. It is not a true MANCOVA that do a significance test (most often a Wald test) for the overall two sets comparison. Such a test is available in SPSS and SAS, but I really want to stay in R! Someone have any idea? Thanks in advance for your help! Rémi Lesmerises, biol. M.Sc., Candidat Ph.D. en Biologie Université du Québec à Rimouski remilesmerises@yahoo.ca [[alternative HTML version deleted]]
Dear Remi, Take a look at the Anova() function in the car package. In your case, you could use Anova(lm(as.matrix(Y) ~ x + z)) or, for more detail, summary(Anova(lm(as.matrix(Y) ~ x + z))) I hope this helps, John ------------------------------------------------ John Fox Sen. William McMaster Prof. of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ On Wed, 17 Apr 2013 07:47:27 -0700 (PDT) R?mi Lesmerises <remilesmerises at yahoo.ca> wrote:> Dear all, > > I'm trying to compare two sets of variables, the first set is composed exclusively of numerical variables and the second regroups factors and numerical variables. I can't use a Manova because of this inclusion of numerical variables in the second set. The solution should be to perform a Mancova, but I didn't find any package that allow this type of test. > > I've already looked in this forum and on the net to find answers, but the only thing I've found is the following: > > > lm(as.matrix(Y) ~ x+z) > x and z could be numerical and factors.?The problem with that is it actually only perform a succession of lm (or glm), one for each numerical variable contained in the Y matrix. It is not a true MANCOVA that do a significance test (most often a Wald test) for the overall two sets comparison. Such a test is available in SPSS and SAS, but I really want to stay in R! Someone have any idea? > > Thanks in advance for your help! > ? > R?mi Lesmerises, biol. M.Sc., > Candidat Ph.D. en Biologie > Universit? du Qu?bec ? Rimouski > remilesmerises at yahoo.ca > > [[alternative HTML version deleted]] >
On Apr 17, 2013, at 16:47 , R?mi Lesmerises wrote:> Dear all, > > I'm trying to compare two sets of variables, the first set is composed exclusively of numerical variables and the second regroups factors and numerical variables. I can't use a Manova because of this inclusion of numerical variables in the second set. The solution should be to perform a Mancova, but I didn't find any package that allow this type of test. > > I've already looked in this forum and on the net to find answers, but the only thing I've found is the following: > > > lm(as.matrix(Y) ~ x+z) > x and z could be numerical and factors. The problem with that is it actually only perform a succession of lm (or glm), one for each numerical variable contained in the Y matrix. It is not a true MANCOVA that do a significance test (most often a Wald test) for the overall two sets comparison. Such a test is available in SPSS and SAS, but I really want to stay in R! Someone have any idea?You can fit two models and compare them with (say) fit1 <- lm(as.matrix(Y) ~ x+z) fit2 <- lm(as.matrix(Y) ~ x) anova(fit1, fit2, test="Wilks") or, removing terms sequentially: anova(fit1, test="Wilks")> > Thanks in advance for your help! > > R?mi Lesmerises, biol. M.Sc., > Candidat Ph.D. en Biologie > Universit? du Qu?bec ? Rimouski > remilesmerises at yahoo.ca > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.-- Peter Dalgaard, Professor Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com