library(conditionalpower)

knitr::opts_chunk$set(
  #collapse = TRUE,
  comment = "",
  fig.width = 4,
  fig.height = 4,
    message = FALSE,
    warning = FALSE,
    tidy.opts = list(
        keep.blank.line = TRUE,
        width.cutoff = 150
        ),
    options(width = 150),
    eval = TRUE
)

Conditional power is a tool that may used at an interim analysis of a clinical trial to assess the likelihood of reaching a statistically significant outcome at the conclusion of the trial. It may be used for a futility interim analysis to help investigators assess whether or not it will be productive to continue the trial. Such a procedure may have been planned, or it may be implemented in response to slow accrual. This package implements the Lan and Wittes(1988) B-Value monitoring tool. A B-value is a transformed Z-value that represents the realization of a Brownian motion process. It is simple to compute, and using it is simple to use to project potential outcomes of the trial.

Installing the conditionalpower package

Start by installing the devtools package from CRAN, by typing

install.packages("devtools")

Then install the conditionalpower package from the github repository by typing

devtools::install_github("mooredf22/conditionalpower")

Conditional power background

The function condPower computes, at any accrual point, the B-value and that point and also projects the power of the trial at completion under several different scenarios for the future of the trial. Suppose an interim analysis is done at time $\tau$, which represents the fraction of information, typically time, that has been accumulated, and that the full accrual number is $N$. If $n$ represents the number of patients accrued at that time and $Z_n$ the Z-statistic at that time, then (typically) we have $\tau = n/N$, and the B-value is given by

$$ B_n = Z_n \cdot \sqrt t $$ A key parameter is $\Delta$, the alternative hypothesis value of the mean observation $X$ that the trial is powered to detect. Another key parameter is $\Theta = E(Z) = \sqrt N \Delta = z_\alpha + z_\beta$. This is the "expected value" of the test statistic $Z$ at the end of the study.

For example, suppose we are planning, at the final analysis, a one-sided 2.5 percent level test, which is powered at 85 percent. We have $\Theta = 1.96 + 1.04 = 3.00$. We conduct the interim analysis when 40 percent of the data (information) is available. Suppose at that point the Z-value from a test is 2.846. We can find the conditional power as follows:

library(conditionalpower)
condPow2 <- condPower(tau=0.4, zz.interim=2.846, alpha=0.025, power=0.85)

The result is a data structure giving the conditional power and other parameters:

condPow2

The B-value at the interim time is 1.80. The predicted value of the B-value at the end of the study, assuming that the originally hypothesized trend continues, is 3.598.

We may plot the predicted power, assuming that the original trend continues:

plotCondPower(condPow2)

The interim point is a blue filled circle. The predicted values of theta at the end of the study are indicated by a black tiangle, a blue diamond, and a blue square representing, respectively, the predicted values of theta at the end of the study for (a) the original prediction, (b) the prediction under the current trend, and (c) the prediction under the assumed trend.

Covid trial simulation

Here we simulate a clinical trial comparing two arms.

set.seed(58013)
TrialOut <- covidGen(nCont=60, nExp=60, p0=0.571, p1=0.801)

Next, fit a logistic regression model to the interim data, after 60 patients have been accrued.

interim.result <- glm(Outcome ~ Arm, family=binomial, 
                      data=TrialOut[1:60,])
  interim.summ <- summary(interim.result)
  coef.interim <- interim.summ$coefficients
  zz.interim <- coef.interim[2,3]
  coef.interim
  zz.interim

We see that the Z value at interim is 1.416.

  condPow.out <- condPower(tau=0.5, zz.interim=zz.interim )
  condPow.out

We see that the Z-value at the 50 percent accrual time is 0.7387.

plotCondPower(condPow.out)

The predicted B-value at the end of the study, assuming the originally hypothesized trend, is 2.802. Assuming the current trend continues, it would be 2.402.

References

Lan, KKG and Wittes J (1988) The B-value: A tool for monitoring data. Biometrics 44, 579-585.

Lachin JM (2005) A review of methods for futility stopping based on conditional power Statistics in Medicine 24, 2747-2764.



mooredf22/conditionalpower documentation built on Dec. 6, 2024, 8:25 a.m.