BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ahmed_Hegazy
Fluorite | Level 6
How do you analyse and obtain a p-value from a 2*2 table examining a binary outcome that is paired, when one cell has zero events?

To clarify, I was looking at the success rate of obtaining an adequate image, using two different ultrasound windows, in the same participant. Then we repeated this experiment for 30 different participants.

So each participant had the two views attempted, and the success rates of obtaining a good view for each attempt was recorded. So the data is paired, and our results are as follows:
Success Failure
View 1 30 0
View 2 26 4

My understanding is that I cannot run a Fisher’s exact test as the data is not independent. And it will not run anyways with a zero value cell.

So I tried rearranging the data and running a McNemar test.

View 2
Success Failure
View 1 Success 26 4
Failure 0 0

But the McNemar would not run because of the zero value in cell c.

I needed a p-value for these results and I’m at a loss as to what to do! I use SAS for analysis. Any pointers would be much appreciated.
1 ACCEPTED SOLUTION

Accepted Solutions
Miracle
Barite | Level 11

Did you run an exact McNemar test?

data have;
input view success count ;
datalines;
1 1 30
1 0 0
2 1 26
2 0 4
;
run;
proc freq data=have; 
	weight count;
	tables view*success / agree;
	exact mcnem;
run;

View solution in original post

9 REPLIES 9
Ksharp
Super User

Did you try logistic regression via PROC CATMOD ?

or POINT option of PROC FREQ.

 

data x;
input x $ Y $ w;
cards;
a a 30
a b 0
b a 26
b b 4
;
run;
proc freq data=x;
table x*y/fisher;
exact fisher /point;
weight w;
run;
Miracle
Barite | Level 11

Did you run an exact McNemar test?

data have;
input view success count ;
datalines;
1 1 30
1 0 0
2 1 26
2 0 4
;
run;
proc freq data=have; 
	weight count;
	tables view*success / agree;
	exact mcnem;
run;
Reeza
Super User
@Miracle is correct, when you have 0 cells, you can do an exact test. You may want to pay close attention to your estimates however, especially the confidence intervals so that they don't go below 0.
Ahmed_Hegazy
Fluorite | Level 6

Thank you @Miracle!

 

Much appreciate you pointing me in the right direction.

 

My data set is paired and binary, and has multiple zero cells. So definitely a McNemar exact test and I specified the zeros option, so that SAS recognizes the zero cells in the calculation.

 

After rearranging the data set appropriately for a McNemar test, it looked like this.

Capture.JPG

 

The code to run in this situation is:

data viewcomp;
input view1 $ view2 $ count;
cards;
Success Success 26
Success Failure 4
Failure Success 0
Failure Failure 0
;
run;

proc freq data = viewcomp;
weight count / zeros;
tables view1*view2 / agree;
exact mcnem;
run; 
Reeza
Super User

 

@Ahmed_Hegazy You should have marked @Miracle answer as correct, not your own.

Ahmed_Hegazy
Fluorite | Level 6

@Miracletakes credit for pointing me in the right direction with the exact test, so happy to do that.

For future reference, and for who-ever reads this post I will point out the following. The correct data arrangement for this answer stem is presented in @Ahmed_Hegazyanswer. In addition, the zeros statement makes SAS use the zero cell for the calculation. So the SAS code presented in my answer is the one to be used for this stem.@Miracle is to be thanked (profusely) for his contribution.

Reeza
Super User

You presented two tables, see your initial post - they are different outcomes. 

 

He used the first one...there's really no way to have known which one was correct, after all, it's your data. 

 

 

Ahmed_Hegazy
Fluorite | Level 6
In the stem, I mention rearranging the data to run a McNemar test. This is key to getting the right result. And this is the table to be used.

The first table would be appropriate for a running a Fisher’s exact or Chi square with independent outcomes, which is not applicable to this scenario.
Miracle
Barite | Level 11

Yes @Ahmed_Hegazy, you are correct in terms of the data structure to do the tests.

We always learn from each other Smiley Happy

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 9 replies
  • 7822 views
  • 9 likes
  • 4 in conversation