components.bage_mod {bage} | R Documentation |
Extract Values for Hyper-Parameters
Description
Extract values for hyper-parameters from a model object. Hyper-parameters include main effects and interactions, dispersion and variance terms, and SVD or spline coefficients.
Usage
## S3 method for class 'bage_mod'
components(object, quiet = FALSE, ...)
Arguments
object |
Object of class |
quiet |
Whether to suppress messages.
Default is |
... |
Unused. Included for generic consistency only. |
Value
A tibble with four columns columns:
The return value contains the following columns:
-
term
Model term that the hyper-parameter belongs to. -
component
Component within term. -
level
Element within component . -
.fitted
An rvec containing draws from the posterior distribution.
Fitted vs unfitted models
components()
is typically called on a fitted
model. In this case, the modelled values are
draws from the joint posterior distribution for the
hyper-parameters in the model.
components()
can, however, be called on an
unfitted model. In this case, the modelled values
are draws from the joint prior distribution.
In other words, the modelled values are informed by
model priors, and by any exposure
, size
, or weights
argument in the model, but not by the observed outcomes.
See Also
-
augment()
Extract data and values for rates, means, or probabilities -
tidy()
Extract a one-line summary of a model -
mod_pois()
Specify a Poisson model -
mod_binom()
Specify a binomial model -
mod_norm()
Specify a normal model -
fit()
Fit a model -
is_fitted()
See if a model has been fitted -
unfit()
Reset a model
Examples
## specify model
mod <- mod_pois(injuries ~ age + sex + year,
data = nzl_injuries,
exposure = popn)
## extract prior distribution
## of hyper-parameters
mod |>
components()
## fit model
mod <- mod |>
fit()
## extract posterior distribution
## of hyper-parameters
mod |>
components()