Skip to contents

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 with mod_pois(), mod_binom(), or mod_norm().

...

Unused. Included for generic consistency only.

Value

A tibble

Details

The tibble returned by tidy() contains the following columns:

  • term Name of the intercept, main effect, or interaction

  • spec Specification for prior

  • n_par Number of parameters

  • n_par_free Number of free parameters

  • std_dev Standard 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

sd(c(0.3, 0.5, 0.1))

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 data, and values for rates, probabilities, or means

  • components() Extract values for hyper-parameters

Examples

mod <- mod_pois(injuries ~ age + sex + year,
                data = injuries,
                exposure = popn)
mod <- fit(mod)
tidy(mod)
#> # A tibble: 4 × 5
#>   term        spec   n_par n_par_free std_dev
#>   <chr>       <chr>  <int>      <int>   <dbl>
#> 1 (Intercept) NFix()     1          1 NA     
#> 2 age         RW()      12         12  0.756 
#> 3 sex         NFix()     2          2  0.716 
#> 4 year        RW()      19         19  0.0808