
Posterior credible intervals on a fitted mvgam model
Source:R/brms_wrappers.mvgam.R
posterior_interval.mvgam.RdCentral quantile intervals of the posterior draws of parameters. The
parameters are chosen as in as.matrix.mvgam().
Usage
# S3 method for class 'mvgam'
posterior_interval(object, pars = NULL, variable = NULL, prob = 0.95, ...)Arguments
- object
A fitted
mvgamobject.- pars
Deprecated alias for
variable.- variable
Either a keyword shortcut, a character vector of parameter names, or (when
regex = TRUE) a vector of regular expressions. Recognised keywords:"betas": population-level coefficients, the setbrms::fixef()reports (b_*,bs_*,bsp_*andbcs_*)."obs_params": observation-family distributional parameters (sigma,phi,shape, ...)."smooth_params": smooth-term standard deviations (sds_*)."trend_betas": the trend formula's population-level coefficients (b_*_trend,bs_*_trendandbsp_*_trend)."trend_params": trend-dynamics parameters (autoregressive coefficients, innovation SDs, ...)."trend_smooth_params": trend-side smooth SDs.
NULL(the default) returns every parameter. A bare vector name, such as"sigma_trend", selects every element. Group-level effects, factor loadings and latent states have no keyword. Select them by name.variables.mvgam()lists the names a fit holds.- prob
Numeric in
(0, 1). The probability mass each interval holds. Defaults to0.95.- ...
Further arguments of
as.matrix.mvgam(), such asregex.
See also
predictive_interval.mvgam() gives intervals of predictive
draws. summary.mvgam() reports intervals with convergence
diagnostics.
Other posterior summaries:
VarCorr.mvgam(),
bibtex(),
how_to_cite.mvgam(),
hypothesis.mvgam(),
index-mvgam,
mcmc_plot.mvgam(),
methods_md(),
mvgam_draws,
pairs.mvgam(),
ranef.mvgam(),
smooths.mvgam(),
summary.mvgam()
Examples
# \dontrun{
set.seed(13)
simdat <- sim_mvgam(family = poisson(), n_series = 1L,
n_timepoints = 120L, trend_model = AR())
mod <- mvgam(y ~ s(x, k = 5), trend_formula = ~ AR(p = 1),
data = simdat$data_train, family = poisson(),
chains = 2, silent = 2)
#> Warning: 8 of 2000 (0.0%) transitions ended with a divergence.
#> See https://mc-stan.org/misc/warnings for details.
# 90 percent intervals of the autoregression and its innovation SD
posterior_interval(mod, variable = c("ar1_trend", "sigma_trend"),
prob = 0.9)
#> 5% 95%
#> ar1_trend[series_1] 0.3124826 0.7833867
#> sigma_trend[series_1] 0.3536349 0.5918526
# Next: summary() reports these with convergence diagnostics
# }