|
Chi-Squared Tests - c2
Chi-Squared for Independence
The Chi-Squared test for independence is used to test the relationship between two variables of a sample. We assume that each member of the population falls into one and only one category of each of the variables. The contingency table is formed by putting one variable across the rows and one across the columns, then filling in the number of instances in the population where a category of both the row variable and the column variable are satisfied (The table below is a contingency table comparing people's sex and favorite color); if the row variable is X and the column variable is Y, the resulting table can be referred to as a crosstabulation of X and Y. Performing the Chi-Squared test on this data determines whether there is a significant difference between these data and the data that would be expected if each of the rows and columns were distributed normally.
The general hypotheses for a Chi-Squared test on a contingency table are these: The null hypothesis is that the two variables are independent of one another (because there is a significantly large difference between the observed data and the calculated expected data). The alternate hypothesis is that the two variables are dependent on each other (because there is not a significant difference). Thus, for this example, our hypotheses are the following: HO: A person's sex and favorite color are unrelated. The Chi-Squared for independence is computed in three main steps. First, form the null and alternate hypotheses and select an a level (significance level or confidence interval; the probability that the two variables are dependent) (a typical value is .05; the lower the level, the stronger a relationship or larger a difference you're looking for). Then align your data in the contingency table as shown above. From here you can proceed two ways: you can put the table into a calculator or you can work it out by hand. DIG Stats provides a Chi-Squared for Independence calculator but due to the JavaScript interface, it can only be used in some browsers (If you can use the goodness of fit calculator, you can use this one, too.). Please click below to test your browser. Whichever way you decide to calculate the Chi-Squared, you will need another value to determine how significant the difference is between your variables; a quantity called the degrees of freedom or just df. The df is given as df=(r-1)(c-1), where r is the number of rows in your contingency table and c is the number of columns. The df of the above table would then be df=(3-1)(2-1)=(2)(1)=2. Finally, with your Chi-Squared and your df calculated, you can decide whether to accept your null hypothesis. To do this, you need a Chi-Squared table, which you can find either in the back of most statistics books, or a shorter version, online (if that table is not accurate enough, try this one). On the table, find the number that corresponds to your df and your a. This is the critical Chi-Squared for your dataset; if your Chi-Squared is above this number, then the null hypothesis is false and there is a relationship between the two variables that you've just tested. Alternately, you can use the a value given by the Chi-Squared calculator to interpret the Chi-Squared: if the a given by the calculator is less than your selected a, then the null hypothesis is false and there is a relationship. If either of these tests fails (Chi-Squared < Chi-Squared-critical or a > a-critical), then we accept the null hypothesis and conclude that there is no relationship between the variables.
The Health, Cops, and Education exercises in the previous menu use a Chi-Squared test for independence to investigate the relationship between two variables. Original work on this document was done by Central Virginia Governor's School students Richard Barnes, Kim Tibbs, and Ryan Nash (Class of '00). This document was updated by Central Virginia Governor's School students Matthew James and Kyle Nenninger Copyright © 1999 Central Virginia Governor's School, Lynchburg, VA |
||||||||||||||||||||||||||