BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Elisa97
Fluorite | Level 6

Hi everybody!

 

I have a population of 12 patients. I study the absence/presence of a symptom before and after a treatment.

 

I created my contingency table :

 

data tab;
input before after count;
datalines;
0 0 1
0 1 0
1 0 7
1 1 4
;
run;

 

So 1 patient is failure - failure

0 patient is failure - success

7 patients are success - failure

4 patients are success - success.

 

I did an exact mc nemar test :

proc freq data=tab;
tables before*after / nopercent norow nocol agree;
weight Count;
exact McNem;
ods select McNemarsTest;
run;

 

And the p-value is significant. But i want to know the power of my statistical test.

 

So i did this :

proc power;
pairedfreq dist=exact_cond method=exact
test=mcnemar
discproportions = 0.583 | 0
npairs = 12
power = .;
run;

 

Where 7/12 = 0.583 and 0/12 = 0.
As i have a 0 patient failure - success, i can't calculate the power.

 

How can I calculate the power please ?

 

Have a nice day.

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @Elisa97,

 

My ad-hoc approach in similar situations is to replace the offending zero by a very small number such as 1E-9. This seems to work well in your case. With 1E-12 PROC POWER yields a power of 0.81008190495281:

ods output output=pow;
proc power;
pairedfreq dist=exact_cond method=exact
test=mcnemar
discproportions = 0.583 | 1e-12
npairs = 12
power = .;
run;

proc print data=pow;
format power best16.;
run;

 

Of course, it must be checked if the result makes sense: It turns out that the power can be calculated by adding certain probabilities from multinomial distributions and the offending factor, if one of the probabilities is zero, is 0**0. But it's easy to see that these factors can be replaced by 1 (which explains why using very small positive numbers approximates the correct result). In fact, having one of the probabilities exactly zero reduces the number of cases (i.e., multinomial probabilities in the sum I mentioned) considerably and the multinomial probabilities simplify to binomial probabilities. Eventually, the formula for the power boils down to

data _null_;
power=sdf('binom',5,0.583,12);
put power best16.;
run;

Result: 0.8100819049583. (And with 7/12 in place of 0.583: 0.81073569762439).

Whether such a post-hoc power calculation is really useful, is a different question (see, for example, Steve Denham's March 2023 post Re: Power Analysis for Logistic Regression).

View solution in original post

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hi @Elisa97,

 

My ad-hoc approach in similar situations is to replace the offending zero by a very small number such as 1E-9. This seems to work well in your case. With 1E-12 PROC POWER yields a power of 0.81008190495281:

ods output output=pow;
proc power;
pairedfreq dist=exact_cond method=exact
test=mcnemar
discproportions = 0.583 | 1e-12
npairs = 12
power = .;
run;

proc print data=pow;
format power best16.;
run;

 

Of course, it must be checked if the result makes sense: It turns out that the power can be calculated by adding certain probabilities from multinomial distributions and the offending factor, if one of the probabilities is zero, is 0**0. But it's easy to see that these factors can be replaced by 1 (which explains why using very small positive numbers approximates the correct result). In fact, having one of the probabilities exactly zero reduces the number of cases (i.e., multinomial probabilities in the sum I mentioned) considerably and the multinomial probabilities simplify to binomial probabilities. Eventually, the formula for the power boils down to

data _null_;
power=sdf('binom',5,0.583,12);
put power best16.;
run;

Result: 0.8100819049583. (And with 7/12 in place of 0.583: 0.81073569762439).

Whether such a post-hoc power calculation is really useful, is a different question (see, for example, Steve Denham's March 2023 post Re: Power Analysis for Logistic Regression).

Elisa97
Fluorite | Level 6

Thank you very much!

 

Have a nice day!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 2 replies
  • 395 views
  • 1 like
  • 2 in conversation