Introduction

Whereas a Procrustes ANOVA will tell the user the extent to which a variable X can be predicted by one or more variables Y-n, pairwise comparisons allow the user to quantify the statistical difference among different groupings of variables. To do this, we can use the RRPP function pairwise. This function allows the user to perform pairwise comparisons of group means of a linear model fit generated from a Procrustes ANOVA.

Note that RRPP is a companion package which houses the underlying statistical permutational analytics for geomorph’s statistical procedures. It is installed and loaded simultaneously with geomorph.

pairwise()
  • \(fit\): A linear model fit. In our case, it is the object we created using procD.lm
  • \(groups\): A factor or vector that can be coerced into a factor that describes the groups for which we want to perform our pairwise comparisons with
  • \(print.progress\): A logical value (TRUE/FALSE) to indicate whether a progress bar should be printed on screen.



Example Analysis

For the purposes of this example, generating a model fit using the procD.lm function will be taken as-read. If you are not familiar with the procD.lm function please see the ANOVA/Regression tutorial before proceeding here.

In addition to generating the fit, we will be adding material to our original geomorph data frame. Using the base R function interaction, we can create a factor with levels representing each pairwise permutation of our independent variables. In this case of this example, these are the “species,” (Jord, Teyah) and “site,” (Allo, Symp) variables.

fit <- procD.lm(lmks ~ spec * site, 
                data = data, iter = 999, turbo = TRUE,
                RRPP = TRUE, print.progress = FALSE)

data$Group <- interaction(data$site, data$spec)



After this preparation, we are ready to run the pairwise analysis:

pairs <- pairwise(fit, groups = data$Group)



Like the procD.lm function, results of the pairwise function can be summarized like this:

summary(pairs)
## 
## Pairwise comparisons
## 
## Groups: Allo.Jord Symp.Jord Allo.Teyah Symp.Teyah 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                                d  UCL (95%)          Z Pr > d
## Allo.Jord:Symp.Jord   0.09566672 0.09226464  2.2305051  0.015
## Allo.Jord:Allo.Teyah  0.02432519 0.07774489 -3.1495859  1.000
## Allo.Jord:Symp.Teyah  0.10136696 0.11812556 -0.1921641  0.568
## Symp.Jord:Allo.Teyah  0.09193082 0.10897149 -0.3111746  0.628
## Symp.Jord:Symp.Teyah  0.10694324 0.07639056  3.9866153  0.001
## Allo.Teyah:Symp.Teyah 0.09949800 0.09314049  2.6760941  0.003



Finally, the function generates an object of class “pairwise,” which is a list containing the following:

pairwise Output
  • \(LS.means\): Least-squares (LS) means for groups, across permutations.
  • \(slopes\): Slopes for groups, across permutations.
  • \(means.dist\): Pairwise distances between means, across permutations.
  • \(means.vec.cor\): Pairwise vector correlations between means, across permutations.
  • \(means.lengths\): LS means vector lengths, by group, across permutations.
  • \(slopes.dist\): Pairwise distances between slopes (end-points), across permutations.
  • \(slopes.vec.cor\): Pairwise vector correlations between slope vectors, across permutations.
  • \(slopes.lengths\): Slope vector lengths, by group, across permutations.
  • \(slopes.diff.length\): Pairwise absolute differences between slope vector lengths, across permutations.
  • \(n\): Sample size.
  • \(p\): Number of variables
  • \(PermInfo\): List containing information for random permutations. This includes number of permutations (perms), the method used for permutation (perm.method), results of each permutation (perm.schedule), and the seed used for randomization (perm.seed).



Important Note! To see usage of this function incorporated with a full workflow, please see the Group Comparisons tutorial.



Advanced Options
  • \(fit.null\):
  • \(covariate\):