Skip to contents

Specify a prior distribution for an intercept, a main effect, or an interaction.

Usage

set_prior(mod, formula)

Arguments

mod

A bage_mod object, created with mod_pois(), mod_binom(), or mod_norm().

formula

A formula giving the term and a function for creating a prior.

Value

A modified bage_mod object.

Details

If set_prior() is applied to a fitted model, it 'unfits' the model, deleting existing estimates.

See also

Examples

mod <- mod_pois(injuries ~ age + year,
                data = nzl_injuries,
                exposure = popn)
mod
#> 
#>     ------ Unfitted Poisson model ------
#> 
#> 
#>    injuries ~ age + year
#> 
#>   exposure = popn
#> 
#> 
#>         term  prior along n_par n_par_free
#>  (Intercept) NFix()     -     1          1
#>          age   RW()   age    12         11
#>         year   RW()  year    19         18
#> 
#> 
#>  n_draw pr_mean_disp var_time var_age
#>    1000            1     year     age
#> 
mod |> set_prior(age ~ RW2())
#> 
#>     ------ Unfitted Poisson model ------
#> 
#> 
#>    injuries ~ age + year
#> 
#>   exposure = popn
#> 
#> 
#>         term  prior along n_par n_par_free
#>  (Intercept) NFix()     -     1          1
#>          age  RW2()   age    12         11
#>         year   RW()  year    19         18
#> 
#> 
#>  n_draw pr_mean_disp var_time var_age
#>    1000            1     year     age
#>