BrownMath.com → TI-83/84/89 → Goodness of Fit (TI-83/84)
Updated 31 July 2013

# How to Test Goodness of Fit on TI-83/84

Copyright © 2012–2022 by Stan Brown, BrownMath.com

Summary: You can use your TI-83/84 to calculate a goodness-of-fit test, also known as a multinomial experiment.

Alternative: MATH200A Program part 6 does the calculations and graphs the χ² curve automatically for you. This is significantly easier than using native TI-83/84 commands, so I recommend you get the program if possible.

See also: How to Test Goodness of Fit on TI-89

## Example: Fruit Flies

Modelratio Observed 9 120 3 49 3 36 1 12 16 217

An example in Dabes & Janik [full citation at https://BrownMath.com/swt/sources.htm#so_Dabes1999] had to do with the offspring of hybrid fruit flies; see figures at right. The null hypothesis H0 is that the 9:3:3:1 model is good, and the alternative H1 is that the model is bad. Use α=0.05.

The test statistic χ² is a standardized measure of how far the observations differ from the model. You’ll compute that first, by using some list operations, and then you’ll use χ²cdf to compute the p-value.

## Computing the Expected Counts

 The model goes in L1. It can be percentages, ratios, or whole numbers. Enter the model numbers for each category, but don’t enter the total even if you have it. Press [`STAT`] [`ENTER`]. Cursor to L1, the actual column head and not the first number under L1, and press [`CLEAR`] [`ENTER`]. Enter the numbers. The observed counts go in L2. Even if the model is in percentages, the observed numbers must be the actual counts. Don’t enter the total. Cursor to L2, the actual column head and not the first number under L2, and press [`CLEAR`] [`ENTER`]. Enter the numbers. Next, fill L3 with the expected counts. Each expected count equals the corresponding percent in the model, times the sample size. Symbolically, L3 = L1/sum(L1)*sum(L2) (There’s no need to clear L3 before entering the formula.) Cursor to the L3 column head and press [`2nd` `1` makes `L1`] [`÷`].   Press [`2nd` `STAT` makes `LIST`] [`◄`] [`5`] to paste sum(. Continue with [`2nd` `1` makes `L1`] [`)`] [`*`].   Again press [`2nd` `STAT` makes `LIST`] [`◄`] [`5`] to paste sum(. Finish with [`2nd` `2` makes `L2`] [`)`] [`ENTER`]. L3 now contains the expected counts (expected for this sample size if H0 is true and the model is correct). Before you continue, verify that the requirements are met for a GoF hypothesis test:

• Random sample? Yes, effectively, since the fruit flies were genetically pure strains.
• Sample less than 10% of population? Yes, 10×217 = 2170 is far less than the number of fruit flies in the world.
• Every expected count ≥ 5? Yes, the smallest is 13-point-something.

The requirements are met. If you have a TI-84 Plus or Silver, skip down to Computing Goodness of Fit (TI-84s).

## Computing the χ² Contributions (TI-83s)

 Next, fill L4 with the χ² contributions. These are (observed−expected) squared, the divided by expected, (O-E)²/E. Symbolically, L4 = (L2−L3)²/L3 (There’s no need to clear L4 before entering the formula.) Cursor to the L4 column head and press [`(`] [`2nd` `2` makes `L2`] [`−`] [`2nd` `3` makes `L3`] [`)`] [`x²`] [`÷`] [`2nd` `3` makes `L3`] [`ENTER`]. After you press [`ENTER`], the screen will look like this.

L4 now contains the χ² contributions.

## Computing the Test Statistic and p-Value (TI-83s)

 Get back to the home screen for the remaining calculations. Press [`2nd` `MODE` makes `QUIT`]. Sum up the χ² contributions that you computed in L4. This is your χ² test statistic. Press [`2nd` `STAT` makes `LIST`] [`◄`] [`5`] to paste sum(. Finish with [`2nd` `4` makes `L4`] [`)`] [`ENTER`]. The p-value is the probability of getting this χ² statistic or greater. You have to specify degrees of freedom, which is (number of categories) minus 1. Press [`2nd` `VARS` makes `DISTR`]. Scroll down to χ²cdf (not χ²pdf) and press [`ENTER`] then [`2nd` `(-)` makes `ANS`], which will use the previous answer. (This is faster and more accurate than retyping the number yourself.)   Continue with [`,`] [`1`] [`0`] [`^`] [`9`] [`9`] [`,`] and the number of degrees of freedom, then finish with [`)`] [`ENTER`].

The χ² test statistic is 2.45 and the p-value is 0.4838. p>α; fail to reject H0.

## Computing Goodness of Fit (TI-84s)

TI-84s can compute the χ² contributions and p-value for you, although you still have to compute expected counts yourself.

 Select the χ² Goodness-of-Fit Test. Press [`STAT`] [`◄`] and scroll up to `χ²GOF-Test`. Enter L2 for Observed and L3 for Expected. For degrees of freedom df enter number of categories minus 1. In this problem, that’s 4−1 = 3. Select Calculate and read off the results: the χ² test statistic is 2.45 and the p-value is 0.4838. p > α; fail to reject H0. 