Specify a prior distribution for an intercept, a main effect, or an interaction.
Arguments
- mod
A
bage_mod
object, created withmod_pois()
,mod_binom()
, ormod_norm()
.- formula
A formula giving the term and a function for creating a prior.
Details
If set_prior()
is applied to
a fitted model, it 'unfits'
the model, deleting existing estimates.
See also
priors Current choices for prior distributions
is_fitted()
Test whether a model is fittedset_disp()
Specify prior for dispersion
Examples
mod <- mod_pois(injuries ~ age + year,
data = injuries,
exposure = popn)
mod
#> -- Unfitted Poisson model --
#>
#> injuries ~ age + year
#>
#> (Intercept) ~ NFix()
#> age ~ RW()
#> year ~ RW()
#>
#> term n_par n_par_free
#> age 12 12
#> year 19 19
#>
#> dispersion: mean=1
#> exposure: popn
#> var_age: age
#> var_time: year
#> n_draw: 1000
mod |> set_prior(age ~ RW2())
#> -- Unfitted Poisson model --
#>
#> injuries ~ age + year
#>
#> (Intercept) ~ NFix()
#> age ~ RW2()
#> year ~ RW()
#>
#> term n_par n_par_free
#> age 12 12
#> year 19 19
#>
#> dispersion: mean=1
#> exposure: popn
#> var_age: age
#> var_time: year
#> n_draw: 1000