BayesPPD-package {BayesPPD} | R Documentation |
Bayesian sample size determination using the power and normalized power prior for generalized linear models
Description
The BayesPPD (Bayesian Power Prior Design) package provides two categories of functions:
functions for Bayesian power/type I error calculation and functions for model fitting.
Supported distributions include normal, binary (Bernoulli/binomial), Poisson and exponential.
The power parameter can be fixed or modeled as random using a normalized power prior.
Details
Following Chen et al.(2011), for two group models (i.e., treatment and control group with no covariates), denote the parameter for the treatment group by
and the parameter for the control group by
. Suppose there are
historical datasets
. We consider the following normalized power prior
for
given multiple historical datasets
where ,
for
,
is the historical data likelihood,
is an initial prior, and
. When
is fixed,
the normalized power prior is equivalent to the power prior
By default, the power/type I error calculation algorithm assumes the null and alternative hypotheses are given by
and
where is a prespecified constant. To test hypotheses of
the opposite direction, i.e.,
and
, one can set the parameter
nullspace.ineq
to "<".
To determine Bayesian sample size, we estimate the quantity
where is a prespecified posterior probability threshold for rejecting the null hypothesis (e.g.,
), the probability is computed with respect to the posterior distribution given the data
and the fitting prior
, and the expectation is taken with respect to the marginal distribution of
defined based on the sampling prior
, where
and
denotes any nuisance parameter in the model.
Let
and
denote the parameter spaces corresponding to
and
.
Let
denote a sampling prior that puts mass in the null region, i.e.,
.
Let
denote a sampling prior that puts mass in the alternative region, i.e.,
.
Then
corresponding to
is a Bayesian type I error,
while
corresponding to
is a Bayesian power.
We compute
and
.
Then Bayesian sample size is max
. Choosing
and
guarantees that the Bayesian type I error rate is at most
and the Bayesian power is at least
.
To compute , the following algorithm is used:
- Step 1:
Generate
- Step 2:
Generate
- Step 3:
Compute
- Step 4:
Check whether
- Step 5:
Repeat Steps 1-4
times
- Step 6:
Compute the proportion of times that
is true out of the
simulated datasets, which gives an estimate of
.
For positive continuous data assumed to follow exponential distribution, the hypotheses are given by
and
where and
are the hazards for the treatment and the control group, respectively.
The definition of
and the algorithm change accordingly.
If there are covariates to adjust for, we assume the first column of the covariate matrix is the treatment indicator,
and the corresponding parameter is , which, for example, corresponds to a difference in means for the linear regression model and a log hazard ratio for the exponential regression model.
The hypotheses are given by
and
The definition of and the algorithm change accordingly.
By default, the package assumes the historical data is
composed of control group subjects only. If the user wants to use historical data to inform treatment effect, one can set borrow.treat=TRUE
and include the treatment indicator in the historical covariate matrix.
This implementation of the method does not assume any particular distribution for the sampling priors.
The user is allowed to specify a vector or matrix of samples for (matrix if
is of dimension >1) from any distribution, and the algorithm samples with replacement
from the vector or matrix at each iteration of data simulation. In order to accurately approximate a joint distribution
for multiple parameters, the number of iterations should be large (e.g., 10,000).
Gibbs sampling is used for normally distributed data. Slice sampling is used for all other data distributions.
For two group models with fixed ,
numerical integration using the RcppNumerical package is used.
References
Chen, Ming-Hui, et al. "Bayesian design of noninferiority trials for medical devices using historical data." Biometrics 67.3 (2011): 1163-1170.