Performs McNemar’s test for the significance of changes (R.W. Payne & D.A. Murray).
Options
PRINT = string tokens |
Controls printed output (test , table ); default test |
---|---|
METHOD = string token |
Type of test required (twosided , greaterthan , lessthan ); default twos |
Parameters
Y1 = factors or tables |
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 |
---|---|
Y2 = factors |
Factor containing the responses obtained after the treatment (need not be specified if Y1 is a table) |
STATISTIC = scalars |
Saves the test statistic |
PROBABILITY = scalars |
Saves the probability value |
Description
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 Y1
and 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 .EQ.
or .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 PROBABILITY
parameter.
The PRINT
option controls printed output with settings:
test
to print the test statistic and probabilities, and
table
to print the table of responses.
The default is PRINT=test
.
Options: PRINT
, METHOD
.
Parameters: Y1
, Y2
, STATISTIC
, PROBABILITY
.
Method
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 A
, B
, C
and D
as below:
Second occasion | ||
First occasion | negative | positive |
negative | C |
D |
positive | A |
B |
The test statistic is a chi-square statistic for assessing the equality of A
and 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 A
and D
are generated by a binomial distribution with A
+D
samples and probability 0.5.
Action with RESTRICT
If Y1
or Y2
are restricted the test is made on only the units not excluded by the restriction.
References
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.
See also
Procedures: CATRENDTEST
, QCOCHRAN
, SMCNEMAR
.
Commands for: Basic and nonparametric statistics.
Example
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