Performs a χ² test of independence.
χ²-Test(observed matrix, expected matrix, draw?
While editing a program, press:
- STAT to access the statistics menu
- LEFT to access the TESTS submenu
- ALPHA C to select χ²-Test(, or use arrows
(outside the program editor, this will select the χ²-Test… interactive solver)
TI-83/84/+/SE
2 bytes
This command performs a χ² test of independence. This test is used to assess the independence of two categorical variables with known frequencies. The test is only valid for a simple random sample from the population, and only if all the frequencies are sufficiently large (greater than 5).
Note: this test is different from the χ² goodness of fit test, which the TI-83 calculators don't have a command for. For a program that will perform the χ² goodness-of-fit test, see the goodness-of-fit test routine.
To use this test, you need a matrix containing a contingency table. This is a table in which every row corresponds to a value of the first variable, and every column to a value of the second. The number in each cell represents the frequency with which the corresponding values of the two variables occur together. For example: suppose that the two variables are sex (male and female) and eye color (blue, brown, and green). The contingency table would have two rows and three columns. The cell in the first row and column would be the number of blue-eyed men in the sample, the cell in the second row and first column would be the number of blue-eyed women, and so on.
The χ²-Test( command takes two arguments: the observed matrix and expected matrix. The first of these should be the contingency table you've already completed, presumably in the Matrix editor. The expected matrix does not need to already exist: the χ²-Test( command will calculate and store the expected frequencies (under the assumption that the variables are independent) to this matrix.
The command is primarily for use in a program. Although you can access the χ²-Test( command on the home screen, via the catalog, there's no need: you can use the χ²-Test… interactive solver found in the menu instead.
In either case, it's important to understand the output of χ²-Test(. Here are the meanings of each line:
- χ² is the test statistic, calculated from the differences between the observed and the expected matrices.
- p is the probability associated with the test statistic. We use p to test the null hypothesis that the two variables are independent. If p is low (usually, if it's <0.05) this means there's little chance that two independent variables would have a contingency table so different from the expected, and we reject the null hypothesis (so we'd conclude that the two variables are not independent).
- df is the degrees of freedom, defined as (# of rows - 1)*(# of columns - 1), important for calculating p.
Sample Problem
You want to compare the effectiveness of three treatments in curing a terminal disease. You have obtained data for 100 patients who had the disease, which contained information on the treatment used, and whether the patient lived or died. You put this information in a contingency table:
Lived | Died | |
---|---|---|
Treatment A | 40 | 10 |
Treatment B | 27 | 6 |
Treatment C | 11 | 6 |
To perform the test, you store this information to a matrix such as [A], either through the matrix editor or by hand:
:[[40,10],[27,6],[11,6→[A]
You submit this matrix as the first argument, and some other matrix (such as [B]) for the second:
:χ²-Test([A],[B]
The output looks something like this:
χ²-Test
χ²=2.14776311
p=.3416796916
df=2
The most important part of this output is the line p=.3416796916 - the probability of getting such results under the hypothesis that the treatments and survival rate are independent. This value is greater than .05, so the data is not significant on a 5% level. There is not enough evidence to reject the null hypothesis, so treatment and survival rate may very well be independent. In non-mathematical language, this means that there's no reason to believe the treatments vary in effectiveness.
Advanced Uses
The final argument of χ²-Test(, draw?, will display the results in a graphical manner if you put in "1" for it. The calculator will draw the χ² distribution with the correct degrees of freedom, and shade the area of the graph beyond the χ² statistic. In addition, the same values as usually will be calculated and displayed. You would make your conclusions in the same way as for the regular output.
Related Commands
See Also
.