STEPCAM: plotting results

Thijs Janzen

2016-09-21

Aim of this vignette

The aim of this vignette is to showcase the different plotting options that STEPCAM has to offer. We are not aiming to correctly infer underlying parameter values.

Data and STEPCAM

To be able to plot results, we need data, and some STEPCAM output. We use a bit higher number of particles, for plotting reasons. Always try to use as many particles as computationally possible! A higher number of particles increases the accuracy of the STEPCAM model, but also requires more computational time to complete.

  library(STEPCAM)
  set.seed(42)
  simul_data <- generate.Artificial.Data(n_species = 20, n_traits = 3, n_communities = 10,
                                       occurence_distribution = 2, average_richness = 0.6,
                                       sd_richness = 0.25, mechanism_random = FALSE)
  output <- STEPCAM_ABC(simul_data$abundances, simul_data$traits,
                        numParticles = 100, n_traits = 3, plot_number = 5,
                        stopRate = 0.1, stop_at_iteration = 8, continue_from_file = TRUE)
## 
## Generating Particles for iteration    1 
## 0--------25--------50--------75--------100
## *****************************************  4.82 4.35 4.83     accept rate =  1 
## 
## Generating Particles for iteration    2 
## 0--------25--------50--------75--------100
## *****************************************  4.85 4.5 4.65      accept rate =  1 
## 
## Generating Particles for iteration    3 
## 0--------25--------50--------75--------100
## *****************************************  4.42 3.77 5.81     accept rate =  1 
## 
## Generating Particles for iteration    4 
## 0--------25--------50--------75--------100
## *****************************************  3.44 6.07 4.49     accept rate =  1 
## 
## Generating Particles for iteration    5 
## 0--------25--------50--------75--------100
## *****************************************  3.49 6.17 4.34     accept rate =  0.9181818 
## 
## Generating Particles for iteration    6 
## 0--------25--------50--------75--------100
## *****************************************  3.71 7.1 3.19      accept rate =  0.6558442 
## 
## Generating Particles for iteration    7 
## 0--------25--------50--------75--------100
## *****************************************  4.95 6.17 2.88     accept rate =  0.354386 
## 
## Generating Particles for iteration    8 
## 0--------25--------50--------75--------100
## *  50.5 50.5 50.5     accept rate =  1

The Ternary plot shows us that at least LS does not have a high contribution, but since many dots are overlapping, not all information is shown:

TernPlot(output)

Alternatively, we can plot histograms of the parameter values for each parameter:

plotSTEPCAM(output)

This shows us that indeed the posterior distribution of Limiting Similarity is skewed towards zero (note that we did not use a lot of particles, nor push the algorithm towards extremely low acceptance rates for computational reasons). Furthermore, we see that although the mean of DA is around 0.3, the distribution has a strong peak towards zero, indicating a low contribution of DA as well. Furthermore, Habitat Filtering is peaked around 0.75, suggesting a sizeable contribution of Habitat Filtering.

Lastly we can plot the progress of the ABC-SMC algorithm:

plotSMC(paste(getwd(),"/",sep=""))

The top row indicates the first iteration, and with each row moving downward, we proceed one iteration, until we arrive at the final iteration at the bottom (notice how the distributions of DA, HF and LS match that of the previous figure). Furthermore we notice that over time the Fit of the model (e.g. the similarity with the data) decreases, as expected. Also, we notice that the summary statistics (Richness, Evennees, Diversity and Optimum) converge to a single value, most likely the value of the observed data.