# How to test a null hypothesis regarding 2 dichotomous variables?

After an interesting lecture on Bayesian statistics (research master), all 4 males went immediately to the (female) teacher to ask questions. The 8 females did not.

I am interested in how to test a two-tailed significance null hypothesis with this, in R.

H0: no difference between males and females in talking to teacher yes/no

H1: difference between males and females in talking to teacher yes/no

What is the correct test? I have a difficulty with this since:

• unequal group length
• should we use 2 variables? (male/female and outcome yes or no), or just one which combines?

I tried many things, but I can't decide what is the correct way. ( I understand that this is kind of a ridiculous question, and understand the irony for such a test after having had Bayesian statistics, but I am really interested)

• Two variables. Fisher's exact test. – ttnphns Nov 25 '12 at 11:00
• If this is homework, you should tag it as such – Glen_b -Reinstate Monica Nov 25 '12 at 23:41
• @Glen_b this is not homework. Besides, I think that the meta of this stackexchange has a preference for not using that tag anymore? – PascalVKooten Nov 28 '12 at 7:12
• It's deprecated on stackoverflow, not deprecated here e.g.. If you hover over the homework tag on a question, it describes the policy. Further, see this. Feel free to show me something on our meta that suggests it's not used. But in any case, what is the source of this question? – Glen_b -Reinstate Monica Nov 28 '12 at 8:58
• The source of this question is the actual event happening to me, and wondering: is this a "significant" effect? – PascalVKooten Nov 29 '12 at 17:43

It rather depends on what else you think might have happened.

If you assume that four people would have gone up and you want to know the probability they were all male, then the probability is $$\frac{4}{12} \times \frac{3}{11} \times \frac{2}{10} \times \frac{1}{9} =\frac{1}{495} \approx 0.00202$$ and this is the most extreme possibility.

You can get the same from Fisher's exact test, for example in R

> fisher.test(matrix(c(4, 0, 0, 8), nrow=2))

Fisher's Exact Test for Count Data

data:  matrix(c(4, 0, 0, 8), nrow = 2)
p-value = 0.00202
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
2.980327      Inf
sample estimates:
odds ratio
Inf

• I think I am mostly interested if the population males differs from the population of females whether they go and ask the teacher or not. Just a formulation thing, or is this different? – PascalVKooten Nov 25 '12 at 13:43