# NOT RUN {
data(serengeti)
gen_indic <- generic_sews(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()
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab