Content Description

In geomorph, the analysis of disparity is accomplished using Procrustes variance, which is one means of estimating multivariate variation in a dataset. PV is obtained for each group and compared using permutation. Let´s see some examples:

library(geomorph)
## Loading required package: RRPP
## Loading required package: rgl
## Loading required package: Matrix

Pupfish shape disparity

Disparity around group means

First, although it is not needed, fitting a linear model is not a bad idea.

data("pupfish")
Group <- pupfish$Group <- interaction(pupfish$Pop, pupfish$Sex)
fit <- procD.lm(coords ~ Group, data = pupfish)

A simple way to perform a disparity analysis is with the pairwise function.

PW <- pairwise(fit, groups = Group)
summary(PW, test.type = "var")
## 
## Pairwise comparisons
## 
## Groups: Marsh.F Sinkhole.F Marsh.M Sinkhole.M 
## 
## RRPP: 1000 permutations
## 
## 
## Observed variances by group
## 
##      Marsh.F   Sinkhole.F      Marsh.M   Sinkhole.M 
## 0.0003439300 0.0005803226 0.0003607052 0.0008318581 
## 
## Pairwise distances between variances, plus statistics
##                                  d    UCL (95%)         Z Pr > d
## Marsh.F:Sinkhole.F    2.363925e-04 0.0002473769  1.518166  0.053
## Marsh.F:Marsh.M       1.677513e-05 0.0002492051 -1.346688  0.902
## Marsh.F:Sinkhole.M    4.879280e-04 0.0002412492  3.180101  0.001
## Sinkhole.F:Marsh.M    2.196174e-04 0.0002806646  1.160169  0.130
## Sinkhole.F:Sinkhole.M 2.515355e-04 0.0002726187  1.441515  0.075
## Marsh.M:Sinkhole.M    4.711529e-04 0.0002662683  2.741881  0.002

This approach is a little restricted in terms of options. Another way to perform the analysis is by using the geomorph::morphol.disparity function.

MD <- morphol.disparity(fit, print.progress = FALSE)
## 
##  *** Attempting to define groups from terms in the model fit. If results are peculiar, define groups precisely and check model formula.)
summary(MD)
## 
## Call:
## morphol.disparity(f1 = fit, print.progress = FALSE) 
## 
## 
## 
## Randomized Residual Permutation Procedure Used
## 1000 Permutations
## 
## Procrustes variances for defined groups
##      Marsh.F      Marsh.M   Sinkhole.F   Sinkhole.M 
## 0.0003439300 0.0003607052 0.0005803226 0.0008318581 
## 
## 
## Pairwise absolute differences between variances
##                 Marsh.F      Marsh.M   Sinkhole.F   Sinkhole.M
## Marsh.F    0.000000e+00 1.677513e-05 0.0002363925 0.0004879280
## Marsh.M    1.677513e-05 0.000000e+00 0.0002196174 0.0004711529
## Sinkhole.F 2.363925e-04 2.196174e-04 0.0000000000 0.0002515355
## Sinkhole.M 4.879280e-04 4.711529e-04 0.0002515355 0.0000000000
## 
## 
## P-Values
##            Marsh.F Marsh.M Sinkhole.F Sinkhole.M
## Marsh.F      1.000   0.902      0.053      0.001
## Marsh.M      0.902   1.000      0.130      0.002
## Sinkhole.F   0.053   0.130      1.000      0.075
## Sinkhole.M   0.001   0.002      0.075      1.000

Although presented differently, the results are the same. It is not necessary to have a linear model fit. The formula for the linear model can be used directly in morphol.disparity.

MD <- morphol.disparity(coords ~ Group, group = Group,
                        data = pupfish,
                        print.progress = FALSE)

However, there is not a plot.morphol.disparity function, so having a linear model fit with procD.lm first offers some advantages.

P <- plot(fit, type = "PC", pch = 21, bg = pupfish$Group)
shapeHulls(P, Group, group.cols = c(1,3,2,4))

Feel free to also explore the shape space.

picknplot.shape(P)

Foote’s (partial) Disparity

This requires using the morphol.disparity function rather than pairwise.

fit0 <- procD.lm(coords ~1, data = pupfish)
MD2 <- morphol.disparity(fit0, groups = Group,
                         partial = TRUE,
                         print.progress = FALSE)
summary(MD2)
## 
## Call:
## morphol.disparity(f1 = fit0, groups = Group, partial = TRUE,  
##     print.progress = FALSE) 
## 
## 
## 
## Randomized Residual Permutation Procedure Used
## 1000 Permutations
## 
## Procrustes variances for defined groups; partial variances (disparities) were calculated.
##      Marsh.F   Sinkhole.F      Marsh.M   Sinkhole.M 
## 0.0002824902 0.0002372006 0.0002761654 0.0002670281 
## 
## Proportion of total disparity for each group:
##    Marsh.F Sinkhole.F    Marsh.M Sinkhole.M 
##  0.2657770  0.2231669  0.2598264  0.2512297 
## 
## 
## Pairwise absolute differences between variances
##                 Marsh.F   Sinkhole.F      Marsh.M   Sinkhole.M
## Marsh.F    0.000000e+00 4.528958e-05 6.324846e-06 1.546211e-05
## Sinkhole.F 4.528958e-05 0.000000e+00 3.896474e-05 2.982747e-05
## Marsh.M    6.324846e-06 3.896474e-05 0.000000e+00 9.137263e-06
## Sinkhole.M 1.546211e-05 2.982747e-05 9.137263e-06 0.000000e+00
## 
## 
## P-Values
##            Marsh.F Sinkhole.F Marsh.M Sinkhole.M
## Marsh.F      1.000      0.745   0.943      0.883
## Sinkhole.F   0.745      1.000   0.420      0.532
## Marsh.M      0.943      0.420   1.000      0.846
## Sinkhole.M   0.883      0.532   0.846      1.000

The big difference is that each point is measured as a distance from the origin rather than the group mean. A plot with hulls would not make sense (unless each hull also contained the origin). The following plot is the best illustration of what is going on.

P <- plot(fit, type = "PC")
PC <- P$PC.points[, 1:2]
for(i in 1 : nrow(PC)) 
  arrows(0, 0, PC[i,1], PC[i,2], col = pupfish$Group[i], length = 0.1)