Compute power of test, or determine parameters to obtain target power for matched case-control studies.
power_mcnemar_test(n = NULL, paid = NULL, psi = NULL, sig.level = 0.05, power = NULL, alternative = c("two.sided", "one.sided"), method = c("normal", "exact", "cond.exact"))
n | Number of observations (number of pairs) |
---|---|
paid | The probability that a case patient is not exposed and that the corresponding control patient was exposed (specifying p_12 in the 2 x 2 table). |
psi | The relative probability that a control patient is not exposed and that the corresponding case patient was exposed compared to the probability that a case patient is not exposed and that the corresponding control patient was exposed (p12 / p21 in the 2x2 table). Also called the discordant proportion ratio |
sig.level | Significance level (Type I error probability) |
power | Power of test (1 minus Type II error probability) |
alternative | One- or two-sided test |
method | Power calculations based on exact or asymptotic test. The default (normal) corresponds to an approximative test, "exact" is the unconditional exact test, while "cond.exact" is a conditional exact test (given fixed n). |
Object of class power.htest
, a list of the arguments
(including the computed one) augmented with method and note elements.
If psi is less than 1 then the two probabilities p_12 and p_21 are reversed.
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.
Duffy, S (1984). Asymptotic and Exact Power for the McNemar Test and its Analogue with R Controls per Case
Fagerland MW, Lydersen S, Laake P. (2013) The McNemar test for binary matched-pairs data: mid-p and asymptotic are better than exact conditional. BMC Medical Research Methodology.
mcnemar.test
# Assume that pi_21 is 0.125 and we wish to detect an OR of 2. # This implies that pi_12=0.25, and with alpha=0.05, and a power of 90% you get power_mcnemar_test(n=NULL, paid=.125, psi=2, power=.9)#> #> McNemar paired comparison of proportions approximate power calculation #> #> n = 247.9973 #> paid = 0.125 #> psi = 2 #> sig.level = 0.05 #> power = 0.9 #> alternative = two.sided #> #> NOTE: n is number of pairs #>power_mcnemar_test(n=NULL, paid=.1, psi=2, power=.8, method="normal")#> #> McNemar paired comparison of proportions approximate power calculation #> #> n = 233.0945 #> paid = 0.1 #> psi = 2 #> sig.level = 0.05 #> power = 0.8 #> alternative = two.sided #> #> NOTE: n is number of pairs #>power_mcnemar_test(n=NULL, paid=.1, psi=2, power=.8)#> #> McNemar paired comparison of proportions approximate power calculation #> #> n = 233.0945 #> paid = 0.1 #> psi = 2 #> sig.level = 0.05 #> power = 0.8 #> alternative = two.sided #> #> NOTE: n is number of pairs #>