# NOT RUN {
data(serengeti)
data(serengeti.rain)
spec_indic <- spectral_sews(serengeti,
sdr_low_range = c(0, .2),
sdr_high_range = c(.8, 1))
summary(spec_indic)
# Display trends along the varying model parameter
plot(spec_indic, along = serengeti.rain)
# Computing spectra many times is expensive, consider setting parallel
# computing using: options(mc.cores = n)
# Assess significance
spec_test <- indictest(spec_indic)
summary(spec_test)
# Display the SDR trend, now with a grey ribbon representing 5%-95%
# quantiles of the null distribution
plot(spec_test, along = serengeti.rain)
# Add a line highlighting the shift
if (require(ggplot2)) {
plot(spec_test, along = serengeti.rain) +
geom_vline(xintercept = 590, color = "red", linetype = "dashed")
}
# Display radial-spectra
plot_spectrum(spec_indic, along = serengeti.rain)
# Graphics can be modified using ggplot2 functions
if (require(ggplot2)) {
plot_spectrum(spec_indic, along = serengeti.rain) +
scale_y_log10()
}
# }
Run the code above in your browser using DataLab