Dear Brenna,

It appears the problem is that you are attempting to use prcomp on your 
points(p) x dimensions(k) x n Procrustes coordinates without converting these 
data into a n x pk matrix, required by prcomp.  Unfortunately, prcomp will use 
the first p x k part of the array of coordinates, resulting in an illogical PCA 
(rather than provide an error).  If you were to first use two.d.array to 
convert your 3D array of coordinates into a 2D matrix, and subsequently perform 
the PCA via prcomp on this converted matrix, you will get the same results as 
plotTangentSpace.  In fact, plotTangentSpace starts by converting your data 
into a matrix with two.d.array and using prcomp to do the PCA.  Most of the 
other coding for this function is to generate the plot.  So getting different 
answers should not be possible.

Good luck!

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 Jan 19, 2016, at 2:09 PM, Brenna Hays 
<[email protected]<mailto:[email protected]>> wrote:

Hello,
I am trying to perform a PCA on a basic set of 30 configurations, 3 specimens 
each with 10 configurations of landmarks. I was wondering why I am getting 
different PCA results between plotTangentSpace() and prcomp(). When I perform 
plotTangentSpace(), it gives me a comprehensive list of 30 PCs and their 
importance (PC1 and PC2 make up 99% of the variance). But when I perform the 
prcomp() (which is the function most recommended in the literature), the 
summary says PC1 explains 100% of the variance, and because of this I cannot 
perform the screeplot() or plot().
Am I missing something? I have copied my coding below. Any help would be much 
appreciated.


lpALL.super <- gpagen(lpALL, Proj=TRUE, ProcD=TRUE, PrinAxes=TRUE, 
ShowPlot=TRUE, curves=NULL, surfaces=NULL)
lpALL.shape <- lpALL.super$coords
lpALL.size <- lpALL.super$Csize
names(lpALL.super)

plotTangentSpace(lpALL.shape, axis1=1, axis2=2, warpgrids=TRUE, mesh=NULL, 
label=TRUE, verbose=TRUE) <- PC1 and PC2 99%

max(lpALL.shape[ ,1, ]); min(lpALL.shape[ ,1, ]); max(lpALL.shape[ ,2, ]); 
min(lpALL.shape[ ,2, ])

plot(lpALL.shape[ ,1,1:10], lpALL.shape[ ,2,1:10], asp=1, pch=21, bg="red", 
xlab="x", ylab="y", cex=.8, xlim=c(-0.295,0.252), ylim=c(-0.234,0.224))
points(lpALL.shape[ ,1,11:20], lpALL.shape[ ,2,11:20], asp=1, pch=21, 
bg="blue", cex=.8)
points(lpALL.shape[ ,1,21:30], lpALL.shape[ ,2,21:30], asp=1, pch=21, 
bg="green", cex=.8)
legend('bottomright', legend=c("CochaC", "CochaD", "DorbrA"), fill=c("red", 
"blue", "green"), cex=1)

lpALLPC <- prcomp(lpALL.shape, center=TRUE, scale=TRUE)
names(lpALLPC)
lpALLPC$x
lpALLPC$sdev
lpALLPC$rotation
summary(lpALLPC, scale=TRUE) <- PC1 100%
require(vegan)
screeplot(lpALLPC, npcs=15, type="lines", bstick=TRUE)
plot(lpALLPC$x[ ,1:2], asp=1, pch=21, cex=2.5, bg="black") <- subscript [ 1:2] 
out of bounds

--
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].

Reply via email to