Skip to contents

Simulate data

Simulate data according to the jsdm model structures

jsdm_sim_data() gllvm_sim_data() mglmm_sim_data()
Generate simulated data within a variety of jSDM methodologies
rgampois() rlkj() rinvgamma() rstudentt()
Helper functions for simulating data

Model

Run jsdmstan models

stan_jsdm()
Fit jsdm models in Stan
stan_gllvm()
Alias for stan_jsdm with method = "gllvm"
stan_mglmm()
Alias for stan_jsdm with method = "mglmm"
update(<jsdmStanFit>)
Update a jsdmStanFit model object with new data or Stan arguments

Set-up functions

Functions used to set up the prior structure (used in both data simulation and model fitting) and the Stan code used within model fitting

jsdm_stancode() print(<jsdmstan_model>)
Make stancode for the jsdm model
jsdm_prior() print(<jsdmprior>)
Create prior object for jsdmstan models and data simulation

Summaries

Extract useful quantities from the model objects. This includes overall summaries of model parameters and model diagnostics.

extract()
Extract samples from jsdmStanFit object
loo(<jsdmStanFit>)
Efficient approximate leave-one-out cross-validation using the loo package
get_parnames() nuts_params(<jsdmStanFit>) log_posterior(<jsdmStanFit>) rhat(<jsdmStanFit>) neff_ratio(<jsdmStanFit>)
Extract quantities useful for model summaries
print(<jsdmStanFit>)
Print the default summary for the model
summary(<jsdmStanFit>)
Summarise the model fit and data structure and give summaries for the parameters
print(<jsdmStanFamily>)
Print jsdmStanFamily object

Graphical summaries

Plots of various model parameters, including jSDM specific summary plots as well as more general model summaries

corrplot()
Plot modelled correlations between species
envplot()
Plotting environmental effects on species
ordiplot()
Plotting an ordination plot for a GLLVM model
mcmc_plot()
MCMC plots implemented in bayesplot
plot(<jsdmStanFit>)
Plot the traceplots and density plots for parameters within a jsdmStanFit object

Posterior prediction

Extract posterior distributions and predict from them, including graphical posterior checks

posterior_linpred(<jsdmStanFit>)
Access the posterior distribution of the linear predictor
posterior_predict(<jsdmStanFit>)
Draw from the posterior predictive distribution
posterior_zipred()
Access the posterior distribution of the linear predictor for zero-inflation parameter
pp_check(<jsdmStanFit>)
Posterior predictive checks for jsdmStanFit objects
multi_pp_check()
Multiple pp_check plots per species
jsdm_statsummary()
Extract site- or species-level summary statistics for predictions from a jsdmStanFit model

Other

Objects and classes used within jsdmstan

jsdmStanFit
jsdmStanFit class
jsdmStanFamily
jsdmStanFamily class
jsdmstan-package jsdmstan
The 'jsdmstan' package.
pinewood
Vegetation data from native pinewoods in Scotland, 1971
pinewood_env
Environmental data from native pinewoods in Scotland, 1971