Functions & Formulae

Each applied formula has its own function page, with a signature, implementations, and tests.

Alpha spending function for group sequential trials

alpha(0) = 0; alpha(1) = alpha; t_k = I_k / I_max; P_0(Z_1 >= c_1 or ... or Z_k >= c_k) = alpha(t_k)

Maps the information fraction reached at an analysis of a group sequential trial to the cumulative one-sided type I error that may have been used by that point. The function rises from zero at the start of the trial to the overall significance level at the planned end. Each efficacy boundary is then set so that the probability, under the null hypothesis, of crossing any boundary up to and including analysis k equals the cumulative spend, with correlation sqrt(t_l / t_k) between the test statistics at analyses l and k. That step needs recursive numerical integration and is done in group sequential software, so the records here cover the closed-form parts: the information fraction, the two Lan-DeMets spending functions, the increment available at each look and the hazard ratio that crosses a given boundary.

  • Information fraction from deaths for alpha spending

    t_k = d_k / D

    Measures trial progress on the information scale that a spending function uses: the information available at analysis k divided by the information planned for the final analysis. For a survival outcome compared with the log-rank test, the fraction is approximated by the deaths observed so far divided by the deaths expected by the end of the trial. For a comparison of means it is the number of patients analysed divided by the target sample size.

  • Lan-DeMets O'Brien-Fleming type spending function

    alpha_OF = 2 - 2 * Phi(Phi^-1(1 - alpha / 2) / sqrt(t))

    Gives the cumulative one-sided type I error spent by information fraction t under the function Lan and DeMets proposed to approximate the O'Brien-Fleming boundary. Phi is the standard normal cumulative distribution function and Phi^-1 its inverse. The function spends almost nothing at early looks and equals alpha at t = 1 whatever the number of looks. Excel evaluates Phi with NORM.S.DIST and its inverse with NORM.S.INV.

  • Lan-DeMets Pocock type spending function

    alpha_P = alpha * log(1 + (exp(1) - 1) * t)

    Gives the cumulative one-sided type I error spent by information fraction t under the function Lan and DeMets proposed to approximate the Pocock boundary. The function log is the natural logarithm and exp(1) is e, the base of natural logarithms. It spends more evenly than the O'Brien-Fleming type, giving nearly constant boundaries and a higher chance of stopping early, and equals alpha at t = 1.

  • Alpha spending increment at an interim look

    Delta_alpha_k = alpha_k - alpha_(k-1)

    Gives the additional type I error that may be used at analysis k: the cumulative spend at t_k minus the cumulative spend at the previous analysis, with alpha_(k-1) equal to 0 at the first look. The increments over all analyses sum to the overall level alpha.

  • Hazard ratio needed to cross an alpha spending boundary

    HR_k = exp(-2 * c_k / sqrt(d_k))

    Converts the efficacy critical value at analysis k into the largest observed hazard ratio that crosses the boundary, using the approximation that with equal allocation the variance of the estimated log hazard ratio is about 4 divided by the number of deaths. The critical value comes from the numerically solved boundary; exp is the exponential function.