mcnemar.pow | R Documentation |
Given a specified alternative distribution, this function computes the exact power for NcNemar's Test
mcnemar.pow(n, pdisc, delta, alpha = 0.025)
n |
The total sample size |
pdisc |
The combined proportion of discordant pairs |
delta |
The difference in the discordant cell rates (factor 1 pos and factor 2 neg minus factor 1 neg and factor 2 pos. |
alpha |
The one-sided type I error of the test |
When two binary (for convenience, called positive vs. negative) factors are measured on the same set of subjects, McNemar's test can be used to test whether the marginal proportions positive for the two factors are the same. For example, this could be of interest if the same quantity is measured before and after treatment, or if two different assays supposedly measuring the same quantity are being compared.
For the values of the two factors, let p11=the proportion of the n
subjects positive for both, p22= the proportion negative for both, p12=the
proportion positive for factor 1 and negative for 2, and p21= the proportion
negative for 1 and positive for 2, where then p11+p22+p21+p12=1. In terms
of these parameters, the input quantities are pdisc
= p12+p21 and
delta
= p12-p21. If an alternative with p21>p12 is of interest, then
delta
should be negative.
McNemar's test is a conditional test of H0: p12=p21 (or equivalently the
marginal probabilities p11+p12 = p11+p21) based on the discordant pairs.
For the exact conditional test of one-sided size alpha
, this function
uses the marginal distribution of the number of discordant pairs under the
specified distribution and the conditional distribution of the number
positive for factor 1 and negative for factor 2 under the null and the
alternative to determine the critical region of the test (under the null)
and the exact unconditional power (under the specified alternative).
A vector giving the values of n
, p12, p21, the attained exact
size, the exact power, and Mietinen's approximation (Biometrics, 1968, p343)
to the power.
Bob Gray
mcnemar.pow(100, 0.9, 0.2, delta = 0.095)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.