Equivalence test for McNemar's test
McNemar's test is described in the Categorical Data talk here.
$$\delta$$ represents the true difference $$p_text{10} - p_text{01}$$ where $$p_text{ij}$$ = P(time 1 = i, time 2 = j) for dichotomous responses measured on each subject at times 1 and 2.
H0: $$\delta$$ $$\leq$$ -t or $$\delta$$ $$\geq$$ t
HA: -t $$\leq$$ $$\delta$$ $$\leq$$ t
|
|
Time 2 |
||||
|
|
- |
+ |
|||
Time 1 |
- |
n00 |
n01 |
|||
|
+ |
n10 |
n11 |
The R code uses the formulae of Wellek (2003) to test if the observed difference in proportions provides sufficient evidence to say that there is a relationship between times 1 and 2 by comparing the difference in proportions to a specified criterion difference 'tdel' between 0 and 1.
$$p_text{01}$$ and $$p_text{10}$$ are estimated using the inputted observed frequencies $$n_text{01}$$ and $$n_text{10}$$ from a sample of size, n. Type II error is beta (usually 0.05).
If ind equals 1 then we reject nonequivalence so -t $$\leq$$ $$\delta$$ $$\leq$$ t otherwise we accept the null hypothesis for the given type II error, beta.
[TYPE INTO R THE DESIRED INPUTS N, DELTA, N10, N01 AND BETA USING VALUES IN FORM BELOW].
n <- 72 tdel <- 0.20 n10 <- 5 n01 <- 4 beta <- 0.05
[THEN COPY AND PASTE THE BELOW INTO R]
tstat <- (sqrt(n)*abs((n10-n01))) / sqrt(n*(n10+n01) - (n10-n01)^2 ) nc <- n^(3)*tdel^2 / (n*(n10+n01) - (n10-n01)^2) cv <- sqrt(qchisq(p=beta,df=1,ncp=nc)) ind <- 0 if (tstat < cv) ind = 1 print(ind)
Reference
Wellek S (2003) Testing statistical hypotheses of equivalence. Chapman & Hall/CRC Press.