8.12 Fisher’s exact test

A commonly stated assumption of the chi-squared test is the requirement to have an expected count of at least 5 in each cell of the 2x2 table. For larger tables, all expected counts should be \(>1\) and no more than 20% of all cells should have expected counts \(<5\). If this assumption is not fulfilled, an alternative test is Fisher’s exact test. For instance, if were are testing across a 2x4 table created from our age.factor variable and status_dss, then we receive a warning.

## Warning in chisq.test(.): Chi-squared approximation may be incorrect
## 
##  Pearson's Chi-squared test
## 
## data:  .
## X-squared = 2.0198, df = 3, p-value = 0.5683

Switch to Fisher’s exact test

## 
##  Fisher's Exact Test for Count Data
## 
## data:  .
## p-value = 0.5437
## alternative hypothesis: two.sided