Modularity, community formation, boundary clumping. Call it what you want, there is a fair amount of overlap in definition here. As such, we posit that modularity statistics may be able to detect boundary clumping better than Morisita's index. We offer a function here to calculate modularity. Specifically, this function calculates Barber's Q statistic, and compares it relative to null model randomizations.
Modularity(comm, method = "tswap", sims = 1000, scores = 1,
order = TRUE, c = length(comm), nstarts = 100, returnModules = FALSE)
community data in the form of a presence absence matrix
null model randomization method used by NullMaker
. See
details below (and the help file of fucntion NullMaker
) for more
information.
number of simulated null matrices to use in analysis
axis scores to ordinate matrix. 1: primary axis scores (default) 2: secondary axis scores
logical argument indicating whether to ordinate the interaction matrix or not. See details.
starting guess for the number of modules present. Defaults to the maximum number of modules possible.
number of starts. Default is 100. More will both slow the function down, and increase the likelihood of converging on the true modularity value.
logical argument indicating whether to return a vector of module IDs
A vector containing Barber's modularity statistic (Q), the z statistic comparing observed modularity against null matrices (z), p-value (pval), and mean (simulatedMean) and variance (simulatedVariance) from null model simulations
method
is an argument handed to functions in the vegan
package. Leibold & Mikkelson advocated the use of equiprobable rows and
columns (provided that rows and columns had at least one entry). This method
is called r00
. Methods maintaining row (site) frequencies include
r0
,r1
, and r2
. The default method argument is
r1
, which maintains the species richness of a site (row totals) and
fills species ranges (columns) based on their marginal probabilities.
Arguably the most conservative null algorithm is the fixed row - fixed
column total null, which can be attained using many of swap algorithms
described in the vegan package (sequential methods like tswap
,
swap
, and non-sequential quasiswap
and backtracking
).
See the help file for commsim
or Wright et al. 1998 for more
information.
If order
is FALSE, the interaction matrix is not ordinated, allowing
the user to order the matrix based on site characteristics or other
biologically relevant characteristics.
Barber, M. J. 2007. Modularity and community detection in bipartite networks. Physical Review E, 76(6), 066102.
Leibold, M.A. and G.M. Mikkelson. 2002. Coherence, species turnover, and boundary clumping: elements of meta-community structure. Oikos 97: 237 - 250.
Wright, D.H., Patterson, B.D., Mikkelson, G.M., Cutler, A. & Atmar, W. (1998). A comparative analysis of nested subset patterns of species composition. Oecologia 113, 1-20.
# NOT RUN {
#define an interaction matrix
data(TestMatrices)
intmat <- TestMatrices[[3]]
#determine Barber"s modularity
mod.intmat <- Modularity(intmat, method="r1", sims=5,
scores=1, order=TRUE, nstarts=10)
#return results
mod.intmat
# }
Run the code above in your browser using DataLab