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

The problem is a column sums to zero.  Even using weight statement with zeros option no statistics is calculated.  Calculating by hand, we expect to get 100% (14/14) vs 100% (8/8) p-value=1.

data test;
input Type $ Y $ count;
datalines;
A Y 14
A N 0
J Y 8
J N 0
;
run;

proc freq data=test;
weight count /zeros;
tables Type*Y /fisher;
run;

 

Row or column sum zero. No statistics computed for this table.

Sample Size = 22

1 ACCEPTED SOLUTION

Accepted Solutions
SAS_Rob
SAS Employee

I am not sure you can actually define Fisher's Exact test when you have a zero row/column. 

There are two ways you can look at this, although none of the references for Fisher's exact test define a p-value when there is a row/col total that is 0.

 

First, you can treat as the null distribution. The problem is that in a 2x2 case you are essentially working under the assumption of 2 independent binomials.  This requires p>0.  The distribution would not be defined when either (or both) p1=0 or p2=0.

 

Even if you ignore this and attempted to define it, you would be dealing with a degenerative case which is not very useful.  The test is computed by conditioning on the (observed) marginal totals of the contingency table. For a 2x2 table, if one row or column has a total frequency of zero, then the observed table is the only table that can be constructed with the observed marginals. This would be a degenerate hypergeometric distribution, which can take only a single value. Because there’s only one possible table, then the probability of this table would equal 1 in the fixed-margin framework.  So you could define the p-value as 1, but that is not very useful and would be contrary to the generally accepted approach in the literature.

View solution in original post

3 REPLIES 3
SAS_Rob
SAS Employee

I am not sure you can actually define Fisher's Exact test when you have a zero row/column. 

There are two ways you can look at this, although none of the references for Fisher's exact test define a p-value when there is a row/col total that is 0.

 

First, you can treat as the null distribution. The problem is that in a 2x2 case you are essentially working under the assumption of 2 independent binomials.  This requires p>0.  The distribution would not be defined when either (or both) p1=0 or p2=0.

 

Even if you ignore this and attempted to define it, you would be dealing with a degenerative case which is not very useful.  The test is computed by conditioning on the (observed) marginal totals of the contingency table. For a 2x2 table, if one row or column has a total frequency of zero, then the observed table is the only table that can be constructed with the observed marginals. This would be a degenerate hypergeometric distribution, which can take only a single value. Because there’s only one possible table, then the probability of this table would equal 1 in the fixed-margin framework.  So you could define the p-value as 1, but that is not very useful and would be contrary to the generally accepted approach in the literature.

Rick_SAS
SAS Super FREQ

My two cents: Rob's third paragraph ("degenerative case") is the argument to use.

 

I think if p2=0, you can still define Fisher's exact test, except you have to change the rules. Now you have what is known as a "structural zero" (the event can never happen) rather than a sampling zero (the event did not happen for the observed data). In this event, the exact test needs to account for the fact that the cell (or cells) must always be zero. For more information, see p. 15-17 of Wicklin (2010).

 

It sounds like you think that these are sampling zeros rather than structural zeros, so you can either accept Rob's advice or (even better!) get more data.

LzyButEfficient
Calcite | Level 5

Thank you both for the inputs.  For reference, this was subgroup analysis from a larger study, and these are indeed sampling zeros. 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3 replies
  • 2402 views
  • 1 like
  • 3 in conversation