procD.allometry: Procrustes ANOVA/regression, specifically for shape-size...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/procD.allometry.r


Function performs Procrustes ANOVA with permutation procedures to assess statistical hypotheses describing patterns of shape covariation with size for a set of Procrustes-aligned coordinates. Other factors or covariates can also be included in the analysis. This function also provides results for plotting allometric curves.


procD.allometry(f1, f2 = NULL, f3 = NULL, logsz = TRUE, iter = 999,
  seed = NULL, alpha = 0.05, RRPP = TRUE, effect.type = c("F", "SS",
  "cohen"), print.progress = TRUE, data = NULL, ...)



A formula for the relationship of shape and size; e.g., Y ~ X.


An optional right-hand formula for the inclusion of groups; e.g., ~ groups.


A optional right-hand formula for the inclusion of additional variables; e.g., ~ a + b + c + ...


A logical argument to indicate if the variable for size should be log-transformed.


Number of iterations for significance testing


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.


The significance level for the homegeneity of slopes test


A logical value indicating whether residual randomization should be used for significance testing


One of "F", "SS", or "cohen", to choose from which random distribution to estimate effect size. (The default is "F").


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


A data frame for the function environment, see


Arguments passed on to (typically associated with the lm function, such as weights or offset). The function can also currently handle either type I, type II, or type III sums of squares and cross-products (SSCP) calculations. Choice of SSCP type can be made with the argument, SS.type; i.e., SS.type = "I" or SS.type = "III". Only advanced users should consider using these additional arguments, as such arguments are experimental in nature.


The function quantifies the relative amount of shape variation attributable to covariation with organism size (allometry) plus other factors in a linear model, plus estimates the probability of this variation ("significance") for a null model, via distributions generated from resampling permutations. Data input is specified by formulae (e.g., Y ~ X), where 'Y' specifies the response variables (shape data), and 'X' contains one or more independent variables (discrete or continuous). The response matrix 'Y' can be either in the form of a two-dimensional data matrix of dimension (n x [p x k]), or a 3D array (p x n x k). It is assumed that -if the data are based on landmark coordinates - the landmarks have previously been aligned using Generalized Procrustes Analysis (GPA) [e.g., with gpagen].

There are three formulae that need to be input (see Arguments). The first must contain variables for shape and size, e.g., Y ~ X, where Y (dependent variable) is shape and X (independent variable) is size. The other two formulae are optional to indicate (1) groups for separate allometric curves and (2) additional model variables to consider in the ANOVA. The groups input must be a single factor or multiple factors; e.g., ~ group, or ~ a*b. The resulting ANOVA uses sequential (Type I) sums of squares and cross-products with variables in this order: size, groups (if provided), size*groups (if warranted), other variables (if provided). If a factor for groups is provided, ANOVA for a "homogeneity of slopes" test will also be performed.

It is assumed that the order of the specimens in the shape matrix matches the order of values in the independent variables. Linear model fits (using the lm function) can also be input in place of formulae. Arguments for lm can also be passed on via this function. For further information about ANOVA in geomorph, resampling procedures used, and output, see procD.lm or advanced.procD.lm. If greater flexibility is required for variable order, advanced.procD.lm should be used.

It is recommended that is used to create and input a data frame. This will reduce problems caused by conflicts between the global and function environments. In the absence of a specified data frame, procD.allometry will attempt to coerce input data into a data frame, but success is not guaranteed.

The generic functions, print, summary, and plot all work with procD.allometry. The generic function, plot, produces plots of allometric curves, using one of three methods input (see below). If diagnostic plots on model residuals are desired, procD.lm should be used with the resulting model formula. This, along with the data frame resulting from analysis with procD.allometry can be used directly in procD.lm, which might be useful for extracting ANOVA components (as procD.allometry is far more basic than procD.lm, in terms of output).

Notes for geomorph 3.0 and making allometry plots

Former versions of geomorph had a "plotAllometry" function that performed ANOVA and produced plots of allometry curves. In geomorph 3.0, the plot function is used with procD.allometry objects to produce such plots. The following arguments can be used in plot to achieve desired results.

Use ?plot.procD.allometry to understand the arguments used. The following are brief descriptions of the different plotting methods using plot, with references.

Notes for geomorph 3.0.4 and subsequent versions

Compared to previous versions of geomorph, users might notice differences in effect sizes. Previous versions used z-scores calculated with expected values of statistics from null hypotheses (sensu Collyer et al. 2015); however Adams and Collyer (2016) showed that expected values for some statistics can vary with sample size and variable number, and recommended finding the expected value, empirically, as the mean from the set of random outcomes. Geomorph 3.0.4 and subsequent versions now center z-scores on their empirically estimated expected values and where appropriate, log-transform values to assure statistics are normally distributed. This can result in negative effect sizes, when statistics are smaller than expected compared to the avergae random outcome. For ANOVA-based functions, the option to choose among different statistics to measure effect size is now a function argument.


An object of class "procD.allometry" is a list containing the following:


ANOVA for a homogeneity of slopes test (if groups are provided).


An analysis of variance table, based on inputs and the homogenetiy of slopes test.


The significance level criterion for the homogeneity of slopes test.


A value indicating whether "RRPP" or randomization of "raw" vales was used.


The number of random permutations used in the resampling procedure.


The data frame for the model.


A matrix or vector of random SS found via the resampling procedure used.


A matrix or vector of random F values found via the resampling procedure used.


A matrix or vector of random Cohen's f-squared values found via the resampling procedure used.


The matched call.


The resulting formula, which can be used in follow-up analyses. Irrespective of input, shape = Y in the formula, and the variable used for size is called "size".


The common allometric component of the shape data, which is an estimate of the average allometric trend within groups (Mitteroecker et al. 2004). The function also calculates the residual shape component (RSC) for the data.


The residual shape component (associated with CAC approach)


The projected regression scores on the regression of shape on size. For a single group, these shape scores are mathematically identical to the CAC (Adams et al. 2013).


Principal component scores (first PC) of predicted values.


the reference configuration (if input coordinates are in a 3D array).


A vector of group names.


A vector of size scores.


A logical value to indicate if size values were log=transformed for analysis.


Procrustes (aligned) residuals.


Predicted Procrustes residuals(matching array or matrix, as input).

Predicted Procrustes residuals, specifically at minimum size.

Predicted Procrustes residuals, specifically at maximum size.


landmark number


landmark dimensions


Michael Collyer


Adams, D.C., F.J. Rohlf, and D.E. Slice. 2013. A field comes of age: geometric morphometrics in the 21st century. Hystrix. 24:7-14.

Adams, D. C., and A. Nistri. 2010. Ontogenetic convergence and evolution of foot morphology in European cave salamanders (Family: Plethodontidae). BMC Evol. Biol. 10:1-10.

Drake, A. G., and C. P. Klingenberg. 2008. The pace of morphological change: Historical transformation of skull shape in St Bernard dogs. Proc. R. Soc. B. 275:71-76.

Mitteroecker, P., P. Gunz, M. Bernhard, K. Schaefer, and F. L. Bookstein. 2004. Comparison of cranial ontogenetic trajectories among great apes and humans. J. Hum. Evol. 46:679-698.

Collyer, M.L., D.J. Sekora, and D.C. Adams. 2015. A method for analysis of phenotypic change for phenotypes described by high-dimensional data. Heredity. 115:357-365.

Adams, D.C. and M.L. Collyer. 2016. On the comparison of the strength of morphological integration across morphometric datasets. Evolution. 70:2623-2631.

See Also

procD.lm and advanced.procD.lm within geomorph; lm for more on linear model fits


# Simple allometry
Y.gpa <- gpagen(plethodon$land)    #GPA-alignment  
gdf <-, site = plethodon$site, 
species = plethodon$species) # geomorph data frame
plethAllometry <- procD.allometry(coords~Csize, f2 = NULL, f3=NULL, 
logsz = TRUE, data=gdf, iter=499)
plot(plethAllometry, method = "PredLine")
plot(plethAllometry, method = "RegScore")

## Obtaining size-adjusted residuals (and allometry-free shapes)
plethAnova <- procD.lm(plethAllometry$formula,
     data = plethAllometry$data, iter = 499, RRPP=TRUE) 
summary(plethAnova) # same ANOVA Table
shape.resid <- arrayspecs(plethAnova$residuals,
   p=dim(Y.gpa$coords)[1], k=dim(Y.gpa$coords)[2]) # size-adjusted residuals
adj.shape <- shape.resid + array(Y.gpa$consensus, dim(shape.resid)) # allometry-free shapes
plotTangentSpace(adj.shape) # PCA of allometry-free shape

# Group Allometries
plethAllometry <- procD.allometry(coords~Csize, ~species*site, 
logsz = TRUE, data=gdf, iter=499, RRPP=TRUE)
plot(plethAllometry, method = "PredLine")

# Using procD.lm to perform diagnostic residual plots
plethANOVA <- procD.lm(plethAllometry$formula, 
data = plethAllometry$data, iter = 499, RRPP=TRUE)
summary(plethANOVA) # Same ANOVA
plot(plethANOVA) # diagnostic plot instead of allometry plot

geomorph documentation built on June 8, 2017, 9:02 a.m.

Search within the geomorph package
Search all R packages, documentation and source code