--- title: "STEPCAM: plotting results" author: "Thijs Janzen" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Plotting results} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ## 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. ```{r} 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) ``` 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: ```{r} TernPlot(output) ``` Alternatively, we can plot histograms of the parameter values for each parameter: ```{r} 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: ```{r} 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.