chi2_mcnemarbowker(M)

Computes a McNemar-Bowker test using data in matrix M and a significance level of 0.05 (5%). Matrix M must be a contingency table.

chi2_mcnemarbowker(M, alpha)

As above but the significance level is alpha.


See also chi2_mcnemar chi2_kappa chi2_mantel chi2_risk 


Example


A total of 46 teenagers were interviewed about their views on the death penalty; the study found that 15 were in favor of the death penalty, 15 were indifferent about it, and 16 were against it. Afterward, the youths were given lectures and attended seminars on the errors and abuse of the death penalty; a week later they were interviewed again.
The table below shows their opinions before and after:


Before
After
Total
In favor
Indifferent
Against
In favor
5
7
3
15
Indifferent
1
4
10
15
Against
9
2
5
16
Total
15
13
18
46

Notice the second row of the data shows that 11 youths who were indifferent changed their views to in favor (1) and to against(10).

Entering the basic data in a matrix we obtain:

M = ( 5, 7, 3; 1, 4, 10; 9, 2, 5)

/ 5  7  3 \

| 1  4  10 |

\ 9  2  5 /


We now use function chi2_totable to transform the matrix into a proper contingency table

M=chi2_totable(M)

/ "" "" "" "" ""\

| ""  5   7    3  15 |

| ""  1   4   10  15 |

| ""  9   2    5  16 |

\ "" 15  13  18  46 /


Using the function chi2_mcnemarbowker we obtain (5% significance),

chi2_mcnemarbowker(M)


McNemar-Bowker test.

Hypothesis test for changes in response.

Ho : Proportions before and after are the same

Ha : Proportions before and after are not the same

Significance level : 0.05 (5.0%)

Results:

Reject the null hypothesis. (0.)

Test statistics W2 : 12.833333333333332

P-value: 0.005011251317078358