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 = 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
#>