Description Usage Arguments Details Value Note Author(s) References See Also Examples
View source: R/powerDiagnosticTest.R
Compute sample size, power, delta, or significance level of a diagnostic test for an expected sensititivy or specificity.
1 2 3 4 5 
sens 
Expected sensitivity; either 
spec 
Expected specificity; either 
n 
Number of cases if 
delta 

sig.level 
Significance level (Type I error probability) 
power 
Power of test (1 minus Type II error probability) 
prev 
Expected prevalence, if 
method 
exact or asymptotic formula; default 
NMAX 
Maximum sample size considered in case 
Either sens
or spec
has to be specified which leads to
computations for either cases or controls.
Exactly one of the parameters n
, delta
, sig.level
,
and power
must be passed as NULL
, and that parameter is determined
from the others. Notice that sig.level
has a nonNULL
default
so NULL
must be explicitly passed if you want to compute it.
The computations are based on the formulas given in the Appendix of Flahault et al. (2005). Please be careful, in Equation (A1) the numerator should be squared, in equation (A2) and (A3) the second exponent should be ni and not i.
As noted in Chu and Cole (2007) power is not a monotonically increasing
function in n but rather saw toothed (see also Chernick and Liu (2002)).
Hence, in our calculations we use the more conservative approach II);
i.e., the minimum sample size n
such that the actual power is
larger or equal power
andsuch that for any sample size larger
than n
it also holds that the actual power is larger or equal
power
.
Object of class "power.htest"
, a list of the arguments
(including the computed one) augmented with method
and
note
elements.
uniroot
is used to solve power equation for unknowns, so
you may see errors from it, notably about inability to bracket the
root when invalid arguments are given.
Matthias Kohl Matthias.Kohl@stamats.de
A. Flahault, M. Cadilhac, and G. Thomas (2005). Sample size calculation should be performed for design accuracy in diagnostic test studies. Journal of Clinical Epidemiology, 58(8):859862.
H. Chu and S.R. Cole (2007). Sample size calculation using exact methods in diagnostic test studies. Journal of Clinical Epidemiology, 60(11):12011202.
M.R. Chernick amd C.Y. Liu (2002). The sawtoothed behavior of power versus sample size and software solutions: single binomial proportion using exact methods. Am Stat, 56:149155.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  ## see n2 on page 1202 of Chu and Cole (2007)
power.diagnostic.test(sens = 0.99, delta = 0.14, power = 0.95) # 40
power.diagnostic.test(sens = 0.99, delta = 0.13, power = 0.95) # 43
power.diagnostic.test(sens = 0.99, delta = 0.12, power = 0.95) # 47
power.diagnostic.test(sens = 0.98, delta = 0.13, power = 0.95) # 50
power.diagnostic.test(sens = 0.98, delta = 0.11, power = 0.95) # 58
## see page 1201 of Chu and Cole (2007)
power.diagnostic.test(sens = 0.95, delta = 0.1, n = 93) ## 0.957
power.diagnostic.test(sens = 0.95, delta = 0.1, n = 93, power = 0.95,
sig.level = NULL) ## 0.0496
power.diagnostic.test(sens = 0.95, delta = 0.1, n = 102) ## 0.968
power.diagnostic.test(sens = 0.95, delta = 0.1, n = 102, power = 0.95,
sig.level = NULL) ## 0.0471
## yields 102 not 93!
power.diagnostic.test(sens = 0.95, delta = 0.1, power = 0.95)

Diagnostic test exact power calculation
sens = 0.99
n = 40
n1 = 40
delta = 0.14
sig.level = 0.05
power = 0.95
prev = NULL
NOTE: n is number of cases, n1 is number of controls
Diagnostic test exact power calculation
sens = 0.99
n = 43
n1 = 43
delta = 0.13
sig.level = 0.05
power = 0.95
prev = NULL
NOTE: n is number of cases, n1 is number of controls
Diagnostic test exact power calculation
sens = 0.99
n = 47
n1 = 47
delta = 0.12
sig.level = 0.05
power = 0.95
prev = NULL
NOTE: n is number of cases, n1 is number of controls
Diagnostic test exact power calculation
sens = 0.98
n = 50
n1 = 50
delta = 0.13
sig.level = 0.05
power = 0.95
prev = NULL
NOTE: n is number of cases, n1 is number of controls
Diagnostic test exact power calculation
sens = 0.98
n = 58
n1 = 58
delta = 0.11
sig.level = 0.05
power = 0.95
prev = NULL
NOTE: n is number of cases, n1 is number of controls
Diagnostic test exact power calculation
sens = 0.95
n = 93
n1 = 93
delta = 0.1
sig.level = 0.05
power = 0.956769
prev = NULL
NOTE: n is number of cases, n1 is number of controls
Diagnostic test exact power calculation
sens = 0.95
n = 93
n1 = 93
delta = 0.1
sig.level = 0.04963266
power = 0.95
prev = NULL
NOTE: n is number of cases, n1 is number of controls
Diagnostic test exact power calculation
sens = 0.95
n = 102
n1 = 102
delta = 0.1
sig.level = 0.05
power = 0.9682165
prev = NULL
NOTE: n is number of cases, n1 is number of controls
Diagnostic test exact power calculation
sens = 0.95
n = 102
n1 = 102
delta = 0.1
sig.level = 0.04708589
power = 0.95
prev = NULL
NOTE: n is number of cases, n1 is number of controls
Diagnostic test exact power calculation
sens = 0.95
n = 102
n1 = 102
delta = 0.1
sig.level = 0.05
power = 0.95
prev = NULL
NOTE: n is number of cases, n1 is number of controls
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.