Performs McNemar’s test for the significance of changes (R.W. Payne & D.A. Murray).
|Controls printed output (
||Type of test required (
||Factor containing the responses obtained before the treatment (with 1 indicating a positive response) or two-by-two table (classified by factors representing the two occasions of testing) summarizing the responses before and after treatment|
||Factor containing the responses obtained after the treatment (need not be specified if
||Saves the test statistic|
||Saves the probability value|
The McNemar test is useful for analysing studies where subjects are assessed before and after a treatment. The response on each occasion is assumed to be categorized by a factor with two levels. Usually level 1 represents a negative response, and level 2 a positive response. The test assesses the consistency of the responses on the two occasions. By default the test is assumed to be two-sided (that is, changes in the overall response from level 1 to level 2 or from level 2 to level 1 are equally of interest). However, you can set the
METHOD option to
greaterthan for a one-sided test of the null hypothesis that the number of level 2 responses is not increasing (i.e. that the overall response is not becoming more positive), or to
lessthan for a test of the null hypothesis that the number of level 2 responses is not decreasing.
The data for the test can be supplied as two variates (one for each occasion) using the
Y2 parameters. Positive responses are represented by the value one, and other values are taken to indicate negative responses. (So the variates might be formed from logical tests, for example using the
.EQS. operators.) Alternatively, you can set
Y1 to a two-by-two table classified by a factor representing the assessments before the treatment and another representing the assessments after the treatment.
In its original form, the test leads to a chi-square test (see the Method section). However, this may be inaccurate when there are small numbers of subjects. Consequently Genstat also provides an exact probability (based on the binomial distribution). The value of the statistic can be saved using the
STATISTIC parameter, and the exact probability can be saved using the
test to print the test statistic and probabilities, and
table to print the table of responses.
The default is
The test is constructed by first forming a table giving the numbers of subjects giving each combination of responses over the two occasions. Suppose that the table contains the values
D as below:
The test statistic is a chi-square statistic for assessing the equality of
D, which represent the changes from positive to negative, and negative to positive, respectively. Including the continuity correction of Yates (1934), leads to the calculation
Statistic = ((ABS(A - D) - 1)**2) / (A + D)
see Siegel (1956), pages 63-67. Under the null hypothesis, this has a chi-square distribution with one degree of freedom. The alternative exact probability calculation assumes that, under the null hypothesis, the numbers
D are generated by a binomial distribution with
D samples and probability 0.5.
Y2 are restricted the test is made on only the units not excluded by the restriction.
Siegel S. (1956). Nonparametric Statistics for the Behavioural Sciences. McGraw-Hill, New York.
Yates, F. (1934). Contingency tables involving small numbers and the chi-square test. Supplement to the Journal of the Royal Statistical Society, 1, 217-235.
Commands for: Basic and nonparametric statistics.
CAPTION 'MCNEMAR example',\ !t('Study to assess whether children''s object of initiation tends',\ 'to change from adult to child between first and thirtieth day',\ 'at nursery school (Siegel 1956, Nonparametric Statistics for',\ 'the Behavioural Sciences, page 66).'); STYLE=meta,plain FACTOR [LABELS=!t('adult','child')] First,Thirtieth TABLE [CLASSIFICATION=First,Thirtieth; VALUES=4,14,4,3] Object PRINT Object; DECIMALS=0 MCNEMAR [METHOD=greaterthan] Object