Learn R Programming

geomorph (version 2.1.2)

pairwise.slope.test: Pairwise Comparisons of Slopes

Description

Function performs pairwise comparisons among slopes for groups as specified by a linear model.

Usage

pairwise.slope.test(f1, covariate, iter = 999, int.first = FALSE,
  angle.type = c("r", "deg", "rad"), RRPP = FALSE)

Arguments

f1
A formula for the linear model from which groups are to be compared (e.g., y~x1*x2)
covariate
A data farme of covariate values (contunuous quantitative variable). Must be a data frame to preserve variable name. Otherwise "covariate" will be returned.
iter
Number of iterations for permutation test
int.first
A logical value to indicate if interactions of first main effects should precede subsequent main effects
angle.type
A value specifying whether differences between slopes should be represented by vector correlations (r), radians (rad) or degrees (deg)
RRPP
a logical value indicating whether residual randomization should be used for significance testing

Value

  • Function returns a list with the following components:
  • ANOVA.tableAn ANOVA table assessing the linear model
  • Slope.DistA matrix of pairwise differences between slope magnitudes
  • Prob.DistAssociated matrix of pairwise significance levels based on permutations
  • Slope.corA matrix of pairwise slope vector correlations (if vector correlation is chosen)
  • Prob.corAssociated matrix of pairwise significance levels based on permutations
  • Slope.angleA matrix of pairwise angular differences in slope (if "rad" or "deg" chosen)
  • Prob.angleAssociated matrix of pairwise significance levels based on permutations

Details

The function performs pairwise comparisons to identify differences in slopes between groups. The function is designed as a post-hoc test to MANCOVA, where the latter has identified significant shape variation explained by a covariate*group interaction term. As input the user provides a formula describing the linear model of how shape (y) varies as a function of a factor (a) or factorial interaction (a*b). A single covariate must also be added. The shape data (y) must be in the form of a two-dimensional data matrix of dimension (n x [p x k]), rather than a 3D array. It is assumed that the landmarks have previously been aligned using Generalized Procrustes Analysis (GPA) [e.g., with gpagen]. The function two.d.array can be used to obtain a two-dimensional data matrix from a 3D array of landmark coordinates. From the data, the slopes for each group are estimated, and pairwise differences in slopes determined. It is assumed that one has verified a significant group*covariate interaction [e.g., with procD.lm]. To evaluate significance of the pairwise differences, two possible resampling procedures are provided. First, if RRPP=FALSE, the rows of the matrix of shape variables are randomized relative to the design matrix. This is analogous to a 'full' randomization. Second, if RRPP=TRUE, a residual randomization permutation procedure is utilized (Collyer et al. 2014). Here, residual shape values from a reduced model are obtained, and are randomized with respect to the linear model under consideration. These are then added to predicted values from the remaining effects to obtain pseudo-values from which SS are calculated. NOTE: for single-factor designs, the two approaches are identical. However, when evaluating factorial models it has been shown that RRPP attains higher statistical power and thus has greater ability to identify patterns in data should they be present (see Anderson and terBraak 2003). Effect-sizes (Z-scores) are computed as standard deviates of the sampling distributions generated, which might be more intuitive for P-values than F-values (see Collyer et al. 2014). Slopes can differ in two ways: the amount of shape change per covariate unit change and the direction of shape change associated with covariate change. Tests statistics to compare these attributes between groups are the differences in length and direction between slope vectors, respectively. These statistics are calculated with the exact same random permutations used to calculate random SS for ANOVA. This test is essentially the same as procD.lm with post-hoc comparisons among slopes for appropriate models. However, differences in slopes are calculated simultaneously with the same random permutations peformed for ANOVA, making it less so a post-hoc test and more so a simultaneous test of pairwise contrasts (see Collyer et al. 2014).

References

Anderson MJ. and C.J.F. terBraak. 2003. Permutation tests for multi-factorial analysis of variance. Journal of Statistical Computation and Simulation 73: 85-113. Collyer, M.L., D.J. Sekora, and D.C. Adams. 2014. A method for analysis of phenotypic change for phenotypes described by high-dimensional data. Heredity. 113: doi:10.1038/hdy.2014.75.

Examples

Run this code
### MANCOVA example for Goodall's F test (multivariate shape vs. factors)
data(plethodon)
Y.gpa<-gpagen(plethodon$land)    #GPA-alignment
y<-two.d.array(Y.gpa$coords)

## Pairwise slope vector correlations
pairwise.slope.test(y~plethodon$site, covariate = data.frame(CS = Y.gpa$Csize),
        iter=49, angle.type="r")

## Pairwise angular difference between slopes
pairwise.slope.test(y~plethodon$site, covariate = data.frame(CS = Y.gpa$Csize),
          iter=49, angle.type="rad")

## Using RRPP
pairwise.slope.test(y~plethodon$site, covariate = data.frame(CS = Y.gpa$Csize),
          iter=49, angle.type="rad", RRPP=TRUE)

Run the code above in your browser using DataLab