Description Usage Arguments Details Value References See Also Examples
View source: R/task_generic_indic.R
Computation, significance assesment and display of spatial generic early warning signals (Moran's I, variance and skewness)
1 2 3 4 5 6 7 8 9 10 11 12 | generic_spews(mat, subsize = 4, abs_skewness = FALSE,
moranI_coarse_grain = FALSE)
## S3 method for class 'generic_spews'
indictest(x, nperm = 999, ...)
## S3 method for class 'generic_spews_test'
plot(x, along = NULL, what = "value",
display_null = TRUE, ...)
## S3 method for class 'generic_spews'
plot(x, along = NULL, ...)
|
mat |
A matrix (quantitative data), a binary matrix (TRUE/FALSE data), or a list of those |
subsize |
The subsize used for the coarse-graining phase (see Details) |
abs_skewness |
Should the absolute skewness be used instead of its raw values ? |
moranI_coarse_grain |
Should the input matrix be coarse-grained before computing the Moran's I indicator value ? |
x |
A |
nperm |
The number of replicates to use to compute a null distribution |
... |
Additional arguments passed onto methods |
along |
A vector providing values over which the indicator trend
will be plotted. If |
what |
The trendline to be displayed. Defaults to the indicator's values ("value") but other metrics can be displayed. Correct values are "value", "pval" or "z_score". |
display_null |
Chooses whether a grey ribbon should be added to reflect
the null distribution. Note that it can not be displayed when the trend
line reflects something else than the indicator values (when |
The Generic Early warning signal are based on the property of a dynamical system to "slow down" when approaching a critical point, that is take more time to return to equilibrium after a perturbation. This is expected to be reflected in several spatial characteristics: the variance, the spatial autocorrelation (at lag-1) and the skewness. This function provides a convenient workflow to compute these indicators, assess their significance and display the results.
Before computing the actual indicators, the matrix can be "coarse-grained".
This process reduces the matrix by averaging the nearby cells using
a square window defined by the subsize
parameter. This makes spatial
variance and skewness reflect actual spatial patterns when working with
binary (TRUE
/FALSE
data), but is optional when using
continous data. Keep in mind that it effectively reduces the size of
the matrix by approximately subsize
on each dimension.
The significance of generic early-warning signals can be estimated by
reshuffling the original matrix (function indictest
). Indicators
are then recomputed on the shuffled matrices and the values obtained are
used as a null distribution. P-values are obtained based on the rank of
the observered value in the null distribution. A small P-value means
that the indicator is significantly above the null values, as expected
before a critical point.
The plot
method can displays the results graphically. A text summary
can be obtained using the summary
method.
Note that the produced plot is adjusted depending on whether
along
is numeric or not.
generic_spews
returns an object of class generic_spews_single
(actually a list) if mat is a single matrix or an object of class
generic_spews_list
if mat is a list.
indictest
returns an object of class generic_test
(actually
a data.frame).
plot
methods return ggplot objects, usually immediately displayed
when used interactively.
Kefi, S., Guttal, V., Brock, W.A., Carpenter, S.R., Ellison, A.M., Livina, V.N., et al. (2014). Early Warning Signals of Ecological Transitions: Methods for Spatial Patterns. PLoS ONE, 9, e92097.
Dakos, V., van Nes, E. H., Donangelo, R., Fort, H., & Scheffer, M. (2010). Spatial correlation as leading indicator of catastrophic shifts. Theoretical Ecology, 3(3), 163-174.
Guttal, V., & Jayaprakash, C. (2008). Spatial variance and spatial skewness: leading indicators of regime shifts in spatial ecological systems. Theoretical Ecology, 2(1), 3-12.
indicator_moran
, indicator_variance
and
indicator_skewness
for individual indicators.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | data(serengeti)
gen_indic <- generic_spews(serengeti, subsize = 5,
moranI_coarse_grain = TRUE)
# Display results
summary(gen_indic)
# Display trends along the varying model parameter
plot(gen_indic, along = serengeti.rain)
# Compute significance (long)
## Not run:
gen_test <- indictest(gen_indic)
print(gen_test)
# Display the trend, now with a grey ribbon indicating the 5%-95% quantile
# range of the null distribution
plot(gen_test, along = serengeti.rain)
# Display the effect size compared to null distribution
plot(gen_test, along = serengeti.rain, what = "z_score")
# Note that plot() method returns a ggplot object that can be modified
# for convenience
if ( require(ggplot2) ) {
plot(gen_test, along = serengeti.rain) +
geom_vline(xintercept = 593, color = "red", linetype = "dashed") +
xlab('Annual rainfall') +
theme_minimal()
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.