Quantiles of posterior distributions for a range of weights on the informative component of the robust MAP prior
Source:R/create_posterior_data.R
create_posterior_data.Rd
Returns a data frame containing the default quantiles of posterior mixture distributions or bounds of highest posterior density intervals, generated with varying weights on the informative component of the MAP prior.
Usage
create_posterior_data(
map_prior,
new_trial_data,
sigma,
null_effect = 0,
interval_type = "equal-tailed",
n_samples = 10000
)
Arguments
- map_prior
A MAP prior containing information about the trial(s) in the source population, created using
RBesT
.- new_trial_data
A vector containing information about the new trial. See
create_new_trial_data()
.- sigma
Standard deviation to be used for the weakly informative component of the MAP prior, recommended to be the unit-information standard deviation.
- null_effect
The mean of the robust component of the MAP prior. Defaults to 0.
- interval_type
The type of credible interval (character of length 1), either `equal-tailed` (default) or `hpdi`, the highest posterior density interval.
- n_samples
Number of samples to compute highest posterior density intervals (hence, only applicable if the `interval_type` is `hpdi`).
Value
A data frame containing the default quantiles of posterior mixture distributions or bounds of highest posterior density intervals.
Details
Highest posterior density intervals are based on `coda::HPDinterval()` and are an experimental feature.
References
Best, N., Price, R. G., Pouliquen, I. J., & Keene, O. N. (2021). Assessing efficacy in important subgroups in confirmatory trials: An example using Bayesian dynamic borrowing. Pharm Stat, 20(3), 551–562. https://doi.org/10.1002/pst.2093
Examples
# create vector containing data on new trial
new_trial_data <- create_new_trial_data(
n_total = 30,
est = 1.27,
se = 0.95
)
# read MAP prior created by RBesT
map_prior <- load_tipmap_data("tipmapPrior.rds")
# create posterior data - with interval_type = equal_tailed
# (the default for tipping point plots)
posterior_data1 <- create_posterior_data(
map_prior = map_prior,
new_trial_data = new_trial_data,
sigma = 12,
interval_type = "equal-tailed"
)
#> Error in create_posterior_data(map_prior = map_prior, new_trial_data = new_trial_data, sigma = 12, interval_type = "equal-tailed"): unused argument (interval_type = "equal-tailed")
# \donttest{
# create posterior data - with interval_type = hpdi
posterior_data2 <- create_posterior_data(
map_prior = map_prior,
new_trial_data = new_trial_data,
sigma = 12,
interval_type = "hpdi",
n_samples = 1e4
)
#> Error in create_posterior_data(map_prior = map_prior, new_trial_data = new_trial_data, sigma = 12, interval_type = "hpdi", n_samples = 10000): unused arguments (interval_type = "hpdi", n_samples = 10000)
# }