Dear all, I'm testing the effect of species and sex in my sample by using the principal component scores of a PCA analysis. I have 30 PCs and I tried to see if there is any significant difference from males to females, given that there is a significant effect of phylogeny (factor with several species). I didi it like this: Y<-PCA$pc.scores[,1:30] fit <- manova(Y ~ sp*sex) summary(fit, test="Wilks") I get a barely significant p-value for the effect of sex and I'd like to know for which of the species there is a difference between males and females. I tried TukeyHSD(fit) but I get the following error: Error in model.tables.aov(x, "means") : 'model.tables' is not implemented for multiple responses So this has to do with the fact that I have a multivariate independent variable. Is there an alternative function to this? Thanks in advance, S?rgio. -- Institut des Sciences de l'Evolution UMR5554, CNRS, IRD, EPHE Universit? de Montpellier Place Eug?ne Bataillon 34095 Montpellier Cedex 05 France Email: sergio.ferreira-cardoso at umontpellier.fr Tel: +33 (4 ) 67 14 46 52 [[alternative HTML version deleted]]
Hi Sergio Doing those tests 30 times is going to give you a huge Type I error rate, even if there was a function that did that. There is a reason why TukeyHSD doesn't make it easy. In general, if there are useful comparisons among the species, you are better off setting up and testing contrasts than doing all-pairwise Tukey tests. Also, the PCA scores are ordered in terms of variance acct'd for, so maybe only the first few are important. Finally, you might be better off using Canonical Discriminant analysis than PCA followed by MANOVA. The candisc package is well suited to this task. It can give you HE plots in the space that best discriminates among the levels of an effect, and show how the original variables relate to (project into) that space. CDA is sort of like PCA, but the goal is to account for maximum differences among groups rather than maximum total variance. For proper partial Type III tests, use car::Manova rather than stats::manova which only gives sequential, Type I tests HTH -Michael On 5/25/2018 9:11 AM, Sergio Ferreira Cardoso wrote:> Dear all, > > I'm testing the effect of species and sex in my sample by using the principal component scores of a PCA analysis. > I have 30 PCs and I tried to see if there is any significant difference from males to females, given that there is a significant effect of phylogeny (factor with several species). > I didi it like this: > > Y<-PCA$pc.scores[,1:30] > fit <- manova(Y ~ sp*sex) > summary(fit, test="Wilks") > > I get a barely significant p-value for the effect of sex and I'd like to know for which of the species there is a difference between males and females. > I tried TukeyHSD(fit) but I get the following error: > > Error in model.tables.aov(x, "means") : > 'model.tables' is not implemented for multiple responses > > So this has to do with the fact that I have a multivariate independent variable. Is there an alternative function to this? > > Thanks in advance, > S?rgio. >-- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. & Chair, ASA Statistical Graphics Section York University Voice: 416 736-2100 x66249 Fax: 416 736-5814 4700 Keele Street Web: http://www.datavis.ca Toronto, ONT M3J 1P3 CANADA
Michael, Thank you very much for your answer. I finally tried lsmeans to compare what I wanted. I'll follow your advice and explore the CDA. It's probably a better solution to assess what I want. Best, S?rgio. ----- Mensagem original -----> De: "Michael Friendly" <friendly at yorku.ca> > Para: "Sergio Ferreira Cardoso" <sergio.ferreira-cardoso at umontpellier.fr>, "R-help list" <r-help at r-project.org> > Enviadas: S?bado, 26 De Maio de 2018 17:28:20 > Assunto: Re: TukeyHSD for multiple response> Hi Sergio > > Doing those tests 30 times is going to give you a huge Type I error > rate, even if there was a function that did that. There is a reason > why TukeyHSD doesn't make it easy. > > In general, if there are useful comparisons among the species, you are > better off setting up and testing contrasts than doing all-pairwise > Tukey tests. > > Also, the PCA scores are ordered in terms of variance acct'd for, so > maybe only the first few are important. > > Finally, you might be better off using Canonical Discriminant analysis > than PCA followed by MANOVA. The candisc package is well suited to this > task. It can give you HE plots in the space that best discriminates > among the levels of an effect, and show how the original variables > relate to (project into) that space. > CDA is sort of like PCA, but the goal is to account for maximum > differences among groups rather than maximum total variance. > > For proper partial Type III tests, use car::Manova rather than stats::manova > which only gives sequential, Type I tests > > HTH > -Michael > > On 5/25/2018 9:11 AM, Sergio Ferreira Cardoso wrote: >> Dear all, >> >> I'm testing the effect of species and sex in my sample by using the principal >> component scores of a PCA analysis. >> I have 30 PCs and I tried to see if there is any significant difference from >> males to females, given that there is a significant effect of phylogeny (factor >> with several species). >> I didi it like this: >> >> Y<-PCA$pc.scores[,1:30] >> fit <- manova(Y ~ sp*sex) >> summary(fit, test="Wilks") >> >> I get a barely significant p-value for the effect of sex and I'd like to know >> for which of the species there is a difference between males and females. >> I tried TukeyHSD(fit) but I get the following error: >> >> Error in model.tables.aov(x, "means") : >> 'model.tables' is not implemented for multiple responses >> >> So this has to do with the fact that I have a multivariate independent variable. >> Is there an alternative function to this? >> >> Thanks in advance, >> S?rgio. >> > > > -- > Michael Friendly Email: friendly AT yorku DOT ca > Professor, Psychology Dept. & Chair, ASA Statistical Graphics Section > York University Voice: 416 736-2100 x66249 Fax: 416 736-5814 > 4700 Keele Street Web: http://www.datavis.ca > Toronto, ONT M3J 1P3 CANADA