Extract quantities that can be used to diagnose sampling behavior of the algorithms applied by Stan at the back-end of mvgam.
Usage
# S3 method for mvgam
nuts_params(object, pars = NULL, ...)
# S3 method for mvgam
log_posterior(object, ...)
# S3 method for mvgam
rhat(x, pars = NULL, ...)
# S3 method for mvgam
neff_ratio(object, pars = NULL, ...)
Arguments
- object, x
A
mvgam
object.- pars
An optional character vector of parameter names. For
nuts_params
these will be NUTS sampler parameter names rather than model parameters. If pars is omitted all parameters are included.- ...
Arguments passed to individual methods.
Details
For more details see
bayesplot-extractors
.
Examples
# \donttest{
simdat <- sim_mvgam(n_series = 1, trend_model = 'AR1')
mod <- mvgam(y ~ s(season, bs = 'cc', k = 6),
trend_model = AR(),
noncentred = TRUE,
data = simdat$data_train,
chains = 2)
#> Error in get_mvgam_priors(formula = formula, trend_formula = trend_formula, data = data, family = family, use_lv = use_lv, n_lv = n_lv, use_stan = TRUE, trend_model = trend_model, trend_map = trend_map, drift = drift, knots = knots): object 'silent' not found
np <- nuts_params(mod)
#> Error in nuts_params(mod): object 'mod' not found
head(np)
#> Error in head(np): object 'np' not found
# extract the number of divergence transitions
sum(subset(np, Parameter == "divergent__")$Value)
#> Error in subset(np, Parameter == "divergent__"): object 'np' not found
head(neff_ratio(mod))
#> Error in neff_ratio(mod): object 'mod' not found
# }