Group shape means troubleshooting

116 views
Skip to first unread message

ani.hri...@gmail.com

unread,
Jan 29, 2024, 12:20:02 PM1/29/24
to geomorph R package
Hi all,

I'm trying to calculate species mean shapes and looking for some assistance troubleshooting. I've tried to calculate mean shapes using a couple different methods, and the incorrect specimens are being grouped together. Code & details below. Hopefully this is a silly mistake on my end that has a simple fix. 

(1) Code: 
ind.species.names = EcoBehInd$TreeName 
species.coords = coords.subset(A=mustelid.gpa$coords, group = ind.species.names)
names(species.coords) 
species.coords$`Aonyx_capensis` 

(2) Snippet of Ecological/Behavioral table is attached. 
(3) Screenshot of species.coords also attached. You can see here that, for example, Enhydra lutris and Galictis cuja were grouped together under "Aonyx capensis" instead of the two A. capensis specimens. 

I also tried calculating means using the aggregate() or two.d.array()/rowsum() functions, and they do calculate an output, but I don't trust that it's been done correctly. 

Any advice would be appreciated. Thank you! 

ani.hri...@gmail.com

unread,
Jan 29, 2024, 12:21:45 PM1/29/24
to geomorph R package
Naturally, I forgot the attachments. Here you go! 
(2)
EcoBehInd Table.png

(3) 
 species.coords group.png

Adams, Dean [EEOB]

unread,
Jan 29, 2024, 1:34:07 PM1/29/24
to geomorph-...@googlegroups.com

Without seeing more code and data this is challenging to trouble-shoot.

 

However, your stated goal was to obtain mean shapes for your groups. There are MAY ways to do this. Here is just one approach: 1) fit a linear model using grouping variables as factors, 2) perform pairwise comparisons. The output from ‘pairwise’ contains a matrix of group means. These can be used directly with rows as group mean. Or if required for downstream shape visualizations, they can be re-configured back into a 3D array using ‘arrayspecs’.

 

library(geomorph)

data(plethodon)

Y.gpa <- gpagen(plethodon$land)

 

groups <- factor(paste(plethodon$species, plethodon$site))

fit <- procD.lm(Y.gpa$coords ~ plethodon$species*plethodon$site)

PW <- pairwise(fit,groups = groups)

PW$LS.means

 

Dr. Dean C. Adams

Distinguished Professor of Evolutionary Biology

Department of Ecology, Evolution, and Organismal Biology

Iowa State University

https://faculty.sites.iastate.edu/dcadams/

phone: 515-294-3834

--
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 on the web, visit https://groups.google.com/d/msgid/geomorph-r-package/e35341a9-8b03-4d87-8d22-a4a4b65375dcn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages