trajectory analysis?

339 views
Skip to first unread message

dan...@berkeley.edu

unread,
Aug 4, 2016, 10:20:50 PM8/4/16
to geomorph R package

Hi,

My data includes individuals from 3 geographical areas, say P1, O and P2. I am hoping to quantify the change in shapes in terms how the shapes of P1 and P2 populations may contribute to that of O population. In other words, I want to quantify vector P1O and vector P2O (if I am thinking it correctly). 

I thought of using trajectory.analysis. But when I specify my one factor model with 3 levels (i.e. Y~geogroup, where geogroup is a factor with 3 levels). I couldn't have the analysis to work. I know (from the help) that if there is only one factor, I should specify traj.pts. I am not entirely sure in this case what should I do. It looks like trajectory.analysis only using levels of the factor to do grouping but not comparing between 3 levels/groups and quantifying how shape changes between 3 levels/groups.

I don't know R or geomorph enough of make some sensible changes in specifying my arguments. Or, I shouldn't even use trajectory.analysis? What would be a better alternative method?

Thanks a ton!

Dana

Michael Collyer

unread,
Aug 5, 2016, 9:23:23 AM8/5/16
to dan...@berkeley.edu, geomorph R package
Dana,

While your data analysis seems like a trajectory analysis, it’s not in the strictest sense, as points in each of the trajectories are shared among groups.  There is no good way to handle this with the trajectory.analysis function.  But don’t despair, you actually have a very good option at your disposal.

The advanced.procD.lm function does a lot of things, but most importantly, it provides the tools to do almost anything.  I like to consider your analysis a second-order analysis.  A first-order analysis is one that asks, e.g., are means different?  A second-order analysis is one that asks, e.g.,  if pairs of differences in means are different?  In order to do a second-order analysis, one must be able to work with the means from random permutations.  advanced.procD.lm allows one to do that.

In advanced.procD.lm, there are two types of output available: random.LS.means and random.LS.means.dist.  The former are the random means generated, the latter the distances (differences) in vector lengths among them.  The latter would allow one to contrast differences in vector lengths, for example.  I’ll assume for the moment that this is your purpose.  Below is an example, using the geomorph plethodon data and only a few random permutations.  You could adapt this to your data and use more permutations, to construct a formal test.  (You might also play around with examples in the help file to become more familiar with the function.)

Hope this was helpful!

Mike

library(geomorph)
data(plethodon)
Y.gpa<-gpagen(plethodon$land) 
gdf <- geomorph.data.frame(Y.gpa, species = plethodon$species, site = plethodon$site)
apd <- advanced.procD.lm(coords~species*site, ~1, 
                         groups = ~species*site, data = gdf, iter = 9) # small number of permutations just for example

apd # standard results
apd$LS.means # just the means
apd$LS.means.dist # distance matrix among means

apd$random.means.dist # all random outcomes.  This is the important part!

# let's compare two vectors 1 = Jord:Allo to Teyah: allo; 2 = Jord:Allo to Jord:Symp
# use absolute value of difference in vector lengths)
abs(apd$LS.means.dist[3,1] - apd$LS.means.dist[2,1]) # observed case

# apply this to all random outcomes

myTest <- function(x) abs(x[3,1]-x[2,1])
myResult <- sapply(apd$random.means.dist, myTest)
myResult # first value is observed case, all other values are random results

# getting a P-value - use rank of observed value - 1 (to count the observed as one
# random case), divided by number of permutations)

1 - (rank(myResult)[1] - 1)/length(myResult)




--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To post to this group, send email to geomorph-...@googlegroups.com.
Visit this group at https://groups.google.com/group/geomorph-r-package.
To view this discussion on the web, visit https://groups.google.com/d/msgid/geomorph-r-package/8510f3f9-afcb-4d65-9543-40fbd2d7f1c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages