Shape prediction for factors using shape.predictor

161 views
Skip to first unread message

lv xiao

unread,
Jan 11, 2018, 12:18:57 AM1/11/18
to geomorph R package
Dear all,

In geomorph user manual, shape predictions can be performed for factors using the following snippet of code:
gdf <- geomorph.data.frame(Y.gpa, species = plethodon$species, site = plethodon$site)
pleth
<- procD.lm(coords ~ species*site, data=gdf, print.progress = FALSE)
PCA
<- prcomp(pleth$fitted) # PCA using prcomp
plot
(PCA$x, asp=1, pch=19) # plots position of group means
means
<- unique(round(PCA$x,3))
means
        PC1    PC2    PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10 PC11 PC12 PC13 PC14 PC15 PC16 PC17 PC18 PC19 PC20 PC21 PC22 PC23 PC24
[1,]  0.012  0.063  0.000   0   0   0   0   0   0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
[2,]  0.062 -0.031  0.000   0   0   0   0   0   0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
[3,] -0.038 -0.018 -0.012   0   0   0   0   0   0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
[4,] -0.036 -0.014  0.012   0   0   0   0   0   0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0

preds
<- shape.predictor(arrayspecs(pleth$fitted, 12,2), x= PCA$x[,1:3],
Intercept = FALSE,
pred1
= means[1,1:3],
pred2
= means[2,1:3],
pred3
= means[3,1:3],
pred4
= means[4,1:3])
plotRefToTarget
(M, preds$pred1, outline = plethodon$outline)

My question is what does preds$pred1 represent, the predicted mean shape for the first species*site group? If that is the case, why don't we directly submit the mean shape for that group to plotRefToTarget function but bother using the predicted mean shape from the first three components? 

Thanks
Patrick

lv xiao

unread,
Jan 11, 2018, 12:37:44 AM1/11/18
to geomorph R package
It seems that the code in previous post is prediction of shape along PCs in stead of expected mean shape.

The user manual used the following code to plot group mean shape relative to grand mean:
X <- X[,-1]

symJord
<- c(0,1,0) # design for P. Jordani in sympatry
alloJord
<- c(0,0,0) # design for P. Jordani in allopatry
preds
<- shape.predictor(arrayspecs(pleth$fitted, 12,2), x = X, Intercept = TRUE,
symJord
=symJord, alloJord=alloJord)
plotRefToTarget
(M, preds$symJord, outline = plethodon$outline)


My question is revised as following:
1. For the code in my previous post, is the resultant shape the predicted mean shape for group 1 at  mean values of PC1, PC2, and PC3?
2. For the code in this post, what is the difference between preds$symJord and mean shape of symJord obtained through mshape function?

Thanks.

Mike Collyer

unread,
Jan 11, 2018, 2:57:20 PM1/11/18
to geomorph-...@googlegroups.com
Patrick,

shape.predictor is like a mapping function to map how shape changes along some predictor vectors.  In your previous post you referenced plotTangentSpace.  A component of that function is to map shape change along PC axes.  Yes, one can get PCs and use shape.predctor to get the same deformation grids for maximum values along the first PC, for example, as one would get in plotTangentSpace.  What you proposed with just submitting the means to plotTangentSpace is different, as it would find different PCs, thus different predictors.

1. The previous code did indeed show how to project means onto different PCs.
2. They might not be different, unless there were other factors taken into account.  The preds$symJord is the predicted vector, given the model, which is the same as the mean but does not have to be if there is a different model.

It seems to me that you are struggling with multiple ways to do the same thing and questioning why one would do something they could do one way a different way?  Does a linear model not estimate means if all it contains are factors for constructing the means?  So, in this case there is no difference but to emphasize what the difference is, for example, add centroid size to the model and now shape.predictor is not estimating means but some kind of allometric projection.

Cheers
Mike

-- 
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/b9ac1e87-0373-4d4e-852f-39a43a9bd41b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

lv xiao

unread,
Jan 11, 2018, 8:51:07 PM1/11/18
to geomorph R package
Hi Mike, thank you for the explanations. I now understand my second question. Regarding my first question, you mentioned that means were projected onto different PCs. But which PC it is for preds$pred1? Is it PC1, PC2, PC3, or at the mean of PC1, PC2, and PC3?
Mike

To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-package+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages