mJo.eng | R Documentation |
This function is the engine behind the null model testing of species co-occurrence patterns, and analyses of the joint occupancy decline and the parametric forms of this decline, for multiple communities. In particular:
It performs the null model testing of species co-occurrence patterns and generates the
archetypes depicting how joint occupancy declines with the number of species (the order
of msco) based on species-by-site presence/absence .csv
data matrices. From these archetypes,
inferences can be made according to the implemented null models;
Determines the robustness of the exponential, power law and exponential-power law forms of
joint occupancy decline by computing the Pearson's r^2
between the joint occupancy values
of the observed data and predicted data, for all orders of species;
Gives a summary of the total number of communities (under each and for all archetypes) whose
forms of joint occupancy decline have r^2 > 0.95
;
Computes the AIC and Delta AIC of joint occupancy decline regression models for all communities;
Computes the total number of communities:
with exponential as the best form of joint occupancy decline than power law and vice versa;
with either of the three regression models (exponential, power law and exponential-power law) having the best form of the joint occupancy decline;
Estimates the parameters of:
exponential: j^{\{i\}} = a \times exp(b \times i)
;
power law: j^{\{i\}} = a \times i^b
; and
exponential-power law: j^{\{i\}} = a \times exp(b \times i) \times i^c
forms of joint occupancy decline, respectively, and their 95% confidence interval.
mJo.eng(
my.files,
algo = "sim2",
metric = "raw",
nReps = 999,
Archetypes = FALSE,
AICs = FALSE,
Delta_AIC = FALSE,
datf.Delta_AIC = FALSE,
param_hist = FALSE,
params = FALSE,
best.mod2 = FALSE,
best.mod3 = FALSE,
params_c.i = FALSE,
my.r2 = FALSE,
my.r2.s = FALSE
)
my.files |
A vector containing names of species-by-site presence/absence |
algo |
Simulation algorithm used. The possible options to choose from are: |
metric |
The type of rescaling applied to the joint occupancy metric. Available options are:
|
nReps |
Number of simulations used in the null model test. |
Archetypes |
A Boolean indicating if the archetypes of the patterns of species co-occurrences in multiple communities should be included in the output. |
AICs |
A Boolean indicating whether the akaike information criterion (AIC) and Delta AIC of joint occupancy decline regression models for all communities should be included in the output. |
Delta_AIC |
A Boolean indicating whether Delta AIC (excluding AIC) should be output. |
datf.Delta_AIC |
A Boolean indicating whether a |
param_hist |
A Boolean indicating whether histograms of the number of communities where the three parametric forms (exponential, power law and exponential-power law) of joint occupancy decline had the lowest AIC values, should be plotted. |
params |
A Boolean indicating whether parameter estimates of the joint occupancy decline regression models should be included in the output. |
best.mod2 |
A Boolean indicating if exponential and power law regression model comparisons should be included in the output. |
best.mod3 |
A Boolean indicating if exponential, power law and exponential-power law regression model comparisons should be included in the output. |
params_c.i |
A Boolean indicating if 95% C.I of the parameter estimates of the joint occupancy decline regression models should be included in the output. |
my.r2 |
A Boolean indicating if the robustness of joint occupancy decline regression models should be computed and output. |
my.r2.s |
A Boolean indicating if the robustness summary values of joint occupancy decline regression models should be computed and output. |
mJo.eng
function is useful when analyzing multiple species-by-site presence/absence
data matrices at once. If one community matrix is analyzed, the outputs of the function
Jo.eng should suffice.
mJo.eng
function returns a list containing the following outputs:
$Archs
For every community, a list
consisting of:
$nmod_stats
: A data frame with the summary statistics for the null model test; and
$Archetype
: Archetypes of the patterns of species co-occurrences in ecological
communities/matrices (my.files
). These archetypes must be \in \{
"A1",
"A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9"\}
or "NA". "NA" could be the
combinations of two or more of the nine expected archetypes.
$all.AICs
A list
of data.frame
s containig the following components:
df |
The number of parameters in each of the three (exponential, power law and exponential-power law) joint occupancy decline regression models. |
aic |
The aic values for each of the three joint occupancy decline regression models. |
delta_aic3 |
The |
delta_aic2 |
The |
$params
A data.frame
consisting of:
arch |
The archetypes of the patterns of species co-occurrences in each of the species-by-site
presence/absence |
a.ex |
The |
b.ex |
The |
a.pl |
The |
b.pl |
The |
a.expl |
The |
b.expl |
The |
c.expl |
The |
$best.mod2
Atable
containig the following components:
n |
The number of ecological communities represented by species-by-site
presence/absence |
n.lwst_aic |
The number of communities with exponential as the best form of joint occupancy decline than power law. |
n.delta_aic |
The number of communities whose exponential and power law forms of joint occupancy
decline have |
|
The percentage of |
$best.mod3
A table
containig the following components:
n |
The number of ecological communities represented by species-by-site
presence/absence |
n.lwst_aic |
The number of communities with exponential or power law or exponential-power law as the best form of joint occupancy decline among the three (exponential, power law and exponential-power law) regression models. |
n.delta_aic |
The number of communities whose exponential, power law and exponential-power
law forms of joint occupancy decline, respectively, have |
|
The percentage of |
$params_c.i
A data.frame
consisting of:
arch |
The archetypes of the patterns of species co-occurrences in each of the species-by-site
presence/absence |
n |
The number of communities under every archetype. |
|
The percentages of the number of communities (under every archetype) where exponential form of joint occupancy decline fitted better than power law. |
a.ex |
The 95% closed confidence interval of the |
b.ex |
The 95% closed confidence interval of the |
|
The percentages of the number of communities (under every archetype) where power law form of joint occupancy decline fitted better than exponential. |
a.pl |
The 95% closed confidence interval of the |
b.pl |
The 95% closed confidence interval of the |
|
The percentages of the number of communities (under every archetype) where exponential-power law form of joint occupancy decline fitted better than both the exponential and power law forms. |
a.expl |
The 95% closed confidence interval of the |
b.expl |
The 95% closed confidence interval of the |
c.expl |
The 95% closed confidence interval of the |
$r2
A list
of data.frame
s containig the following components:
rsq.ex |
|
rsq.pl |
|
rsq.ex.pl |
|
$r2.s
A list
containig the following components:
$rsq.per.Archs
Archs
: Archetypes of the patterns of species co-occurrences in each
of the species-by-site presence/absence .csv data matrices.
n.a
: Number of communities under each archetype.
rsq.ex
: Number of communities under each archetype whose exponential
forms of joint occupancy decline have r^2 > 0.95
.
rsq.pl
: Number of communities under each archetype whose power
law forms of joint occupancy decline have r^2 > 0.95
.
rsq.ex-pl
: Number of communities under each archetype whose
exponential-power law forms of joint occupancy decline have r^2 > 0.95
.
$rsq.all.Communities
n
: Number of all communities analyzed
ex
: Number of communities whose exponential forms of joint occupancy
decline have r^2 > 0.95
pl
: Number of communities whose power law forms of joint occupancy
decline have r^2 > 0.95
ex.pl
: Number of communities whose exponential-power law forms
of joint occupancy decline have r^2 > 0.95
$m.Jo.plots
Produces a .pdf
file with multiple figures each consisting of the following plots:
(a) |
as for Jo.plots |
(b) |
as for Jo.plots |
(c) |
as for Jo.plots |
(d) |
as for Jo.plots |
(e) |
as for Jo.plots |
Lagat, V. K., Latombe, G. and Hui, C. (2021a). A multi-species co-occurrence
index to avoid type II errors in null model testing. DOI: <To be added>
.
Gotelli, N. J. (2000). Null model analysis of species co-occurrence patterns. Ecology, 81(9), 2606-2621. https://doi.org/10.1890/0012-9658(2000)081[2606:NMAOSC]2.0.CO;2
Pearson, K. (1895) VII. Note on regression and inheritance in the case of two parents. proceedings of the royal society of London, 58:240-242. https://doi.org/10.1098/rspl.1895.0041
Petrossian, G.A., Maxfield, M (2018). An information theory approach to hypothesis testing in criminological research. crime science, 7(1), 2. https://doi.org/10.1186/s40163-018-0077-5
## Not run:
my.path <- system.file("extdata", package = "msco")
setwd(my.path)
my.files <- gtools::mixedsort(list.files(path = my.path, pattern = ".csv"))
my.res <- msco::mJo.eng(my.files = my.files, algo = "sim2", Archetypes = TRUE,
metric = "raw", nReps = 999, AICs = FALSE, params = FALSE,
best.mod2 = FALSE, best.mod3 = FALSE, params_c.i = FALSE,
my.r2 = FALSE, my.r2.s = FALSE)
my.res$Archs$`252.csv`
my.path2 <- system.file("extdata/myCSVs", package = "msco")
setwd(my.path2)
my.files2 <- gtools::mixedsort(list.files(path = my.path2, pattern = ".csv"))
my.res2 <- msco::mJo.eng(my.files = my.files2[250:255], algo = "sim2", Archetypes = FALSE,
metric = "raw", nReps = 999, AICs = FALSE, params = TRUE,
best.mod2 = FALSE, best.mod3 = FALSE, params_c.i = FALSE,
my.r2 = FALSE, my.r2.s = FALSE)
my.res2
my.path2 <- system.file("extdata/myCSVs", package = "msco")
setwd(my.path2)
my.files2 <- gtools::mixedsort(list.files(path = my.path2, pattern = ".csv"))
my.res3 <- msco::mJo.eng(my.files = my.files2[250:255], algo = "sim2", Archetypes = FALSE,
metric = "raw", nReps = 999, AICs = FALSE, params = FALSE,
best.mod2 = FALSE, best.mod3 = FALSE, params_c.i = TRUE,
my.r2 = FALSE, my.r2.s = FALSE)
my.res3
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.