Pairwise Comparison of Shape data

32 views
Skip to first unread message

esfand...@gmail.com

unread,
Aug 19, 2025, 11:44:30 AMAug 19
to geomorph R package

Hello everyone,

I have conducted a Procrustes ANOVA to compare populations (each population 34-41 specimens) from six geographic sites using landmark data from moth wings, employing geometric morphometrics with the geomorph package in R. This analysis allows me to examine shape differences across sites while accounting for allometry. I successfully ran the following code in geomorph and performed pairwise comparisons for size. However, my attempts to implement pairwise comparisons for shape have been unsuccessful. Despite trying various codes, I have been unable to resolve the issue. Could you please assist me in running the correct code?

Here is the working code I used for the Procrustes ANOVA and size pairwise comparison:

 

> Y <- readland.tps("D:/FW_F.tps", specID = "imageID")

>classifier <- read.csv("D:/classifier_FW_F.csv", header=T, row.names=1)

>Y.gpa <- gpagen(Y)

>gdf <- geomorph.data.frame(shape = Y.gpa$coords, size = Y.gpa$Csize, site = >factor(classifier$site))

>fit_allo <- procD.lm(shape ~ size * site, data = gdf, iter = 9999, RRPP = TRUE)

>summary(fit_allo)

 

>size_pairwise <- pairwise.t.test(gdf$size, gdf$site, p.adjust.method = "bonferroni")

>print(size_pairwise)

 

Unfortunately, the following code for shape pairwise comparison does not work:

 

>shape_pairwise <- pairwise(fit_allo, groups = gdf$site)

>print(shape_pairwise)

 

I would greatly appreciate any guidance or suggestions to fix this problem. Thank you!

Best regards,

Mehdi

Adams, Dean [EEOB]

unread,
Aug 19, 2025, 1:14:29 PMAug 19
to geomorph R package
Medhi,

You are not using the 'pairwise' function in geomorph correctly. You need to run this using 'summary' not 'print', and specify various options.  

The help files for pairwise and for ProcD.lm provide description and examples.   Here is another example:

library(geomorph)

data(plethodon)
Y.gpa <- gpagen(plethodon$land)
gdf <- geomorph.data.frame(Y.gpa, 
                           site = plethodon$site, 
                           species = plethodon$species) 

fit <- procD.lm(coords ~ species * site, data = gdf)
anova(fit)

gp <-  interaction(gdf$species, gdf$site)
PW <- pairwise(fit, groups = gp)
summary(PW, test.type = "dist")

#TRYING 
print(PW) # basic information of the object only

Dean

--
Dr. Dean C. Adams
Distinguished Professor
Director, Ecology and Evolutionary Biology Graduate Program
Department of Ecology, Evolution, and Organismal Biology
Iowa State University

From: geomorph-...@googlegroups.com <geomorph-...@googlegroups.com> on behalf of esfand...@gmail.com <esfand...@gmail.com>
Sent: Tuesday, August 19, 2025 10:44 AM
To: geomorph R package <geomorph-...@googlegroups.com>
Subject: [geomorph-r-package] Pairwise Comparison of Shape data
 
--
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 view this discussion, visit https://groups.google.com/d/msgid/geomorph-r-package/e14f5edf-1755-426e-87c4-952c92ed5fc6n%40googlegroups.com.
Message has been deleted

esfand...@gmail.com

unread,
Aug 22, 2025, 7:35:38 AMAug 22
to geomorph R package

Dear Dean,

Thank you very much for your kind reply. I apologize if I wasn’t able to resolve the issue using the help file. I believe I can solve the problem as follows:

 

> fit_allo <- procD.lm(shape ~ size * site, data = gdf, iter = 9999, RRPP = TRUE)

> PW <- pairwise(fit_allo, groups = gdf$site)

> summary(PW, test.type = "dist")

 

and for the pairwise comparison of centroid sizes:

 

> fit_allo_size <- procD.lm(size ~ site, data = gdf, iter = 9999, RRPP = TRUE)

> summary(fit_allo_size)

 

> size_comparisons <- pairwise(fit_allo_size, groups = gdf$site)

> summary(size_comparisons, test.type = "dist")

 

All the best,

Mehdi

Reply all
Reply to author
Forward
0 new messages