Description Usage Arguments Details Value Author(s) References Examples

View source: R/morphol.disparity.r

Function estimates morphological disparity and performs pairwise comparisons among groups.

1 2 |

`f1` |
A formula describing the linear model used. The left-hand portion of the formula should be
a 3D array (p x k x n) containing GPA-aligned coordinates for a set of specimens, or a matrix (n x variables).
The right-hand portion of the formula should be " ~1" to use the overall mean, or "~ x1 + x2 + x3 +...", where each x is a
covariate or factor. (Interactions and nested terms also work.) Alternatively, one can use an object of class "procD.lm" or
"advanced.procD.lm", which already has a formula defined. This is especially helpful for analyses performed with |

`groups` |
A formula designating groups, e.g., groups = ~ groups. If NULL, morphol.disparity will attempt to define groups based on the linear model formula, f1. If there are no groups inherently indicated in f1 and groups is NULL, a single Procrustes variance will be returned for the entire data set. |

`iter` |
Number of iterations for permutation test |

`seed` |
An optional argument for setting the seed for random permutations of the resampling procedure. If left NULL (the default), the exact same P-values will be found for repeated runs of the analysis (with the same number of iterations). If seed = "random", a random seed will be used, and P-values will vary. One can also specify an integer for specific seed values, which might be of interest for advanced users. |

`data` |
A data frame for the function environment, see |

`print.progress` |
A logical value to indicate whether a progress bar should be printed to the screen. This is helpful for long-running analyses. |

`...` |
Arguments passed on to procD.fit (typically associated with the lm function) |

The function estimates morphological disparity and performs pairwise comparisons to identify differences
between groups. Morphological disparity is estimated as the Procrustes variance, overall or for groups,
using residuals of a linear model fit. Procrustes variance is the same sum of the diagonal elements
of the group covariance matrix divided by the number of observations in the group (e.g., Zelditch et al. 2012).
The function takes as input a formula to describe the linear model fit,
plus a formulaic indication of groups (e.g., ~ groups). It is assumed that the formula describes shape data that
have been GPA-aligned [e.g., `gpagen`

], although the function can work with any multivariate data.

Absolute differences in Procrustes variances are test statistics that can be used to test differences in morphological disparity among groups. These differences are statistically evaluated through permutation, where the vectors of residuals are randomized among groups. The function can be used to obtain disparity for the whole dataset by using "a dummy group factor "~ 1" as the right-hand portion of the formula, in which case only Procrustes variance is returned. Additionally, if the right-hand portion of the formula only contains (continuous) covariates, e.g., "~ Csize", Procrustes variance will be calculated for the whole data set or groups, after accounting for the linear regression described. Finally, different factors can be indicated in the formula and for groups, if one wishes to compare morphological disparities for groups comprising only a portion of or collapsing of the groups in a more complex model (see examples).

This function can be used with an object of class "procD.lm" or "advanced.procD.lm", if such analyses have already been performed. This is especially helpful for analyses performed with `gpagen`

,
This is specially useful for analyses performed with `procD.pgls`

. In this case, residuals obtained from PGLS estimation
of coefficients, rather than OLS estimation, will be used in the analysis. Thus, one can account for phylogeny when comparing
morphological disparity among groups. However, one should be aware that this approach only adjusts expected values because of phylogeny
and does not assert a null hypothesis of equal variances based on phylogenetic relatedness. (For example, specials means can be adjusted
because of phylogenetic relatedness, but the null hypothesis of equal variances is conditioned on the estimation of means.)

Objects of class "morphol.disparity" return a list with the following components (if groups are specified):

`Procrustes.var` |
Observed Procrustes variances. |

`PV.dist` |
Observed pairwise absolute differences (distances) among group Procrustes variances. |

`PV.dist.Pval` |
P-values associated with pairwise differences. |

`random.PV.dist` |
Pairwise distance matrices produced in the resampling procedure. |

`permutations` |
Number of random permutations in resampling procedure. |

`call` |
The match call |

Emma Sherratt and Michael Collyer

Zelditch, M. L., D. L. Swiderski, H. D. Sheets, and W. L. Fink. 2012. Geometric morphometrics for biologists: a primer. 2nd edition. Elsevier/Academic Press, Amsterdam.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ```
data(plethodon)
Y.gpa<-gpagen(plethodon$land) #GPA-alignment
gdf <- geomorph.data.frame(Y.gpa, species = plethodon$species, site = plethodon$site)
# Morphological disparity for entire data set
morphol.disparity(coords ~ 1, groups= NULL, data = gdf, iter=999)
# Morphological disparity for entire data set, accounting for allometry
morphol.disparity(coords ~ Csize, groups= NULL, data = gdf, iter=999)
# Morphological disparity without covariates, using overall mean
morphol.disparity(coords ~ 1, groups= ~ species*site, data = gdf, iter=999)
# Morphological disparity without covariates, using group means
morphol.disparity(coords ~ species*site, groups= ~species*site, data = gdf, iter=999)
# Morphological disparity of different groups than those described by the linear model
morphol.disparity(coords ~ Csize + species*site, groups= ~ species, data = gdf, iter=999)
# Extracting components
MD <- morphol.disparity(coords ~ Csize + species*site, groups= ~ species, data = gdf, iter=999)
MD$Procrustes.var # just the Procrustes variances
### Morphol.disparity can be used with procD.lm or advanced.procd.lm class objects
data(plethspecies)
Y.gpa<-gpagen(plethspecies$land) #GPA-alignment
gp.end<-factor(c(0,0,1,0,0,1,1,0,0)) #endangered species vs. rest
names(gp.end)<-plethspecies$phy$tip
gdf <- geomorph.data.frame(Y.gpa, phy = plethspecies$phy, gp.end = gp.end)
pleth.ols <- procD.lm(coords ~ Csize + gp.end,
data = gdf, iter = 999) # ordinary least squares
pleth.pgls <- procD.pgls(coords ~ Csize + gp.end, phy = phy,
data = gdf, iter = 999) # phylogenetic generalized least squares
summary(pleth.ols)
summary(pleth.pgls)
morphol.disparity(f1 = pleth.ols, groups = ~ gp.end, data = gdf, iter = 999)
morphol.disparity(f1 = pleth.pgls, groups = ~ gp.end, data = gdf, iter = 999)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.