r_squared evaluates R^2 for our simulated dynamics.
simulated_model Error of the stochastic model.
Error of the null model.
1 2 3 4 5
A vector with the actual observed species richness.
A vector with the simulated species richness.
Number of species in the species pool.
The importance of assesing how well a model predicts new data is paramount. The most used metric to assess this model error is R^2. R^2 is always refered to a null model and is defined as follows:
R^2 = 1 - ε^2 / ε^2_0
where ε^2 is the prediction error defined as the mean squared deviation of model predictions from actual observations, and ε^2_0 is a null model error, in example, an average of squared deviations evaluated with a null model.
Our null model corresponds with a random species model with no time correlations, in which we draw randomly from a uniform distribution a number of species between 0 and number of species observed in the species pool. The expectation of the sum of squared errors under the null model is evaluated analytically in Alonso et al. (2015).
r_squared gives the value of R^2 for the predictions of
null_model gives the average of squared
deviations of the null model predictions from actual observations,
simulated_model gives the average of
squared deviations of the model predictions from the actual observations,
The value of R^2 depends critically on the definition of the null model. Note that different definitions of the null model will lead to different values of R^2.
Alonso, D., Pinyol-Gallemi, A., Alcoverro T. and Arthur, R.. (2015) Fish community reassembly after a coral mass mortality: higher trophic groups are subject to increased rates of extinction. Ecology Letters, 18, 451–461.
1 2 3 4 5 6 7 8
idaho.sim <- data_generation(as.data.frame(c(rep(0, 163), rep(1, 57))), 1, c(0.162599, 0.111252), 250, 20) idaho.me <- c(57, apply(idaho.sim, 1, quantile, 0.5)) r_squared(colSums(idaho[][,3:23]), idaho.me, 220) null_model(colSums(idaho[][,3:23]), 220) simulated_model(colSums(idaho[][,3:23]), idaho.me)