Procrustes ANOVA/regression, specifically for shapesize covariation (allometry)
Description
Function performs Procrustes ANOVA with permutation procedures to assess statistical hypotheses describing patterns of shape covariation with size for a set of Procrustesaligned coordinates. Other factors or covariates can also be included in the analysis. This function also provides results for plotting allometric curves.
Usage
1 2 3 
Arguments
f1 
A formula for the relationship of shape and size; e.g., Y ~ X. 
f2 
An optional righthand formula for the inclusion of groups; e.g., ~ groups. 
f3 
A optional righthand formula for the inclusion of additional variables; e.g., ~ a + b + c + ... 
logsz 
A logical argument to indicate if the variable for size should be logtransformed. 
iter 
Number of iterations for significance testing 
seed 
An optional argument for setting the seed for random permutations of the resampling procedure. If left NULL (the default), the exact same Pvalues 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 Pvalues will vary. One can also specify an integer for specific seed values, which might be of interest for advanced users. 
alpha 
The significance level for the homegeneity of slopes test 
RRPP 
A logical value indicating whether residual randomization should be used for significance testing 
print.progress 
A logical value to indicate whether a progress bar should be printed to the screen. This is helpful for longrunning analyses. 
data 
A data frame for the function environment, see 
... 
Arguments passed on to procD.fit (typically associated with the lm function) 
Details
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 twodimensional 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 crossproducts 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 geomorph.data.frame
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.
method = ("CAC, "RegScore, "PredLine"). Choose the desired plot method.
warpgrids: default = TRUE. Logical value to indicate whether warpgrids should be plotted. (Only workds with 3D array data)
label: can be logical to label points (1:n)  e.g., label = TRUE  or a vector indicating text to use as labels.
mesh: A mesh3d object to be warped to represent shape deformation of the minimum and maximum size if warpgrids=TRUE (see
warpRefMesh
).
Use ?plot.procD.allometry
to understand the arguments used. The following are brief
descriptions of the different plotting methods using plot
, with references.

If "method=CAC" (the default) the function calculates 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.

If "method=RegScore" the function calculates shape scores from the regression of shape on size, and plots these versus size (Drake and Klingenberg 2008). For a single group, these shape scores are mathematically identical to the CAC (Adams et al. 2013).

If "method=PredLine" the function calculates predicted values from a regression of shape on size, and plots the first principal component of the predicted values versus size as a stylized graphic of the allometric trend (Adams and Nistri 2010).
Value
An object of class "procD.allometry" is a list containing the following:
HOS.test 
ANOVA for a homogeneity of slopes test (if groups are provided). 
aov.table 
An analysis of variance table, based on inputs and the homogenetiy of slopes test. 
alpha 
The significance level criterion for the homogeneity of slopes test. 
perm.method 
A value indicating whether "RRPP" or randomization of "raw" vales was used. 
permutations 
The number of random permutations used in the resampling procedure. 
call 
The matched call. 
formula 
The resulting formula, which can be used in followup analyses. Irrespective of input, shape = Y in the formula, and the variable used for size is called "size". 
CAC 
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. 
RSC 
The residual shape component (associated with CAC approach) 
Reg.proj 
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). 
pred.val 
Principal component scores (first PC) of predicted values. 
ref 
the reference configuration (if input coordinates are in a 3D array). 
gps 
A vector of group names. 
size 
A vector of size scores. 
logsz 
A logical value to indicate if size values were log=transformed for analysis. 
A 
Procrustes (aligned) residuals. 
Ahat 
Predicted Procrustes residuals(if input coordinates are in a 3D array). 
p 
landmark number 
k 
landmark dimensions 
Author(s)
Michael Collyer
References
Adams, D.C., F.J. Rohlf, and D.E. Slice. 2013. A field comes of age: geometric morphometrics in the 21st century. Hystrix. 24:714.
Adams, D. C., and A. Nistri. 2010. Ontogenetic convergence and evolution of foot morphology in European cave salamanders (Family: Plethodontidae). BMC Evol. Biol. 10:110.
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:7176.
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:679698.
See Also
procD.lm
and advanced.procD.lm
within geomorph;
lm
for more on linear model fits
Examples
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  # Simple allometry
data(plethodon)
Y.gpa < gpagen(plethodon$land) #GPAalignment
gdf < geomorph.data.frame(Y.gpa, site = plethodon$site,
species = plethodon$species) # geomorph data frame
plethAllometry < procD.allometry(coords~Csize, f2 = NULL, f3=NULL,
logsz = TRUE, data=gdf, iter=499)
summary(plethAllometry)
plot(plethAllometry, method = "PredLine")
plot(plethAllometry, method = "RegScore")
## Obtaining sizeadjusted residuals (and allometryfree 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]) # sizeadjusted residuals
adj.shape < shape.resid + array(Y.gpa$consensus, dim(shape.resid)) # allometryfree shapes
plotTangentSpace(adj.shape) # PCA of allometryfree shape
# Group Allometries
plethAllometry < procD.allometry(coords~Csize, ~species*site,
logsz = TRUE, data=gdf, iter=499, RRPP=TRUE)
summary(plethAllometry)
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
