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 a0a_0 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 μt\mu_t and the parameter for the control group by μc\mu_c. Suppose there are KK historical datasets D0=(D01,,D0K)D_0 = (D_{01},\cdots, D_{0K})'. We consider the following normalized power prior for μc\mu_c given multiple historical datasets D0D_0

π(μcD0,a0)=1C(a0)k=1K[L(μcD0k)a0k]π0(μc)\pi(\mu_c|D_0,a_0) = \frac{1}{C(a_0)}\prod_{k=1}^K \left[L(\mu_c|D_{0k})^{a_{0k}}\right]\pi_0(\mu_c)

where a0=(a01,,a0K)a_0 = (a_{01},\cdots,a_{0K})', 0a0k10\le a_{0k} \le 1 for k=1,,Kk=1,\cdots,K, L(μcD0k)L(\mu_c|D_{0k}) is the historical data likelihood, π0(μc)\pi_0(\mu_c) is an initial prior, and C(a0)=k=1K[L(μcD0k)a0k]π0(μc)dμcC(a_0)=\int \prod_{k=1}^K [L(\mu_c|D_{0k})^{a_{0k}}]\pi_0(\mu_c)d\mu_c. When a0a_0 is fixed, the normalized power prior is equivalent to the power prior

π(μcD0,a0)=k=1K[L(μcD0k)a0k]π0(μc).\pi(\mu_c|D_0,a_0) = \prod_{k=1}^K \left[L(\mu_c|D_{0k})^{a_{0k}}\right]\pi_0(\mu_c).

By default, the power/type I error calculation algorithm assumes the null and alternative hypotheses are given by

H0:μtμcδH_0: \mu_t - \mu_c \ge \delta

and

H1:μtμc<δ,H_1: \mu_t - \mu_c < \delta,

where δ\delta is a prespecified constant. To test hypotheses of the opposite direction, i.e., H0:μtμcδH_0: \mu_t - \mu_c \le \delta and H1:μtμc>δH_1: \mu_t - \mu_c > \delta , one can set the parameter nullspace.ineq to "<". To determine Bayesian sample size, we estimate the quantity

βsj(n)=Es[I{P(μtμc<δy(n),π(f))γ}]\beta_{sj}^{(n)}=E_s[I\{P(\mu_t-\mu_c<\delta|y^{(n)}, \pi^{(f)})\ge \gamma\}]

where γ>0\gamma > 0 is a prespecified posterior probability threshold for rejecting the null hypothesis (e.g., 0.9750.975), the probability is computed with respect to the posterior distribution given the data y(n)y^{(n)} and the fitting prior π(f)\pi^{(f)}, and the expectation is taken with respect to the marginal distribution of y(n)y^{(n)} defined based on the sampling prior π(s)(θ)\pi^{(s)}(\theta), where θ=(μt,μc,η)\theta=(\mu_t, \mu_c, \eta) and η\eta denotes any nuisance parameter in the model. Let Θ0\Theta_0 and Θ1\Theta_1 denote the parameter spaces corresponding to H0H_0 and H1H_1. Let π0(s)(θ)\pi_0^{(s)}(\theta) denote a sampling prior that puts mass in the null region, i.e., θΘ0\theta \subset \Theta_0. Let π1(s)(θ)\pi_1^{(s)}(\theta) denote a sampling prior that puts mass in the alternative region, i.e., θΘ1\theta \subset \Theta_1. Then βs0(n)\beta_{s0}^{(n)} corresponding to π(s)(θ)=π0(s)(θ)\pi^{(s)}(\theta)=\pi_0^{(s)}(\theta) is a Bayesian type I error, while βs1(n)\beta_{s1}^{(n)} corresponding to π(s)(θ)=π1(s)(θ)\pi^{(s)}(\theta)=\pi_1^{(s)}(\theta) is a Bayesian power. We compute nα0=min{n:βs0(n)α0}n_{\alpha_0} = \min\{n: \beta_{s0}^{(n)} \le \alpha_0\} and nα1=min{n:βs1(n)1α1}n_{\alpha_1} = \min\{n: \beta_{s1}^{(n)} \ge 1-\alpha_1\}. Then Bayesian sample size is max{nα0,nα1}\{n_{\alpha_0}, n_{\alpha_1}\}. Choosing α0=0.05\alpha_0=0.05 and α1=0.2\alpha_1=0.2 guarantees that the Bayesian type I error rate is at most 0.050.05 and the Bayesian power is at least 0.80.8.

To compute βsj(n)\beta_{sj}^{(n)}, the following algorithm is used:

Step 1:

Generate θπj(s)(θ)\theta \sim \pi_j^{(s)}(\theta)

Step 2:

Generate y(n)f(y(n)θ)y^{(n)} \sim f(y^{(n)}|\theta)

Step 3:

Compute P(μt<μc+δy(n),π(f))P(\mu_t < \mu_c + \delta|y^{(n)}, \pi^{(f)})

Step 4:

Check whether P(μt<μc+δy(n),π(f))γP(\mu_t < \mu_c + \delta|y^{(n)}, \pi^{(f)}) \ge \gamma

Step 5:

Repeat Steps 1-4 NN times

Step 6:

Compute the proportion of times that {μt<μc+δy(n),π(f)γ}\{\mu_t < \mu_c + \delta|y^{(n)}, \pi^{(f)} \ge \gamma\} is true out of the NN simulated datasets, which gives an estimate of βsj(n)\beta_{sj}^{(n)}.

For positive continuous data assumed to follow exponential distribution, the hypotheses are given by

H0:μt/μcδH_0: \mu_t/\mu_c \ge \delta

and

H1:μt/μc<δ,H_1: \mu_t/\mu_c < \delta,

where μt\mu_t and μc\mu_c are the hazards for the treatment and the control group, respectively. The definition of βsj(n)\beta_{sj}^{(n)} 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 β1\beta_1, 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

H0:β1δH_0: \beta_1 \ge \delta

and

H1:β1<δ.H_1: \beta_1 < \delta.

The definition of βsj(n)\beta_{sj}^{(n)} 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 θ\theta (matrix if θ\theta 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 a0a_0, 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.


[Package BayesPPD version 1.1.2 Index]