est_naloxone {bennu} | R Documentation |
Run Bayesian estimation of naloxone number under-reporting
Description
Samples from Bayesian model using input from data frame
Usage
est_naloxone(
d,
psi_vec = c(0.7, 0.2, 0.1),
max_delays = 3,
delay_alpha = 2,
delay_beta = 1,
run_estimation = TRUE,
rw_type = 1,
chains = 4,
iter = 2000,
seed = 42,
adapt_delta = 0.85,
...
)
Arguments
d |
data frame with format
|
psi_vec |
reporting delay distribution |
max_delays |
maximum delay from kit ordered to kit distributed |
delay_alpha |
shape parameter for order to distributed delay distribution |
delay_beta |
shape parameter for order to distributed delay distribution |
run_estimation |
if |
rw_type |
|
chains |
A positive integer specifying the number of Markov chains. The default is 4. |
iter |
A positive integer specifying the number of iterations for each chain (including warmup). The default is 2000. |
seed |
Seed for random number generation |
adapt_delta |
(double, between 0 and 1, defaults to 0.8) |
... |
other parameters to pass to rstan::sampling |
Value
An S4 rstan::stanfit class object containing the fitted model
See Also
Other inference:
est_naloxone_vec()
Examples
## Not run:
library(rstan)
library(bayesplot)
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores(logical = FALSE))
d <- generate_model_data()
fit <- est_naloxone(d, iter = 100, chains = 1)
mcmc_pairs(fit,
pars = c("sigma", "mu0"),
off_diag_args = list(size = 1, alpha = 0.5)
)
## End(Not run)