View source: R/power.williams.test.R
power.williams.test | R Documentation |
Compute the power of a Williams' test, or determine parameters to obtain a target power.
power.williams.test(n = NULL, k, delta, sd = 1, power = NULL, ...)
n |
number of observations (per group). |
k |
number of treatment groups. |
delta |
clinically meaningful minimal difference (between a treatment group and control). |
sd |
common standard deviation. |
power |
power of test (1 minus Type II error probability). |
... |
further arguments, currently ignored. |
Exactly one of the parameters n
or power
must be passed as NULL
, and that
parameter is determined from the others.
The function has implemented the following Eq. in order to estimate power (Chow et al. 2008):
1 - \beta = 1 - \Phi \left(T_{K \alpha v} -
|\Delta| / \sigma \sqrt{2/n}\right)
with |\Delta|
the clinically meaningful minimal difference,
T_{K \alpha v}
the critical Williams' t-statistic
for \alpha = 0.05
, v = \infty
degree of freedom
and \Phi
the probability function of the standard normal function.
The required sample size (balanced design) is estimated based on the expression as given by the PASS manual, p. 595-2:
n = 2 \sigma^2 ~ \left(T_{K \alpha v} + z_{\beta} \right)^2 ~ / ~ \Delta^2
Object of class ‘power.htest
’, a list of the arguments
(including the
computed one) augmented with method and note elements.
The current function calculates power for sig.level = 0.05
significance level (Type I error probability) only (one-sided test).
Chow, S.-C., Shao, J., Wan, H., 2008, Sample Size Calculations in Clinical Research, 2nd ed, Chapman & Hall/CRC: Boca Raton, FL.
optimise
williamsTest
## Chow et al. 2008, p. 288 depicts 53 (rounded),
## better use ceiling for rounding
power.williams.test(power = 0.8, k = 3, delta = 11, sd = 22)
power.williams.test(n = 54, k = 3, delta = 11, sd = 22)
## PASS manual example:
## up-rounded n values are:
## 116, 52, 29, 14, 8 and 5
## according to PASS manual, p. 595-5
D <- c(10, 15, 20, 30, 40, 50)
y <- sapply(D, function(delta) {
power.williams.test(power = 0.9, k = 4, delta = delta, sd = 25)$n
})
ceiling(y)
## Not run:
## compare with power.t.test
## and bonferroni correction
power.t.test(power = 0.9, delta = 50, sd = 25,
sig.level = 0.05 / 4, alternative = "one.sided")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.