bdpnormal is used for estimating posterior samples from a
Gaussian outcome where an informative prior is used. The prior weight is
determined using a discount function. This code is modeled after the
methodologies developed in Haddad et al. (2017).
Usage
bdpnormal(
mu_t = NULL,
sigma_t = NULL,
N_t = NULL,
mu0_t = NULL,
sigma0_t = NULL,
N0_t = NULL,
mu_c = NULL,
sigma_c = NULL,
N_c = NULL,
mu0_c = NULL,
sigma0_c = NULL,
N0_c = NULL,
discount_function = "identity",
alpha_max = 1,
fix_alpha = FALSE,
weibull_scale = 0.135,
weibull_shape = 3,
number_mcmc = 10000,
method = "mc",
compare = TRUE
)Arguments
- mu_t
scalar. Mean of the current treatment group.
- sigma_t
scalar. Standard deviation of the current treatment group.
- N_t
scalar. Number of observations of the current treatment group.
- mu0_t
scalar. Mean of the historical treatment group.
- sigma0_t
scalar. Standard deviation of the historical treatment group.
- N0_t
scalar. Number of observations of the historical treatment group.
- mu_c
scalar. Mean of the current control group.
- sigma_c
scalar. Standard deviation of the current control group.
- N_c
scalar. Number of observations of the current control group.
- mu0_c
scalar. Mean of the historical control group.
- sigma0_c
scalar. Standard deviation of the historical control group.
- N0_c
scalar. Number of observations of the historical control group.
- discount_function
character. Specify the discount function to use. Currently supports
weibull,scaledweibull, andidentity. The discount functionscaledweibullscales the output of the Weibull CDF to have a max value of 1. Theidentitydiscount function uses the posterior probability directly as the discount weight. Default value is "identity".- alpha_max
scalar. Maximum weight the discount function can apply. Default is 1. For a two-arm trial, users may specify a vector of two values where the first value is used to weight the historical treatment group and the second value is used to weight the historical control group.
- fix_alpha
logical. Fix alpha at alpha_max? Default value is FALSE.
- weibull_scale
scalar. Scale parameter of the Weibull discount function used to compute alpha, the weight parameter of the historical data. Default value is 0.135. For a two-arm trial, users may specify a vector of two values where the first value is used to estimate the weight of the historical treatment group and the second value is used to estimate the weight of the historical control group. Not used when
discount_function= "identity".- weibull_shape
scalar. Shape parameter of the Weibull discount function used to compute alpha, the weight parameter of the historical data. Default value is 3. For a two-arm trial, users may specify a vector of two values where the first value is used to estimate the weight of the historical treatment group and the second value is used to estimate the weight of the historical control group. Not used when
discount_function= "identity".- number_mcmc
scalar. Number of Monte Carlo simulations. Default is 10000.
- method
character. Analysis method with respect to estimation of the weight parameter alpha. Default method "
mc" estimates alpha for each Monte Carlo iteration. Under "mc", the stochastic comparison probability is recomputed at each Monte Carlo draw, so the resultingalpha_discountis a random vector and may exhibit substantial Monte Carlo variability. Alternate value "fixed" estimates alpha once and holds it fixed throughout the analysis. See thebdpnormalvignettevignette("bdpnormal-vignette", package="bayesDP")for more details.- compare
logical. Should a comparison object be included in the fit? For a one-arm analysis, the comparison object is simply the posterior chain of the treatment group parameter. For a two-arm analysis, the comparison object is the posterior chain of the treatment effect that compares treatment and control. If
compare=TRUE, the comparison object is accessible in thefinalslot, else thefinalslot isNULL. Default isTRUE.
Value
bdpnormal returns an object of class "bdpnormal". The
functions summary and
print are used to obtain and print a
summary of the results, including user inputs. The
plot function displays visual outputs
as well.
An object of class bdpnormal is a list containing at least
the following components:
posterior_treatmentlist. Entries contain values related to the treatment group:
alpha_discountnumeric. Alpha value, the weighting parameter of the historical data.p_hatnumeric. The posterior probability of the stochastic comparison between the current and historical data.posterior_muvector. A vector of lengthnumber_mcmccontaining the posterior mean of the treatment group. If historical treatment data is present, the posterior incorporates the weighted historical data.posterior_sigma2vector. A vector of lengthnumber_mcmccontaining the posterior variance of the treatment group. If historical treatment data is present, the posterior incorporates the weighted historical data.posterior_flat_muvector. A vector of lengthnumber_mcmccontaining Monte Carlo samples of the mean of the current treatment group under a flat/non-informative prior, i.e., no incorporation of the historical data.posterior_flat_sigma2vector. A vector of lengthnumber_mcmccontaining Monte Carlo samples of the standard deviation of the current treatment group under a flat/non-informative prior, i.e., no incorporation of the historical data.prior_muvector. If historical treatment data is present, a vector of lengthnumber_mcmccontaining Monte Carlo samples of the mean of the historical treatment group under a flat/non-informative prior.prior_sigma2vector. If historical treatment data is present, a vector of lengthnumber_mcmccontaining Monte Carlo samples of the standard deviation of the historical treatment group under a flat/non-informative prior.
posterior_controllist. Similar entries as
posterior_treament. Only present if a control group is specified.finallist. Contains the final comparison object, dependent on the analysis type:
One-arm analysis: vector. Posterior chain of the mean.
Two-arm analysis: vector. Posterior chain of the mean difference comparing treatment and control groups.
args1list. Entries contain user inputs. In addition, the following elements are output:
arm2binary indicator. Used internally to indicate one-arm or two-arm analysis.intentcharacter. Denotes current/historical status of treatment and control groups.
Details
bdpnormal uses a two-stage approach for determining the
strength of historical data in estimation of a mean outcome. In the first
stage, a discount function is used that that defines the maximum
strength of the historical data and discounts based on disagreement with
the current data. Disagreement between current and historical data is
determined by stochastically comparing the respective posterior
distributions under noninformative priors. With Gaussian data, the
comparison is the proability (p) that the current mean is less than
the historical mean. The comparison metric p is then input into the
discount function and the final strength of the historical data is returned
(alpha).
In the second stage, posterior estimation is performed where the discount
function parameter, alpha, is used incorporated in all posterior
estimation procedures.
To carry out a single arm (OPC) analysis, data for the current treatment
(mu_t, sigma_t, and N_t) and historical treatment
(mu0_t, sigma0_t, and N0_t) must be input. The results
are then based on the posterior distribution of the current data augmented
by the historical data.
To carry our a two-arm (RCT) analysis, data for the current treatment and at least one of current or historical control data must be input. The results are then based on the posterior distribution of the difference between current treatment and control, augmented by available historical data.
For more details, see the bdpnormal vignette: vignette("bdpnormal-vignette", package="bayesDP")
References
Haddad, T., Himes, A., Thompson, L., Irony, T., Nair, R. MDIC Computer Modeling and Simulation working group.(2017) Incorporation of stochastic engineering models as prior information in Bayesian medical device trials. Journal of Biopharmaceutical Statistics, 1-15.
Examples
# One-arm trial (OPC) example
fit <- bdpnormal(
mu_t = 30, sigma_t = 10, N_t = 50,
mu0_t = 32, sigma0_t = 10, N0_t = 50,
method = "fixed"
)
summary(fit)
#>
#> One-armed bdp normal
#>
#> data:
#> Current treatment: mu_t = 30, sigma_t = 10, N_t = 50
#> Historical treatment: mu0_t = 32, sigma0_t = 10, N0_t = 50
#> Stochastic comparison (p_hat) - treatment (current vs. historical data): 0.326
#> Discount function value (alpha) - treatment: 0.326
#> 95 percent CI:
#> 27.9583 33.0088
#> posterior sample estimate:
#> mean of treatment group
#> 30.4735
if (FALSE) { # \dontrun{
plot(fit)
} # }
# Two-arm (RCT) example
fit2 <- bdpnormal(
mu_t = 30, sigma_t = 10, N_t = 50,
mu0_t = 32, sigma0_t = 10, N0_t = 50,
mu_c = 25, sigma_c = 10, N_c = 50,
mu0_c = 25, sigma0_c = 10, N0_c = 50,
method = "fixed"
)
summary(fit2)
#>
#> Two-armed bdp normal
#>
#> data:
#> Current treatment: mu_t = 30, sigma_t = 10, N_t = 50
#> Current control: mu_c = 25, sigma_c = 10, N_c = 50
#> Historical treatment: mu0_t = 32, sigma0_t = 10, N0_t = 50
#> Historical control: mu0_c = 25, sigma0_c = 10, N0_c = 50
#> Stochastic comparison (p_hat) - treatment (current vs. historical data): 0.33
#> Stochastic comparison (p_hat) - control (current vs. historical data): 0.993
#> Discount function value (alpha) - treatment: 0.33
#> Discount function value (alpha) - control: 0.993
#> alternative hypothesis: two.sided
#> 95 percent CI:
#> 2.3734 8.6811
#> posterior sample estimates:
#> treatment group control group
#> 30.50 25.00
if (FALSE) { # \dontrun{
plot(fit2)
} # }