Chi-Square Goodness-of-Fit Test
IE 5317: Goodness-of-Fit Calculations
Construct an expanded frequency table by adding the columns for (i) class probability, (ii) class expected value, and (iii) class chi-square component values.
Below the table, show the probability calculations for the first two or three classes.
Perform a goodness of fit test to determine if your data fits the specified distribution.
EXAMPLE
Class Observed Frequency (oi)
Class Probability Expected Frequency (ei)
χ2 Class Component
X ≤ 2 Count observations based on your collected data.
Calculate using the assumed probability distribution.
For each class, take its probability and multiply by n.
2 < X ≤ 7 7 < X ≤ 12 X > 12 Total n 1.0 n χ2 statistic
The class probabilities are: P[X ≤ 2] P[2 < X ≤ 7] = P[X ≤ 7] − P[X ≤ 2] P[7 < X ≤ 12] = P[X ≤ 12] − P[X ≤ 7] P[X > 12] = 1 − P[X ≤ 12]
For the normal distribution, you need 2 parameters: use the sample mean for μ and the sample standard deviation for σ. For the exponential, you need β: use the sample mean for β.
In Excel, to calculate c.d.f. values P[X ≤ x]: use NORMDIST(x, μ, σ, 1) for the normal distribution and GAMMADIST(x, 1, β, 1) for the exponential distribution.
Finally, if any of the Expected Frequencies (ei) are less than 5, then you should combine classes accordingly.
2( )i i i
o e e −
Normal Class Frequency Class Probability Expected Value Chi-square
x ≤ 15 17 0.101049773 10.10497729 4.704744689 15 < x ≤ 20 15 0.172503584 17.25035841 0.293565666 20 < x ≤ 25 2 0.254902993 25.49029933 21.64722177 25 < x ≤ 30 44 0.243371959 24.33719594 15.88621238 30 < x ≤ 35 18 0.150130721 15.01307207 0.594264681 x > 35 4 0.07804097 7.804096969 1.854302145
Sum 100 1 100 44.98031133 Chi-square test statistic value
Class Probability Calculations: x ≤ 15 NORMDIST(15,24.47,7.424,1) 15 < x ≤ 20 NORMDIST(20,24.47,7.424,1) - NORMDIST(15,24.47,7.424,1) 20 < x ≤ 25 NORMDIST(25,24.47,7.424,1) - NORMDIST(20,24.47,7.424,1) 25 < x ≤ 30 NORMDIST(30,24.47,7.424,1) - NORMDIST(25,24.47,7.424,1) 30 < x ≤ 35 NORMDIST(35,24.47,7.424,1) - NORMDIST(30,24.47,7.424,1) x > 35 1 - NORMDIST(35,24.47,7.424,1)
Exponential Class Frequency Class Probability Expected Value Chi-square
x ≤ 150 30 0.432229355 43.2229355 4.045213988 150 < x ≤ 300 40 0.24540714 24.54071397 9.738491102 300 < x ≤ 450 17 0.13933497 13.933497 0.674880158 450 < x ≤ 600 4 0.079110306 7.911030577 1.933523076 x > 600 9 0.10391823 10.39182296 0.186413024
Sum 100 1 100 16.57852135 Chi-square test statistic value
Class Probability Calculations: x ≤ 150 GAMMADIST(150,1,265,1) 150 < x ≤ 300 GAMMADIST(300,1,265,1) - GAMMADIST(150,1,265,1) 300 < x ≤ 450 GAMMADIST(450,1,265,1) - GAMMADIST(300,1,265,1) 450 < x ≤ 600 GAMMADIST(600,1,265,1) - GAMMADIST(450,1,265,1) x > 600 1 - GAMMADIST(600,1,265,1)
- 5317-goodness-of-fit-example.pdf
- 3301-Project2-calculations.pdf
- Sheet1