# Fishers Exact Test construction

I have a series of binary opinion questions asked of a random selection of people visiting a website. e.g. "Do you support the Death penalty" etc. I also have a number of demographic binary classifiers of the respondents (male/female)(wealth/not wealthy)(liberal/conservative)(college educated/not college educated)(religious/not religious) etc.

What I am interested in is identifying the characteristics that may matter in terms of understanding which classifiers should be considered when predicting the opinions of the people in certain subgroups. That is, for example, if the entire sample is split 30% for/70% against the Death Penalty, but the liberals are 10/90 and conservatives are 40/60, are these classifiers statistically meaningful? or in laymans terms, is political orientation a meaningful input to people opinion about the death penalty.

So my question is, should I measure each classification in my 2x2 table constructed to evaluate Fishers Exact be against the overall mean of the group as a whole, or rather look at the difference in rates between people on each side of the classifier? That is, men v women, as opposed to men v entire population and women v entire population.

Many thanks.

• As @Todd 's answer points out, for Fisher exact or chi-square test of association, the table is constructed with the counts of e.g. men vs. women, not e.g. men vs. total. But other tests will be different --- e.g. prop.test or binom.test in R. Commented Dec 7, 2017 at 23:48
• For your analysis, if you are familiar with regression analysis, you might consider logistic regression. This will allow you to put several of your demographic binary classifiers in to the same model, including interactions among them. So, e.g. liberal men may be different than liberal women, and each different than conservatives. Commented Dec 7, 2017 at 23:51

## 1 Answer

This is a job for a 2x2 table, as the OP suggests. Place your Death Penalty responses in columns and classifiers in the rows. Based on your political classifications and without the Death Penalty percentage as you specify:

$$\begin{array}{c|lcr} \text{} & \text{For} & \text{Against} \\ \hline \text{Liberal} & 10 & 90 \\ \text{Conservative} & 40 & 60 \\ \end{array}$$

The Fisher's exact test or chi-square test will estimate whether row membership determines column membership. In this case whether political view determines death penalty stance.

In R:

 example1 <- matrix(c(10, 90,40,60), ncol=2, byrow=T)
fisher.test(example1) #p-value = 1.23E-06
chisq.test(example1) #p-value = 2.183E-06


I cannot imagine a scenario where separating by "rates between people on each side of the classifier" would be meaningful when Death Penalty opinion and a classifier are tested for association.