Summarize the intercept, main effects, and interactions from a fitted model.
Usage
# S3 method for class 'bage_mod'
tidy(x, ...)Arguments
- x
Object of class
"bage_mod", typically created withmod_pois(),mod_binom(), ormod_norm().- ...
Unused. Included for generic consistency only.
Value
A tibble
Details
The tibble returned by tidy()
contains the following columns:
termName of the intercept, main effect, or interactionpriorSpecification for priorn_parNumber of parametersn_par_freeNumber of free parametersstd_devStandard deviation for point estimates.
With some priors, the number of free parameters is less than
the number of parameters for that term. For instance, an SVD()
prior might use three vectors to represent 101 age groups
so that the number of parameters is 101, but the number of
free parameters is 3.
std_dev is the standard deviation across elements of a
term, based on point estimates of those elements.
For instance, if the point
estimates for a term with three elements are
0.3, 0.5, and 0.1, then the value for std_dev is
std_dev is a measure of the contribution of a term to
variation in the outcome variable.
References
std_dev is modified from Gelman et al. (2014)
Bayesian Data Analysis. Third Edition. pp396–397.
See also
augment()Extract values for rates, probabilities, or means, together with original datacomponents()Extract values for hyper-parameters
Examples
mod <- mod_pois(injuries ~ age + sex + year,
data = nzl_injuries,
exposure = popn)
mod <- fit(mod)
#> Building log-posterior function...
#> Finding maximum...
#> Drawing values for hyper-parameters...
tidy(mod)
#> # A tibble: 4 × 6
#> term prior along n_par n_par_free std_dev
#> <chr> <chr> <chr> <int> <int> <dbl>
#> 1 (Intercept) NFix() NA 1 1 NA
#> 2 age RW() age 12 12 0.756
#> 3 sex NFix() NA 2 2 0.716
#> 4 year RW() year 19 19 0.0808