Function quantifies the degree of modularity between two or more hypothesized modules of Procrustes-aligned landmark coordinates and compares this to patterns found by randomly assigning landmarks into subsets
modularity.test(A, partition.gp, iter = 999, CI = FALSE, seed = NULL,
print.progress = TRUE)
A 3D array (p x k x n) containing GPA-aligned coordinates for all specimens, or a matrix (n x variables)
A list of which landmarks (or variables) belong in which partition (e.g. A,A,A,B,B,B,C,C,C)
Number of iterations for significance testing
A logical argument indicating whether bootstrapping should be used for estimating confidence intervals
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.
A logical value to indicate whether a progress bar should be printed to the screen. This is helpful for long-running analyses.
An object of class "CR" is a list containing the following
Covariance ratio: The estimate of the observed modular signal.
The bootstrapped 95 percent confidence intervals of the CR, if CI = TRUE.
The bootstrapped CR values, if CI = TRUE
The empirically calculated P-value from the resampling procedure.
For more than two partitions, the pairwise CRs among partitions.
The CR calculated in each of the random permutations of the resampling procedure.
The number of random permutations used in the resampling procdure.
The match call.
The function quantifies the degree of modularity in two or more hypothesized modules of shape data as
defined by landmark coordinates, and compares this to what is expected under the null hypothesis of random assignment
of variables to partitions (i.e., neither modular nor integrated structure).
Input may be either a 2D matrix of phenotypic values, or a 3D array of aligned Procrustes coordinates. It
is assumed that the landmarks have previously been aligned using Generalized Procrustes Analysis (GPA); e.g.,
with gpagen
. The degree of modularity is quantified using the CR coefficient (Adams 2016). If more than
two modules are defined, the average pairwise CR coefficient is utilized. The CR coefficient for the observed modular
hypothesis is then compared to a distribution of values obtained by randomly assigning landmarks into subsets, with the
restriction that the number of landmarks in each subset is identical to that observed in each of the original partitions.
A significant modular signal is found when the observed CR coefficient is small relative to this distribution (see Adams 2016).
Such a result implies that there is significantly greater independence among modules than is expected under the null
hypothesis of random associations of variables (neither modular nor integrated structure). This
result is consistent with the identification of significant modular structure in the data. A histogram of coefficients obtained via
resampling is presented, with the observed value designated by an arrow in the plot. For landmark data, the CR coefficient
found from the average CR across a 90 degree rotation of the data is used as the test statistic (see Adams 2016). For all
data, the CR coefficient is returned, and (optionally) its 95
for landmark data, estimation of the CI can take some time to compute.
Landmark groups can be defined using define.modules
, or made by hand (see example below).
To use this method with other data (i.e., a set of length measurements), the input A should be a matrix
of n rows of specimens and variables arranged in columns.
In this case, the partition.gp input should have each variable assigned to a partition.
The generic functions, print
, summary
, and plot
all work with modularity.test
.
The generic function, plot
, produces a two-block.pls plot. This function calls plot.pls
, which has two additional
arguments (with defaults): label = NULL, warpgrids = TRUE. These arguments allow one to include a vector to label points and a logical statement to
include warpgrids, respectively. Warpgrids can only be included for 3D arrays of Procrustes residuals. The plot is a plot of PLS scores from
Block1 versus Block2 performed for the first set of PLS axes.
Adams, D.C. 2016.Evaluating modularity in morphometric data: Challenges with the RV coefficient and a new test measure. Methods in Ecology and Evolution 7:565-572.
two.b.pls
, integration.test
, phylo.modularity
, and
phylo.integration
data(pupfish)
Y.gpa<-gpagen(pupfish$coords) #GPA-alignment
#landmarks on the body and operculum
land.gps<-rep('a',56); land.gps[39:48]<-'b'
MT <- modularity.test(Y.gpa$coords,land.gps,CI=FALSE,iter=199)
summary(MT) # Test summary
plot(MT) # Histogram of CR sampling distribution
# Result implies modularity present
Run the code above in your browser using DataLab