# power.diagnostic.test: Power calculations for a diagnostic test In MKmisc: Miscellaneous Functions from M. Kohl

## Description

Compute sample size, power, delta, or significance level of a diagnostic test for an expected sensititivy or specificity.

## Usage

 ```1 2 3 4 5``` ```power.diagnostic.test(sens = NULL, spec = NULL, n = NULL, delta = NULL, sig.level = 0.05, power = NULL, prev = NULL, method = c("exact", "asymptotic"), NMAX = 1e4) ```

## Arguments

 `sens` Expected sensitivity; either `sens` or `spec` has to be specified. `spec` Expected specificity; either `sens` or `spec` has to be specified. `n` Number of cases if `sens` and number of controls if `spec` is given. `delta` `sens`-`delta` resp. `spec`-`delta` is used as lower confidence limit `sig.level` Significance level (Type I error probability) `power` Power of test (1 minus Type II error probability) `prev` Expected prevalence, if `NULL` prevalence is ignored which means `prev = 0.5` is assumed. `method` exact or asymptotic formula; default `"exact"`. `NMAX` Maximum sample size considered in case `method = "exact"`.

## Details

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 non-`NULL` 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 n-i 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`.

## Value

Object of class `"power.htest"`, a list of the arguments (including the computed one) augmented with `method` and `note` elements.

## Note

`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.

## Author(s)

Matthias Kohl Matthias.Kohl@stamats.de

## References

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):859-862.

H. Chu and S.R. Cole (2007). Sample size calculation using exact methods in diagnostic test studies. Journal of Clinical Epidemiology, 60(11):1201-1202.

M.R. Chernick amd C.Y. Liu (2002). The saw-toothed behavior of power versus sample size and software solutions: single binomial proportion using exact methods. Am Stat, 56:149-155.

`uniroot`

## Examples

 ``` 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) ```

### Example output

```     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
```

MKmisc documentation built on Aug. 8, 2021, 5:06 p.m.