Specify the mean of prior for the dispersion parameter (in Poisson and binomial models) or the standard deviation parameter (in normal models.)
Arguments
- mod
An object of class
"bage_mod"
, created withmod_pois()
,mod_binom()
, ormod_norm()
.- mean
Mean value for the exponential prior. In Poisson and binomial models, can be set to 0.
Details
The dispersion or mean parameter has an exponential distribution with mean \(\mu\),
$$p(\xi) = \frac{1}{\mu}\exp\left(\frac{-\xi}{\mu}\right).$$
In Poisson and binomial models,
mean
can be set to 0
, implying
that the dispersion term is also 0
.
In normal models, mean
must be non-negative.
If set_disp()
is applied to
a fitted model, it 'unfits'
the model, deleting existing estimates.
See also
mod_pois()
,mod_binom()
,mod_norm()
Specify a model for rates, probabilities, or meansset_prior()
Specify prior for a termset_n_draw()
Specify the number of drawsis_fitted()
Test whether a model is fitted
Examples
mod <- mod_pois(injuries ~ age:sex + ethnicity + year,
data = injuries,
exposure = popn)
mod
#> -- Unfitted Poisson model --
#>
#> injuries ~ age:sex + ethnicity + year
#>
#> (Intercept) ~ NFix()
#> ethnicity ~ NFix()
#> year ~ RW()
#> age:sex ~ RW()
#>
#> term n_par n_par_free
#> ethnicity 2 2
#> year 19 19
#> age:sex 24 24
#>
#> dispersion: mean=1
#> exposure: popn
#> var_age: age
#> var_sexgender: sex
#> var_time: year
#> n_draw: 1000
mod |> set_disp(mean = 0.1)
#> -- Unfitted Poisson model --
#>
#> injuries ~ age:sex + ethnicity + year
#>
#> (Intercept) ~ NFix()
#> ethnicity ~ NFix()
#> year ~ RW()
#> age:sex ~ RW()
#>
#> term n_par n_par_free
#> ethnicity 2 2
#> year 19 19
#> age:sex 24 24
#>
#> dispersion: mean=0.1
#> exposure: popn
#> var_age: age
#> var_sexgender: sex
#> var_time: year
#> n_draw: 1000
mod |> set_disp(mean = 0)
#> -- Unfitted Poisson model --
#>
#> injuries ~ age:sex + ethnicity + year
#>
#> (Intercept) ~ NFix()
#> ethnicity ~ NFix()
#> year ~ RW()
#> age:sex ~ RW()
#>
#> term n_par n_par_free
#> ethnicity 2 2
#> year 19 19
#> age:sex 24 24
#>
#> dispersion: mean=0
#> exposure: popn
#> var_age: age
#> var_sexgender: sex
#> var_time: year
#> n_draw: 1000