I'm trying to figure out how to correctly populate the "discproportions=" option in PROC POWER for McNemar's test. I've looked in the documentation (https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_power_sect0...) but am still struggling to understand.
For context, I'm on version 9.4, my data is below, along with with 2x2 table and McNemar's test being requested from PROC FREQ, and IML syntax to make sure I'm clear on what's happening behind the scenes:
data study;
input Subject Before After;
datalines;
1 1 1
2 0 1
3 0 0
4 0 1
5 1 1
6 0 0
7 0 1
8 1 1
9 0 1
10 1 1
11 0 0
12 1 0
13 0 1
14 1 0
15 0 0
16 1 1
17 0 1
18 1 1
19 0 0
20 0 1
21 1 1
22 0 1
23 0 0
24 1 1
25 0 1
;
run;
proc freq data=work.study;
tables Before*After / agree nocol norow nopercent;
run;
proc iml;
dis1=9;
dis2=2;
chisq=((dis1-dis2)**2)/(dis1+dis2);
pvalue=1-probchi(chisq,1);
print chisq, pvalue;
quit;
The p-value is <0.05, but I suspect power is less than ideal with a sample size of 25. Here's where my code in PROC POWER:
proc power;
pairedfreq dist=normal method=connor
test=mcnemar
discproportions = <??> | <??>
npairs = 25
power = .;
run;
I'm unclear how to calculate the discordant proportions from the 2x2 table, and how they are arranged in the discproportions= statement. Figuring that power will be pretty low with 25 subjects, ultimately I want to rearrange the npairs= and power= statements to determine how many subjects are needed to attain a power of 0.90.
Thanks in advance for any guidance on this (especially at 5:00 pm on a Friday!)
My guess would be
proc freq data=work.study;
tables Before*After / nocol norow chisq;
run;
Table of Before by After Before After Frequency| Percent | 0| 1| Total ---------+--------+--------+ 0 | 6 | 9 | 15 | 24.00 | 36.00 | 60.00 ---------+--------+--------+ 1 | 2 | 8 | 10 | 8.00 | 32.00 | 40.00 ---------+--------+--------+ Total 8 17 25 32.00 68.00 100.00
to get the discordant (off-diagonal) proportions, and
proc power;
pairedfreq dist=normal method=connor
test=mcnemar
discproportions = (.36 .08)
npairs = 25
power = .;
run;
McNemar Normal Approximation Test Fixed Scenario Elements Distribution Asymptotic normal Method Connor normal approximation Success-Failure Proportion 0.36 Failure-Success Proportion 0.08 Number of Pairs 25 Number of Sides 2 Alpha 0.05 Computed Power Power 0.566
to get the power.
My guess would be
proc freq data=work.study;
tables Before*After / nocol norow chisq;
run;
Table of Before by After Before After Frequency| Percent | 0| 1| Total ---------+--------+--------+ 0 | 6 | 9 | 15 | 24.00 | 36.00 | 60.00 ---------+--------+--------+ 1 | 2 | 8 | 10 | 8.00 | 32.00 | 40.00 ---------+--------+--------+ Total 8 17 25 32.00 68.00 100.00
to get the discordant (off-diagonal) proportions, and
proc power;
pairedfreq dist=normal method=connor
test=mcnemar
discproportions = (.36 .08)
npairs = 25
power = .;
run;
McNemar Normal Approximation Test Fixed Scenario Elements Distribution Asymptotic normal Method Connor normal approximation Success-Failure Proportion 0.36 Failure-Success Proportion 0.08 Number of Pairs 25 Number of Sides 2 Alpha 0.05 Computed Power Power 0.566
to get the power.
Thanks, PGStats. That was my original thought too, but wasn't sure if the discordant proportions were across all of the subjects, or some particular subset. Since you have to specify the number of subjects in npairs=, it makes sense. Maybe it is just that straightforward. Much appreciated!
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.