getOptimalConditionalError: Calculate the Optimal Conditional Error

View source: R/getOptimalConditionalError.R

getOptimalConditionalErrorR Documentation

Calculate the Optimal Conditional Error

Description

Calculate the Optimal Conditional Error

Usage

getOptimalConditionalError(firstStagePValue, design)

Arguments

firstStagePValue

First-stage p-value or p-values. Must be a numeric vector between 0 and 1.

design

An object of class TrialDesignOptimalConditionalError created by getDesignOptimalConditionalErrorFunction(). Contains all necessary arguments to calculate the optimal conditional error function for the specified case.

Details

The optimal conditional error \alpha_2 given a first-stage p-value p_1 is calculated as:

\alpha_2(p_1)=\psi(-e^{c_0} \cdot \frac{\Delta_1^2}{l(p_1)}).

The level constant c_0 as well as the specification of the effect size \Delta_1 and the likelihood ratio l(p_1) must be contained in the design object (see ?getDesignOptimalConditionalErrorFunction). Early stopping rules are supported, i.e., for p_1 \leq \alpha_1, the returned conditional error is 1 and for p_1 > \alpha_0, the returned conditional error is 0.

Value

Value of the optimal conditional error function.

References

Brannath, W. & Bauer, P. (2004). Optimal conditional error functions for the control of conditional power. Biometrics. https://www.jstor.org/stable/3695393

See Also

getDesignOptimalConditionalErrorFunction()

Examples

# Create a design
design <- getDesignOptimalConditionalErrorFunction(
alpha = 0.025, alpha1 = 0.001, alpha0 = 0.5, conditionalPower = 0.9,
delta1 = 0.5, firstStageInformation = 40, useInterimEstimate = FALSE,
likelihoodRatioDistribution = "fixed", deltaLR = 0.5)

# Calculate optimal conditional error
getOptimalConditionalError(
firstStagePValue = c(0.1, 0.2, 0.3), design = design
)

optconerrf documentation built on Sept. 9, 2025, 5:29 p.m.