Calculates sample sizes for McNemar’s test (R.W. Payne).
|What to print (
||Method to be used to calculate the power of the McNemar test (
||Significance level at which the test is to be made; default 0.05|
||The required power (i.e. probability of detection) of the test; default 0.9|
||Whether a one- or two-sided test is to be made (
||Sample sizes for which to calculate and print or save the power; default
||Probability of any sort of change|
||Ratio of the two probabilities of change|
||Saves the required sample size|
||Sample sizes for which powers have been calculated|
||Power (i.e. probability of detection) for the various numbers of replicates|
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, with level 1 usually representing a negative response, and level 2 a positive response. The test is based on 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 assesses the equality of
D, which represent the changes from positive to negative, and negative to positive, respectively. See procedure
MCNEMAR or Siegel (1956), pages 63-67.
In its original form, the test leads to a chi-square test. However, this may be inaccurate when there are small numbers of subjects. Consequently procedure
MCNEMAR also provides an exact probability (based on the binomial distribution). Similarly
SMCNEMAR has an option,
PRMETHOD, to select whether you want to calculate the power of the test by approximating the probabilities by a Normal distribution, or using the binomial distribution as in the exact calculation (settings
exact, respectively). The default is
To calculate the sample size,
SMCNEMAR needs to know the overall probability of change (i.e. the probability of a subject being amongst those in either
D), and the ratio of the probabilities of the two types of change (
D). These are specified by parameters
RATIOPROBABILITIES, respectively. By default the calculations are done for a one-sided test (testing for evidence that the change is in a specific direction (e.g. negative to positive). However, you can set option
TMETHOD=twosided for a two-sided test (testing for either type of change). The significance level for the test is specified by the
PROBABILITY option (default 0.05 i.e. 5%). The required probability for detection of the change (that is, the power of the test) is specified by the
POWER option (default 0.9). The sample size can be saved using the
||to print the required number of replicates in each sample (i.e. the size of each sample);|
||to print a table giving the power (i.e. probability of detection) provided by a range of numbers of replicates.|
By default both are printed.
The replications and corresponding powers can also be saved, in variates, using the
VPOWER parameters. The
REPLICATION option can specify the replication values for which to calculate and print or save the power; if this is not set, the default is to take 11 replication values centred around the required number of replicates.
The sample size is first calculated by taking a Normal approximation to the probabilities:
NREPLICATES = CEILING( (\
( ( EDNORMAL(POWER) * SQRT(prob * (1 - prob))\
- EDNORMAL(alpha) * 0.5 )\
/ (prob - 0.5) )**2 ) / CHANGEPROBABILITY)
alpha is the significance level for the null hypothesis, and
prob is the minimum of
1 / (1 + RATIOPROBABILITIES)
RATIOPROBABILITIES / (1 + RATIOPROBABILITIES)
With the exact calculation, this provides an initial estimate for a search for the required size, with probabilities calculated using the binomial distribution. Note: the exact calculation generally leads to sample sizes about 10% larger than those derived using the Normal approximation.
Siegel S. (1956). Nonparametric Statistics for the Behavioural Sciences. McGraw-Hill, New York.
Commands for: Design of experiments.
CAPTION 'SMCNEMAR example'; STYLE=meta SMCNEMAR CHANGEPROBABILITY=0.7; RATIOPROBABILITIES=2