getDesignEquiv: Power and sample size for a generic group sequential...

View source: R/RcppExports.R

getDesignEquivR Documentation

Power and sample size for a generic group sequential equivalence design

Description

Obtains the maximum information and stopping boundaries for a generic group sequential equivalence design assuming a constant treatment effect, or obtains the power given the maximum information and stopping boundaries.

Usage

getDesignEquiv(
  beta = NA_real_,
  IMax = NA_real_,
  thetaLower = NA_real_,
  thetaUpper = NA_real_,
  theta = 0,
  kMax = 1L,
  informationRates = NA_real_,
  criticalValues = NA_real_,
  alpha = 0.05,
  typeAlphaSpending = "sfOF",
  parameterAlphaSpending = NA_real_,
  userAlphaSpending = NA_real_,
  spendingTime = NA_real_,
  varianceRatioH10 = 1,
  varianceRatioH20 = 1,
  varianceRatioH12 = 1,
  varianceRatioH21 = 1
)

Arguments

beta

The type II error.

IMax

The maximum information. Either beta or IMax should be provided while the other one should be missing.

thetaLower

The parameter value at the lower equivalence limit.

thetaUpper

The parameter value at the upper equivalence limit.

theta

The parameter value under the alternative hypothesis.

kMax

The maximum number of stages.

informationRates

The information rates. Fixed prior to the trial. Defaults to (1:kMax) / kMax if left unspecified.

criticalValues

Upper boundaries on the z-test statistic scale for stopping for efficacy.

alpha

The significance level for each of the two one-sided tests, e.g., 0.05.

typeAlphaSpending

The type of alpha spending. One of the following: "OF" for O'Brien-Fleming boundaries, "P" for Pocock boundaries, "WT" for Wang & Tsiatis boundaries, "sfOF" for O'Brien-Fleming type spending function, "sfP" for Pocock type spending function, "sfKD" for Kim & DeMets spending function, "sfHSD" for Hwang, Shi & DeCani spending function, "user" for user defined spending, and "none" for no early efficacy stopping. Defaults to "sfOF".

parameterAlphaSpending

The parameter value for the alpha spending. Corresponds to Delta for "WT", rho for "sfKD", and gamma for "sfHSD".

userAlphaSpending

The user defined alpha spending. Cumulative alpha spent up to each stage.

spendingTime

A vector of length kMax for the error spending time at each analysis. Defaults to missing, in which case, it is the same as informationRates.

varianceRatioH10

The ratio of the variance under H10 to the variance under H1.

varianceRatioH20

The ratio of the variance under H20 to the variance under H1.

varianceRatioH12

The ratio of the variance under H10 to the variance under H20.

varianceRatioH21

The ratio of the variance under H20 to the variance under H10.

Details

Consider the equivalence design with two one-sided hypotheses:

H_{10}: \theta \leq \theta_{10},

H_{20}: \theta \geq \theta_{20}.

We reject H_{10} at or before look k if

Z_{1j} = (\hat{\theta}_j - \theta_{10})\sqrt{\frac{n_j}{v_{10}}} \geq b_j

for some j=1,\ldots,k, where \{b_j:j=1,\ldots,K\} are the critical values associated with the specified alpha-spending function, and v_{10} is the null variance of \hat{\theta} based on the restricted maximum likelihood (reml) estimate of model parameters subject to the constraint imposed by H_{10} for one sampling unit drawn from H_1. For example, for estimating the risk difference \theta = \pi_1 - \pi_2, the asymptotic limits of the reml estimates of \pi_1 and \pi_2 subject to the constraint imposed by H_{10} are given by

(\tilde{\pi}_1, \tilde{\pi}_2) = f(\theta_{10}, r, r\pi_1, 1-r, (1-r)\pi_2),

where f(\theta_0, n_1, y_1, n_2, y_2) is the function to obtain the reml of \pi_1 and \pi_2 subject to the constraint that \pi_1-\pi_2 = \theta_0 with observed data (n_1, y_1, n_2, y_2) for the number of subjects and number of responses in the active treatment and control groups, r is the randomization probability for the active treatment group, and

v_{10} = \frac{\tilde{\pi}_1 (1-\tilde{\pi}_1)}{r} + \frac{\tilde{\pi}_2 (1-\tilde{\pi}_2)}{1-r}.

Let I_j = n_j/v_1 denote the information for \theta at the jth look, where

v_{1} = \frac{\pi_1 (1-\pi_1)}{r} + \frac{\pi_2 (1-\pi_2)}{1-r}

denotes the variance of \hat{\theta} under H_1 for one sampling unit. It follows that

(Z_{1j} \geq b_j) = (Z_j \geq w_{10} b_j + (\theta_{10}-\theta)\sqrt{I_j}),

where Z_j = (\hat{\theta}_j - \theta)\sqrt{I_j}, and w_{10} = \sqrt{v_{10}/v_1}.

Similarly, we reject H_{20} at or before look k if

Z_{2j} = (\hat{\theta}_j - \theta_{20})\sqrt{\frac{n_j}{v_{20}}} \leq -b_j

for some j=1,\ldots,k, where v_{20} is the null variance of \hat{\theta} based on the reml estimate of model parameters subject to the constraint imposed by H_{20} for one sampling unit drawn from H_1. We have

(Z_{2j} \leq -b_j) = (Z_j \leq -w_{20} b_j + (\theta_{20}-\theta)\sqrt{I_j}),

where w_{20} = \sqrt{v_{20}/v_1}.

Let l_j = w_{10}b_j + (\theta_{10}-\theta)\sqrt{I_j}, and u_j = -w_{20}b_j + (\theta_{20}-\theta)\sqrt{I_j}. The cumulative probability to reject H_0 = H_{10} \cup H_{20} at or before look k under the alternative hypothesis H_1 is given by

P_\theta\left(\cup_{j=1}^{k} (Z_{1j} \geq b_j) \cap \cup_{j=1}^{k} (Z_{2j} \leq -b_j)\right) = p_1 + p_2 + p_{12},

where

p_1 = P_\theta\left(\cup_{j=1}^{k} (Z_{1j} \geq b_j)\right) = P_\theta\left(\cup_{j=1}^{k} (Z_j \geq l_j)\right),

p_2 = P_\theta\left(\cup_{j=1}^{k} (Z_{2j} \leq -b_j)\right) = P_\theta\left(\cup_{j=1}^{k} (Z_j \leq u_j)\right),

and

p_{12} = P_\theta\left(\cup_{j=1}^{k} \{(Z_j \geq l_j) \cup (Z_j \leq u_j)\}\right).

Of note, both p_1 and p_2 can be evaluated using one-sided exit probabilities for group sequential designs. If there exists j\leq k such that l_j \leq u_j, then p_{12} = 1. Otherwise, p_{12} can be evaluated using two-sided exit probabilities for group sequential designs.

To evaluate the type I error of the equivalence trial under H_{10}, we first match the information under H_{10} with the information under H_1. For example, for estimating the risk difference for two independent samples, the sample size n_{10} under H_{10} must satisfy

\frac{1}{n_{10}}\left(\frac{(\pi_2 + \theta_{10}) (1 - \pi_2 - \theta_{10})}{r} + \frac{\pi_2 (1-\pi_2)}{1-r}\right) = \frac{1}{n}\left(\frac{\pi_1(1-\pi_1)}{r} + \frac{\pi_2 (1-\pi_2)}{1-r}\right).

Then we obtain the reml estimates of \pi_1 and \pi_2 subject to the constraint imposed by H_{20} for one sampling unit drawn from H_{10},

(\tilde{\pi}_{10}, \tilde{\pi}_{20}) = f(\theta_{20}, r, r(\pi_2 + \theta_{10}), 1-r, (1-r)\pi_2).

Let t_j denote the information fraction at look j. Define

\tilde{v}_1 = \frac{(\pi_2 + \theta_{10}) (1-\pi_2 -\theta_{10})}{r} + \frac{\pi_2 (1-\pi_2)}{1-r},

and

\tilde{v}_{20} = \frac{\tilde{\pi}_{10}(1-\tilde{\pi}_{10})}{r} + \frac{\tilde{\pi}_{20} (1-\tilde{\pi}_{20})}{1-r}.

The cumulative rejection probability under H_{10} at or before look k is given by

P_{\theta_{10}}\left(\cup_{j=1}^{k} \{(\hat{\theta}_j - \theta_{10}) \sqrt{n_{10} t_j/\tilde{v}_1} \geq b_j\} \cap \cup_{j=1}^{k} \{(\hat{\theta}_j - \theta_{20}) \sqrt{n_{10} t_j/\tilde{v}_{20}} \leq -b_j\}\right) = q_1 + q_2 + q_{12},

where

q_1 = P_{\theta_{10}}\left(\cup_{j=1}^{k} \{(\hat{\theta}_j - \theta_{10}) \sqrt{n_{10} t_j/\tilde{v}_1} \geq b_j\}\right) = P_{\theta_{10}}\left(\cup_{j=1}^{k} (Z_j \geq b_j)\right),

q_2 = P_{\theta_{10}}\left(\cup_{j=1}^{k} \{(\hat{\theta}_j - \theta_{20}) \sqrt{n_{10} t_j/\tilde{v}_{20}} \leq -b_j\}\right) = P_{\theta_{10}}\left(\cup_{j=1}^{k} (Z_j \leq -b_j w_{21} + (\theta_{20} - \theta_{10})\sqrt{I_j})\right),

and

q_{12} = P_{\theta_{10}}\left(\cup_{j=1}^{k} \{(Z_j \geq b_j) \cup (Z_j \leq -w_{21} b_j + (\theta_{20} - \theta_{10})\sqrt{I_j})\}\right).

Here Z_j = (\hat{\theta}_j - \theta_{10}) \sqrt{I_j}, and w_{21} = \sqrt{\tilde{v}_{20}/\tilde{v}_1}. Of note, q_1, q_2, and q_{12} can be evaluated using group sequential exit probabilities. Similarly, we can define \tilde{v}_2, \tilde{v}_{10}, and w_{12} = \sqrt{\tilde{v}_{10}/\tilde{v}_2}, and evaluate the type I error under H_{20}.

The variance ratios correspond to

\text{varianceRatioH10} = v_{10}/v_1,

\text{varianceRatioH20} = v_{20}/v_1,

\text{varianceRatioH12} = \tilde{v}_{10}/\tilde{v}_2,

\text{varianceRatioH21} = \tilde{v}_{20}/\tilde{v}_1.

If the alternative variance is used, then the variance ratios are all equal to 1.

Value

An S3 class designEquiv object with three components:

  • overallResults: A data frame containing the following variables:

    • overallReject: The overall rejection probability.

    • alpha: The overall significance level.

    • attainedAlphaH10: The attained significance level under H10.

    • attainedAlphaH20: The attained significance level under H20.

    • kMax: The number of stages.

    • thetaLower: The parameter value at the lower equivalence limit.

    • thetaUpper: The parameter value at the upper equivalence limit.

    • theta: The parameter value under the alternative hypothesis.

    • information: The maximum information.

    • expectedInformationH1: The expected information under H1.

    • expectedInformationH10: The expected information under H10.

    • expectedInformationH20: The expected information under H20.

  • byStageResults: A data frame containing the following variables:

    • informationRates: The information rates.

    • efficacyBounds: The efficacy boundaries on the Z-scale for each of the two one-sided tests.

    • rejectPerStage: The probability for efficacy stopping.

    • cumulativeRejection: The cumulative probability for efficacy stopping.

    • cumulativeAlphaSpent: The cumulative alpha for each of the two one-sided tests.

    • cumulativeAttainedAlphaH10: The cumulative probability for efficacy stopping under H10.

    • cumulativeAttainedAlphaH20: The cumulative probability for efficacy stopping under H20.

    • efficacyThetaLower: The efficacy boundaries on the parameter scale for the one-sided null hypothesis at the lower equivalence limit.

    • efficacyThetaUpper: The efficacy boundaries on the parameter scale for the one-sided null hypothesis at the upper equivalence limit.

    • efficacyP: The efficacy bounds on the p-value scale for each of the two one-sided tests.

    • information: The cumulative information.

  • settings: A list containing the following components:

    • typeAlphaSpending: The type of alpha spending.

    • parameterAlphaSpending: The parameter value for alpha spending.

    • userAlphaSpending: The user defined alpha spending.

    • spendingTime: The error spending time at each analysis.

    • varianceRatioH10: The ratio of the variance under H10 to the variance under H1.

    • varianceRatioH20: The ratio of the variance under H20 to the variance under H1.

    • varianceRatioH12: The ratio of the variance under H10 to the variance under H20.

    • varianceRatioH21: The ratio of the variance under H20 to the variance under H10.

Author(s)

Kaifeng Lu, kaifenglu@gmail.com

Examples


# Example 1: obtain the maximum information given power
(design1 <- getDesignEquiv(
  beta = 0.2, thetaLower = log(0.8), thetaUpper = log(1.25),
  kMax = 2, informationRates = c(0.5, 1),
  alpha = 0.05, typeAlphaSpending = "sfOF"))


# Example 2: obtain power given the maximum information
(design2 <- getDesignEquiv(
  IMax = 72.5, thetaLower = log(0.7), thetaUpper = -log(0.7),
  kMax = 3, informationRates = c(0.5, 0.75, 1),
  alpha = 0.05, typeAlphaSpending = "sfOF"))


lrstat documentation built on June 23, 2024, 5:06 p.m.