mvgam now builds its models through ‘brms’. The observation model
takes the full ‘brms’ formula syntax. trend_formula
specifies the latent process. Most 1.1.x code needs rewriting. Start
with vignette("mvgam_overview") and
vignette("data"). The articles
work through each model class.
trend_formula, as in
trend_formula = ~ AR(p = 1). n_lv and
trend_map are arguments of the trend constructorstrend_model, use_lv,
prior_simulation, return_model_data,
save_all_pars, parallelnb() is negbinomial(),
student_t() is student(), betar()
is Beta()gaussian(). jsdgam()
defaults to binomial()get_mvgam_priors() (get_prior()),
plot_mvgam_*() (plot()),
compare_mvgams() (loo_compare()),
eval_mvgam() and roll_eval_mvgam()
(lfo_cv()), lv_correlations()
(residual_cor()), add_residuals()
(augment()), code() (stancode()),
ppc() (pp_check())gp() and mo() replace GP(),
dynamic(), s(bs = "moi"),
s(bs = "mod")incl_autocor (was
trend_state), process_error (was
resample_innovations), centred (was
noncentred)summary(),
coef(), fixef(). Trend parameters are indexed
by series name, as in sigma_trend[DM]irf(),
fevd(), stability(). Pass
summary = FALSE for drawste() and ti().
series_to_mvgam() no longer takes xts
inputsim_mvgam() is built around named scenarios.
series_to_mvgam() returns one data frame unless
h or train_prop is givenmvbind() and mvbf() responses share one
latent process. See the multivariate
and integrated
distribution model articlesocc() and
nmix(), each with a multi-season variant.
forecast(type = "latent_state") forecasts occupancy or
abundance. See the occupancy
and N-mixture
articlesjsdgam() takes traits, trait slopes, a phylogeny and
the composition families (diri(), multi(),
categ()). Summaries of the fit:
species_effects(), community(),
residual_cor(). See the JSDM
articleAR() and VAR(), hierarchical VARs, the local
linear trend LLT(), an extended CAR(). See the
VAR
and hierarchical
VAR articlesloadings_prior.
Tools to interpret the loadings: active_factors(),
shared_variation(), compare_loadings(),
ordinate(). See vignette("dfm")tweedie(), beta_nb(),
com_binomial() (mathematics by @jbogomolovas2), mvn(),
mvt()posterior_predict(), log_lik(),
update(), hypothesis(),
bridge_sampler()forecast_uncertainty() splits forecast variance by
source and horizon. compare_scores() and
compare_elpds() compare models. See the forecast
evaluation articlemvgam_formula(), mvgam_data(),
check_newdata()methods_md() writes a model description.
bibtex() extracts the citationcmdstan_model(compile = FALSE)pp_check() given a group draws the type’s
_grouped variant, one panel per group (#49)posterior_*() methods and fitted()
default to process_error = FALSE, matching
predict()incl_autocor = TRUE refuse times
outside the fitted times. Use forecast()samples and burnin (use iter
and warmup), lfo_cv(data = ) (use
newdata), incl_dynamics (use
incl_autocor), by = trend (use
by = lv_axis())ensemble() combines hindcast()
resultsupdate() works when a trend argument came from a
variablesummary.mvgam() to now return an object of
class mvgam_summary that can be re-used for later purposes,
or that can be printed with print.mvgam_summary()
(#119)ordinate.jsdgam() to plot
two-dimensional ordinations of site and species scores from latent
factor models estimated in jsdgam()residual_cor() now supports models fitted with
mvgam() in which latent factors were used or in which
correlated dynamic processes were usedsummary.mvgam_forecast() function to compute
and return prediction intervals of posterior hindcasts and forecasts in
a data.frame format. This will make it easier for users to
create their own custom plots of hindcast and forecast distributions
(#108)mvgam_use_cases help file to provide links to
online resources that discuss how to use ‘mvgam’ in practiceforecast() method is now imported from ‘generics’
to help avoid conflict issues with other forecasting packagesincl_dynamics argument in the
loo() and loo_compare() functions to ensure
better consistency in log-likelihood and resulting LOO estimates from
models with different observation familiestype in
conditional_effects() to expected to match
behaviour of ‘brms’mvgam_forecast if only a single
out-of-sample observation was included in newdata
(#111)offset(...) in
formulae are correctly incorporated when using gp()
termsprocess_error = TRUE in predict()CAR()) scales appropriately with time lags
(#107)mvgam_forecast so that the train_times and
test_times slots now contain lists of length
n_series. This allows for continuous time data to be better
handled, where some series may have been sampled at different
timepoints"sigma" and observation errors "sigma_obs") to
inverse gammas to provide more sensible prior regularisation away from
zerosummary() for better guidance on
how to investigate poor HMC sampler behavioursggplot objects in place of base R plots for broader
customisationtypes to the pp_check()
function to allow more targeted investigations of randomized quantile
residual distributionsplot.mvgam_residcor() function for nicer
plotting of estimated residual correlations from jsdgam
objectssummary() functions to calculate useful posterior
summaries from objects of class mvgam_irf and
mvgam_fevd (see ?irf and ?fevd
for examples)nmix() models with some slight
restructuring of the model objects (#102)forecast()
functionhow_to_cite.mvgam() function to generate a
scaffold methods description of fitted models, which can hopefully make
it easier for users to fully describe their programming environmentggplot
objects in place of base plots (thanks to @mhollanders #38)score = 'brier') as an option in
score.mvgam_forecast() for scoring forecasts of binary
variables when using family = bernoulli() (#80)augment() function to add residuals and fitted
values to an mvgam object’s observed data (thanks to @swpease #83)gp() effects with more
than one covariate and with different kernel functions (#79)jsdgam() to estimate Joint Species
Distribution Models in which both the latent factors and the observation
model components can include any of mvgam’s complex linear predictor
effects. Also added a function residual_cor() to compute
residual correlation, covariance and precision matrices from
jsdgam models. See ?mvgam::jsdgam and
?mvgam::residual_cor for detailsstability.mvgam() method to compute stability
metrics from models fit with Vector Autoregressive dynamics (#21 and
#76)?mvgam::AR for an exampleZMVN() error models for estimating Zero-Mean
Multivariate Normal errors; convenient for working with non time-series
data where latent residuals are expected to be correlated (such as when
fitting Joint Species Distribution Models); see
?mvgam::ZMVN for examplesfevd.mvgam() method to compute forecast error
variance decompositions from models fit with Vector Autoregressive
dynamics (#21 and #76)use_stan,
jags_path, data_train, data_test,
adapt_delta, max_treedepth,
drift. The removal streamlines documentation and reflects
the package’s mission to deprecate ‘JAGS’ as a suitable backend. Both
adapt_delta and max_treedepth should now be
supplied in a named list() to the new argument
controlmarginaleffects::comparisons
functions appropriately recognise internal rowid
variablesensemble provides appropriate
weighting of forecast draws (#98)trend_map recognises
levels of the series factorlfo_cv recognises the actual times in
time, just in case the user supplies data that doesn’t
start at t = 1. Also updated documentation to better
reflect thisupdate.mvgam captures any
knots or trend_knots arguments that were
passed to the original model calltrend_formula is supplied. This breaks the assumption that
the process has to be zero-centred, adding more modelling flexibility
but also potentially inducing nonidentifiabilities with respect to any
observation model intercepts. Thoughtful priors are a must for these
modelsstandata.mvgam_prefit, stancode.mvgam,
stancode.mvgam_prefitdraw() to be used for ‘mvgam’ models if ‘gratia’ is
already installedensemble.mvgam_forecast() method to generate
evenly weighted combinations of probabilistic forecast
distributionsirf.mvgam() method to compute Generalized and
Orthogonalized Impulse Response Functions (IRFs) from models fit with
Vector Autoregressive dynamicsdrift argument has been deprecated. It is now
recommended for users to include parametric fixed effects of “time” in
their respective GAM formulae to capture any expected drift effectssilent argument if the user’s version of
‘cmdstanr’ is adequateread_csv_as_stanfit now converts ‘cmdstanr’ models to
stanfit objects (#70)silent argument in
mvgam()gam object’s
convergence criteria, resulting in much faster model setupstrend_model = 'None' in
State-Space models, increasing flexibility by ensuring the process error
evolves as white noise (#51)nmix()conditional_effects.mvgam() from handling effects with
three-way interactionsmvgam to CRAN