View source: R/create_posterior_data.R
| create_posterior_data | R Documentation |
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.
create_posterior_data(
map_prior,
new_trial_data,
sigma,
null_effect = 0,
interval_type = "equal-tailed",
n_samples = 10000
)
map_prior |
A MAP prior containing information about the trial(s) in
the source population, created using |
new_trial_data |
A vector containing information about the new trial.
See |
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'). |
Highest posterior density intervals are based on 'coda::HPDinterval()' and are an experimental feature.
A data frame containing the default quantiles of posterior mixture distributions or bounds of highest posterior density intervals.
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
[create_new_trial_data()] and [create_prior_data()]
# 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"
)
# 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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.