Apology for the confusion. I had intended that one could use randomization tests for Procrustes residuals rather than obtaining PC scores, and various functions in R will allow this, even if the number of shape variables exceeds the number of subjects.
I just checked, and prcomp will naturally reduce the dimensions of the $x matrix if the number of variables exceeds the number of subjects to be the lesser of the number of variables or n-1, where n is the number of subjects. (Note: it might return n PCs instead of n-1, but the PC scores are effectively 0 in the last PC.) It will not, however, reduce the number of dimensions because of e.g., invariance in scale, orientation, or location of the landmark configurations, following GPA. If one were to convert Procrustes residuals to PC scores, and not remove excess PCs, the manova function in R will treat these as credible variables even though the number of variables exceeds the actual dimensionality of the data space. If one performs a procedure as follows: Y <- prcomp(my.Procrustes.residuals)$x summary(manova(Y ~ x1 + x2 + …)) The manova function has no mechanism for correcting for the extra Y dimensions. It will either blow up (best case scenario) or tack on extra df in the summary (even worse). (The determinant of crossprod(Y) should be close 0, which should arrest the function, but I’m not sure about the manova traps.) However, if one does this: PCA <- prcomp(my.Procrustes.residuals) Y <- PCA$x[, zapsmall(PCA$sdev) > 0] summary(manova(Y ~ x1 + x2 + …)) The number of columns in Y will be the lesser of n-1 or the number of Procrustes residuals times the dimensions used for the landmarks, minus the invariant dimensions (because of scaling, orientation, and centering, and maybe use of semilandmarks). This will not alleviate the issues Dr. Rohlf pointed out. In fact, the manova.summary function will return an error if the number of columns of Y exceeds the error degrees of freedom for the model used. Thus, if prcomp is being used simply because the number of variables exceeds the number of research subjects, problems will likely persist with the parametric approach. By “culling the dimensions” I was referring to removing the superfluous PCs, specifically when using prcomp to do PCA (as it won’t), not advocating any chicanery for manipulating MANOVA. Mike Michael Collyer Associate Professor Biostatistics Department of Biology Western Kentucky University 1906 College Heights Blvd. #11080 Bowling Green, KY 42101-1080 Phone: 270-745-8765; Fax: 270-745-6856 Email: [email protected]<mailto:[email protected]> On Apr 5, 2016, at 1:15 PM, F. James Rohlf <[email protected]<mailto:[email protected]>> wrote: Note: to give statistically reliable results it needs to do more than just “culls the dimensions of x to match the number of positive non-zero eigenvalues”. You need to have the number of degrees of freedom much larger than the number of dimensions of the space or else you are likely to find that the PC dimensions with the smallest eigenvalues apparently account for most of the differences among groups. Simply using randomization tests do not solve this problem. ____________________________________________ F. James Rohlf, Distinguished Professor, Emeritus. Ecology & Evolution Research Professor, Anthropology Stony Brook University From: Collyer, Michael [mailto:[email protected]] Sent: Tuesday, April 5, 2016 5:29 AM To: Brenna Hays <[email protected]<mailto:[email protected]>> Cc: MORPHMET <[email protected]<mailto:[email protected]>> Subject: Re: [MORPHMET] replacing df with principal components for MANOVA tests Brenna, The PCA you performed produces a list of objects, one of which is a matrix of PC scores. Change AIS.PC to AISPC$x, and it should work. In this case, $x is the matrix of scores. The help files for the functions you use tell you the objects that are returned. You can also use attributes() to see the list of objects returned. The $ indicate that you are going to the list and extracting the object that follows. Just as a cautionary note, you might make sure that the number of columns for x is not the same as the number of landmarks times the dimensions (2 or 3). I cannot remember if R automatically culls the dimensions of x to match the number of positive non-zero eigenvalues. If not, you might have to do that yourself. There are also non-parametric MANOVA options that do not rely on degrees of freedom, which would make theses steps unnecessary, if you are comfortable with using randomization tests. Good luck! Mike Michael Collyer Associate Professor Biostatistics Department of Biology Western Kentucky University 1906 College Heights Blvd. #11080 Bowling Green, KY 42101-1080 Phone: 270-745-8765; Fax: 270-745-6856 Email: [email protected]<mailto:[email protected]> On Apr 5, 2016, at 10:16 AM, Brenna Hays <[email protected]<mailto:[email protected]>> wrote: I have been reading up on MANOVA and come across the common complication requiring a large number of degrees of freedom. After performing Procrustes superimpositions on my landmark configurations, along with my small sample sizes, is not allowing me to perform MANOVA tests. I have read that one can fix this problem by replacing the coordinates with principal components. The coding from my information source is very vague, but I've been trying some different things. Below is my code - note the error message at the bottom. AISarray <- two.d.array(AIS.shape) ID <- c(1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3) Depth <- c(3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5) Region <- c(7, 8, 8, 8, 8, 8, 8, 8, 5, 5, 5) RR <- c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) CDR <- c(2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) AISdf <- cbind(AISarray, ID, Depth, Region, RR, CDR) specs <- as.factor(AISdf[,51]) depth <- as.factor(AISdf[,52]) region <- as.factor(AISdf[,53]) rr <- as.factor(AISdf[,54]) cdr <- as.factor(AISdf[,55]) AIS.PC <- prcomp(AISarray) summary(manova(lm(AIS.PC~specs*region))) #NOT WORKING Error in model.frame.default(formula = AIS.PC ~ specs * region, drop.unused.levels = TRUE) : invalid type (list) for variable 'AIS.PC' It seems MANOVA requires a data frame, but replacing the coordinates with principal components turns it into a list. I cannot find any other information on this matter. Any help would be much appreciated. Thanks, Brenna Hays Research Assistant, Master's Student Nova Southeastern University -- MORPHMET may be accessed via its webpage at http://www.morphometrics.org<http://www.morphometrics.org/> --- You received this message because you are subscribed to the Google Groups "MORPHMET" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. -- MORPHMET may be accessed via its webpage at http://www.morphometrics.org<http://www.morphometrics.org/> --- You received this message because you are subscribed to the Google Groups "MORPHMET" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. -- MORPHMET may be accessed via its webpage at http://www.morphometrics.org --- You received this message because you are subscribed to the Google Groups "MORPHMET" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
