Specify Number of Draws from Prior or Posterior Distribution
Source:R/bage_mod-functions.R
set_n_draw.Rd
Specify the number of draws from the posterior
distribution to be used in model output.
A newly-created bage_mod
object has an
n_draw
value of 1000. Higher values
may be appropriate for characterizing
the tails of distributions, or for
publication-quality graphics and summaries.
Arguments
- mod
An object of class
"bage_mod"
, created withmod_pois()
,mod_binom()
, ormod_norm()
.- n_draw
Number of draws.
Details
If the new value for n_draw
is greater than
the old value, and the model has already been fitted,
then the model is unfitted, and
function fit()
may need to be called again.
See also
n_draw.bage_mod()
query the value ofn_draw
augment()
,components()
functions for drawing from prior or posterior distribution - the output of which is affected by the value ofn_draw
mod_pois()
,mod_binom()
,mod_norm()
Specify a modelset_prior()
Specify prior for a termset_disp()
Specify prior for dispersionfit()
Fit a modelunfit()
Reset a model
Examples
mod <- mod_pois(injuries ~ age:sex + ethnicity + year,
data = nzl_injuries,
exposure = popn)
mod # value for 'n_draw' displayed in object
#>
#> ------ 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 19
#> age:sex RW() age 24 24
#>
#> disp: mean = 1
#>
#> n_draw var_time var_age var_sexgender
#> 1000 year age sex
#>
n_draw(mod) # or use 'n_draw()' to query
#> [1] 1000
mod <- mod |>
set_n_draw(n_draw = 5000)
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 19
#> age:sex RW() age 24 24
#>
#> disp: mean = 1
#>
#> n_draw var_time var_age var_sexgender
#> 5000 year age sex
#>