Geomorph PCA problem

55 views
Skip to first unread message

Brendon Boudinot

unread,
Nov 10, 2015, 9:03:12 PM11/10/15
to Davis R Users' Group
Good evening! 

Does anyone have experience with the package geomorph? I have a geometric morphometric dataset I am using for species delimitation (for legionary vampire ants), but I cannot do PCA with my array. I can paste the error print out here if necessary. The problem is that for PCA, geomorph needs a 3D array, my data are indeed in a 3D array, but gpagen() returns an error that the data are not arranged in 3D. Any help or guidance is appreciated! (I've been excited about this dataset for a while!)

Thank you in advance,
Brendon

Chris hamm

unread,
Nov 10, 2015, 11:44:16 PM11/10/15
to davi...@googlegroups.com
I am versed in the ways of geomorph and PCA. 

Chris
--
Check out our R resources at http://www.noamross.net/davis-r-users-group.html
---
You received this message because you are subscribed to the Google Groups "Davis R Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to davis-rug+...@googlegroups.com.
Visit this group at http://groups.google.com/group/davis-rug.
For more options, visit https://groups.google.com/d/optout.

Eric Holmes

unread,
Nov 10, 2015, 11:44:53 PM11/10/15
to davi...@googlegroups.com
Hi Brendon,

I have been experimenting with the geomorph package recently doing a morphometric analysis on juvenile salmon.  Please find the code below that loads landmarks (15 per fish) stored in TPS files into a 3D array, performs the generalized procrustes analysis with the gpagen() function and plots the results with the plotTangentSpace() function.  Note the dimensions of the array (15, 2, 27).  In my case I had 15 landmarks, 2 dimensions (x and y), and 27 fish.

Although the output has been useful, I have been computing the distances between landmarks after the procrustes analysis manually and running a separate PCA with the prcomp() function which has given me more control over the output.  Now I am working on a biological interpretation of the principal components.  I am fairly new to PCA analysis, so if you have any advice on ways to interpret principal components in a way that would be biologically meaningful, I would love to hear it.

library(geomorph)

files
<- list.files("C:/path/to/your/tps/files", pattern = ".TPS") for(i in 1:length(files)){ print(files[i]) temp <- readland.tps(paste("C:/path/to/your/tps/files/", files[i], sep = "")) assign(paste("land",i, sep = ""),value = temp) }

##Combine landmark matrices into one array
landslist <- array(c(land1,land2,land3,land4,land5,land6,land7,land8,land9, land10,land11,land12,land13,land14,land15,land16,land17,land18,land19, land20,land21,land22,land23,land24,land25,land26,land27), dim = c(15,2,27)) dimnames(landslist)[[3]] <- files ##Procrustes analysis gpag <- gpagen(landslist)


##geomorph PCA plot
pca.lands <- plotTangentSpace(gpag$coords, label = T, verbose = T)

Hope this helps!

Eric

--
Check out our R resources at http://www.noamross.net/davis-r-users-group.html
---
You received this message because you are subscribed to the Google Groups "Davis R Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to davis-rug+...@googlegroups.com.
Visit this group at http://groups.google.com/group/davis-rug.
For more options, visit https://groups.google.com/d/optout.



--
Eric Holmes
Research Ecologist
Center for Watershed Sciences
University of California, Davis
Reply all
Reply to author
Forward
0 new messages