# What test to compare two frequencies?

In my project I have to study the vigilance behaviour of birds, and I need to determine if adults start escaping from an approaching human more often than chicks. So I have the frequencies of adults starting the behaviour, and the frequency of chicks starting the behaviour. What type of statistical test would be most appropriate to determine if there is a significant difference between adults and chicks in starting the behaviour? I have been reading that some people suggest a t-test but I’m not sure it would be appropriate. I was thinking of a Fisher exact test but I am not sure since it usually compares two categorical variables, and here I have one.

If 69 of 100 adults started first and 161 of 300 chicks started first, then you can use prop.test in R to see if the proportion of adults starting first is significantly greater (one-sided test). The observed proportions for adults and chicks are $$\hat p_A = 0.59, \hat p_c=0.537.$$ The question is whether the observed proportion of adults starting first is significantly larger.

The P-value $$0.0036 < 0.01 = 1\%$$ shows that the null hypothesis $$H_0: p_A = p_C$$ is rejected in favor of the alternation $$H_a: p_A > p_C$$ at the 1% level of significance. On account of the moderately large sample sizes, I have declined the continuity correction (with paramater cor=F)

prop.test(c(69,161),c(100,300), alt="greater", cor=F)

2-sample test for equality of proportions
without continuity correction

data:  c(69, 161) out of c(100, 300)
X-squared = 7.2157, df = 1, p-value = 0.003613
alternative hypothesis: greater
95 percent confidence interval:
0.06372501 1.00000000
sample estimates:
prop 1    prop 2
0.6900000 0.5366667


Except for syntax of usage and details of output, this test is similar to a chi-squared test on the relevant $$2\times 2$$ table of counts, where columns are for Adults/Chicks and columns are for First/Last. However, the chi-squared test is usually considered to be two-sided, so the P-value is double that for the the test above.

TAB = rbind(c(69,31), c(161,139))
TAB
[,1] [,2]
[1,]   69   31
[2,]  161  139

chisq.test(TAB, cor=F)

Pearson's Chi-squared test

data:  TAB
X-squared = 7.2157, df = 1, p-value = 0.007227


Notes: (a) An advantage of using chisq.test is that if data are too sparse for the P-value to be considered useful, then one can use parameter sim=T to simulate a possibly useful P-value.

(b) Fisher's exact test could also be used for sparse data; it also uses a table as input.