I got the following question for my statistics finals exam yesterday.

Test at 5% significance, whether the proportions of females differ significantly between the locations

As the average proportion of female in the three locations is 0.473 I made the following table.

The table for observed and expected frequencies

1) How can I proceed from here?

2) Can you give me a brief intuitive description for chi square goodness of fit test?

Thank You


So let's start by creating a contingency table from the data. The rows will be the counts of females and males, the columns the locations.

$$\begin{bmatrix} 44 & 86 & 110 \\ 56 & 114 & 90 \end{bmatrix} $$

From thus table, we can compute the sum of the rows and the sum of the columns. The expected number cell frequencies are

$$\begin{bmatrix} 48 & 96 & 96 \\ 52 & 104 & 104 \end{bmatrix} $$

How did I get this? I'll just show one cell frequency, but this can be applied to all the cells. Let's take a look at the first column total, which is 100. We take the column total, multiply it by the row total (which is 240) and then divide by the total number of number of observations (which is 500). All in all

$$ 100 \times \dfrac{240}{500} = 48$$

And so that is the expected number in the first cell. Since we observed 100 individuals at site A, then we should expect 100-48 = 52 in the second cell in the first column. You can apply this logic to the remaining columns.

So now we have our expected cell frequencies. All we need to do now is compute the test statistic, which is

$$\sum \dfrac{(o_i - e_i)^2}{e^i} = \dfrac{(44-48)^2}{48} + \dfrac{(52-56)^2}{52} + \dots + \dfrac{(90-104)^2}{104} \approx 6.57 $$

We now need to compute the tail probability of this statistic from a chisquared distribution with $(R-1)\times(C-1) = 1 \times 2 = 2$ degrees of freedom. Here $R$ is the number of rows, and $C$ is the number of columns. You can look this up in a table.

The p value returned is 0.03743, so we can reject the null hypothesis at the $\alpha = 0.05$ level.

Here is some R code to verify we are correct in our calculations:

data = c(44,86,110, 56, 114, 90)
tbl = matrix(data, nrow = 2, byrow =T)

chisq.test(tbl, correct = F)

>>  Pearson's Chi-squared test

data:  tbl
X-squared = 6.5705, df = 2, p-value = 0.03743
  • $\begingroup$ Thank you very much for your answer $\endgroup$ – ch_isu Jul 20 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.