To Chi or not to Chi?

Sunday 20 September 2015

When and how can students consider using the Chi squared test of independence?

This blog post is a result of having received lots of related questions on this topic either online or at workshops. I thought I might just write some thoughts down ina blog post before perhaps making a more formal entry about this on the website. So, the following is just a list of key points for students and teachers to consider about this test.....


In exams

It is probably worth noting here that students will need to know how to conclude these tests using both of the following methods.

Using the p-number - as a measure of the probability of independence. If it is lower than significance level (eg 10%, 0.1) then that means that there is a less than 10% chance that the variables are independent so you can conclude that they are not.

or

Using the calculated chi squared statistic - as a measure of the error between the observed and expected values. If the error is bigger than the critical value (which is related to both the significance level and the degrees of freedom) then we reject the hypothesis that the variables are independent. In exams, the critical value will be given

I have heard some brilliant acronyms for helping students to remember this and I am sure they work well. My preference though is to help students really understand what these statitsics mean. P is a measure of probabilityb of independence, the calculated statistic is a measure of error.

Students may also be expected to demonstrate that they know how to calculate an expected frequency.

In projects

Students are expected to conclude their tests using the calculated statistic and comparing it to the critical value. (The second of the methods used above). This is presumably because this method allows students to demonstrate the stages of the calculation where the p-number would not.

When is a test appropriate?

Although not an official rule, it is good guidance for our students that .....

  1. IF they are looking for a relationship between two numerical data fields they should use a scattergraph.
  2. IF one or both of the data fields are categorical, they should use a Chi squared test of independence..

What if one of the data fields is numerical?

In this case, students need to put this data in to categories. For example, a student might test to see if GDP is dependent on the hemisphere in which the country is in. In this case students would need to decide on categories for GDP. These might be Low, medium and high. In many cases, this is an arbitrary decision and students should try to justify it. One approach in this case might be to use the first quartile of the results as the 'low' category, the interquartile range as the 'medium' and the upper quartile as the 'high'.

Contingency table

Students should then tally all of their data in to one of these tables. For the example gievn below, the table might look like this.....

This would be a 2 x 3 table ans students would take each country in the survey and put a tally in the appropriate cell. Perhpas the country is in the Northern hemisphere but has a low GDP and so you would put a tally in the top left column. At this stage, it is good to have data on lots of countries so there is a decent total. Otherwise there is a risk that the low frequencies will undrmine the test (see below).

Beware

Once students have put the observed frequencies in their contingency table, then they should do a quick test - probably with the GDC - to check the expected frequencies. They must stick to the following rule.

NO EXPECTED FREQUENCIES MUST BE LESS THAN 5

This is said to undermione the test since at some point in the calculation we divide by the expected frequency. If that number is too small then the effect of small variations is disproportionately large.

Calculations

There after, students are expected to show how they calculate the error for each of the six (in this example) cases. See the example below. It is not a complete example, but just shows the highlights. This test was done to test for a relationship between the gender of a youtuber and the number of subscriptions to their channel.

Yates's Continuity Correction

If students end up with a 2 x 2 contingency table then they are required to use this correction approach. Again, this is related to disproportionate effe t of small variations on smaler numbers (degree freedom just 1).

This is easily done - When we do Observed frequency subtract expected frequency, we then subtract a further 0.5 before squaring. Students are only required to recognise the need and use the correction rather than explain why it is needed.