Kopecky K and Green S (2012). Noninferiority trials. In: Handbook of Statistics in Clinical Oncology. Crowley J and Hoering A, eds. CRC Press, Boca Raton, FL USA.
This program calculates the required sample size for a two-arm non-inferiority design with a binomial outcome. N is calculated by the following formula for specified power = 100(1 - \(\beta\))% and the true success probabilities are \(P_{E}\) and \(P_{S}\): \[ N = [\frac{Z_{\alpha/2} + Z_{\beta}}{M + (P_{E} - P_{S})}]^2 * [\frac{P_{E}(1 - P_{E})}{K_{E}} + \frac{P_{S}(1 - P_{S})}{1 - K_{E}}] \] where
The program is written in R.
View Code
function(alpha_level, power_level, margin, p_success_E, p_success_S, k_E)
{
za = qnorm(alpha_level, lower.tail = FALSE)
zb = qnorm(power_level)
n = ((za + zb) / (margin + p_success_E - p_success_S))^2 * (((p_success_E * (1 - p_success_E)) / k_E) + ((p_success_S * (1 - p_success_S)) / (1 - k_E)))
result = list(n = round(n, digits = 0))
return(jsonlite::toJSON(result, pretty = TRUE))
}