McNemar's test

The McNemar test is a statistical test for paired samples in which a dichotomous trait is considered, as can happen in a fourfold table, for example. Paired samples are then, if there is a connection between the observations, one in the context of medical statistics to patients makes a before- and-after comparison, for example.

Since the test statistic of the McNemar test is easy to compute the test is jokingly referred to as " frugal Scot ".

  • 3.1 smoking
  • 3.2 Car-free Sunday

Mathematical formulation

The McNemar test checks for an associated sample, whether a change has occurred. The null hypothesis is that there was no change and accordingly the alternative hypothesis that there was a change. If there were no changes that would have to be or. For the probabilities of occurrence of etc. the following mathematical formulation of hypotheses:

Or the equivalent hypotheses

Exact test

For the exact test observations " left" and " right above " in the contingency considered as random draws with the two possible outcomes of " left" and " top right ". If the probability that an observation " bottom left " lands, then translate the hypotheses of the McNemar test to the hypothesis of a binomial

The test statistic: "Number of observation on the top right " is then binomial distributed with ( similarly for ).

The exact test is, for example, used in SPSS when calling the McNemar test when.

Test Statistics

McNemar (1947 ) used a test to the test problem to solve. Under the null hypothesis, the expected cell frequencies are just so results in the test statistic

This test statistic is approximate distributed with a degree of freedom.

Yates correction

Since the frequencies are discrete, the test statistic is distributed discretely. Since the distribution is a distribution constant, there is an approximation error. In order to reduce this approximation has proposed a general continuity correction Yates. This results in the following test statistic:

The subtrahend 0.5 is the so-called Yates correction. Assuming a symmetric distribution of the two variables to be tested or sampling, improves the reduction of the amount of deviation ( bc) by 0.5, the approximation of the calculated - distributed test statistic on the results of the Fisher exact test.

It is especially for smaller sample required ( ) and can be omitted in larger samples.

Edwards correction

The Yates correction was originally developed for 2x2 crosstabs. In McNemar test, however, a 2x1 crosstab is in fact considered and it can be shown that the above test statistics strongly corrected with the Yates correction. Therefore, the correction is often used by Edwards:

For example, in SPSS and R Edwards correction is used in the McNemar test with continuity correction. The question of the size of the subtrahend for the continuity correction plays anyway only for small sample sizes involved.

Procedure

To compare whether the frequencies in the samples differ significantly, considering the ratio of the difference between the two samples that had different results in two samples, in the example, b and c to the sum of the two values ​​. The determined test statistic is compared with the values ​​of the distribution for one degree of freedom and the corresponding level of confidence (typically 95 % confidence level and a 5% level of significance ). The exact calculation rule is:

If the calculated test statistic equal to or greater than the comparison value of the distribution (for 1 degree of freedom and 95 % quantile, for example, 3.84 ), one can assume that a statistically significant difference between the two samples is and the a result ( positive or negative) so frequently occurs in one of the groups that a purely random difference with great certainty ( at 95 % confidence level, the resulting statement is true, for example, in 95 % of cases with the reality match ) can be excluded.

Whether this is an improvement or deterioration of significance, the test does not tell itself. For the McNemar test can be performed only on two sides ( it checks if changes are made - not whether increasing or reducing the frequency of occur ). The direction of change, however, can be easily deduced from the data, depending on whether greater frequencies occur in field b or c.

Lying continuous data before or discrete data with too many feature classes, one often uses the Mediandichotomisierung in order to verify the data with the McNemar test can.

Example

Smoker

It should be investigated whether an anti - smoking campaign successfully reduced the number of smokers. For this first one recorded in sampling the number of smokers before and after the campaign. In the above table are sample 1 and sample 2, the measurement before the measurement after the campaign. In order to compare now is whether there was a significant change in the number of smokers has shown only interested in the " changer ", ie the people whose smoking behavior has changed between the two measurements. These frequencies are given in the table fields b and c. If the campaign had no influence on the smoking habits, there should be random or störeinflussbedingt as many smokers who are non-smokers, as Non smoking that become smokers. It is this basic idea is from the McNemar test checks (see above formula ).

Alone, a significant difference of the test statistic of the McNemar test, however, can not readily be concluded directly that the number of smokers has decreased, because as they say only undirected examined for significant differences, the McNemar test therefore means first only that a change has occurred, but not the direction. This means that even if the number of smokers had increased significantly by the campaign, the McNemar test would show a difference here. In order to avoid such misinterpretations must be the resulting values ​​for b and c closer look. In this case, b would have to be much smaller than c, because c stands for the smokers who have become non-smokers.

Car-free Sunday

40 people were interviewed in front of a car-free Sunday, whether you are for or against a car-free Sunday. After a car-free Sunday, the same people are interviewed again ( = connected sample). The aim is to examine whether the experience of a car-free Sundays has caused a significant change in the view. The 8 or 11 respondents whose opinion has not changed, do not say anything about possible changes in the view. It is checked whether the changes of this by contrast, or by contrast, keep the balance after it or not:

With the following test values ​​and yield:

  • Or
  • .

For a significance level of results in a critical value of. Since both test values ​​and are greater than the critical value, the null hypothesis is rejected in both cases. That there is a significant change in the views.

When exact test " number of modified opinions for that purpose by contrast, " under the above null hypothesis is distributed binomial, thus follows a binomial distribution ( similarly for ). The critical values ​​are obtained here for 6 and 15, ie is located or in the interval, then the null hypothesis can not be rejected. Even with the exact test that is, the null hypothesis is rejected.

560443
de