Skip to contents

Specify the mean of prior for the dispersion parameter (in Poisson and binomial models) or the standard deviation parameter (in normal models.)

Usage

set_disp(mod, mean)

Arguments

mod

An object of class "bage_mod", created with mod_pois(), mod_binom(), or mod_norm().

mean

Mean value for the exponential prior. In Poisson and binomial models, can be set to 0.

Value

A bage_mod object

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

Examples

mod <- mod_pois(injuries ~ age:sex + ethnicity + year,
                data = nzl_injuries,
                exposure = popn)
mod
#> 
#>     ------ Unfitted Poisson model ------
#> 
#> 
#>    injuries ~ age:sex + ethnicity + year
#> 
#>   exposure = popn
#> 
#> 
#>         term  prior along n_par n_par_free
#>  (Intercept) NFix()     -     1          1
#>    ethnicity NFix()     -     2          2
#>         year   RW()  year    19         18
#>      age:sex   RW()   age    24         22
#> 
#> 
#>  n_draw pr_mean_disp var_time var_age var_sexgender
#>    1000            1     year     age           sex
#> 
mod |> set_disp(mean = 0.1)
#> 
#>     ------ Unfitted Poisson model ------
#> 
#> 
#>    injuries ~ age:sex + ethnicity + year
#> 
#>   exposure = popn
#> 
#> 
#>         term  prior along n_par n_par_free
#>  (Intercept) NFix()     -     1          1
#>    ethnicity NFix()     -     2          2
#>         year   RW()  year    19         18
#>      age:sex   RW()   age    24         22
#> 
#> 
#>  n_draw pr_mean_disp var_time var_age var_sexgender
#>    1000          0.1     year     age           sex
#> 
mod |> set_disp(mean = 0)
#> 
#>     ------ Unfitted Poisson model ------
#> 
#> 
#>    injuries ~ age:sex + ethnicity + year
#> 
#>   exposure = popn
#> 
#> 
#>         term  prior along n_par n_par_free
#>  (Intercept) NFix()     -     1          1
#>    ethnicity NFix()     -     2          2
#>         year   RW()  year    19         18
#>      age:sex   RW()   age    24         22
#> 
#> 
#>  n_draw pr_mean_disp var_time var_age var_sexgender
#>    1000            0     year     age           sex
#>