SH3, SH4 - Goodness of fit tests
A goodness of fit test compares observed frequencies with those predicted by a probability model. You will test uniform, binomial and Poisson models, use supplied groupings correctly, and adjust the degrees of freedom when parameters have been estimated from the same data.
Compare observations with a specified model
Could two different probability models both survive a test on the same data? A test looks for sufficient evidence against a proposed model; it does not award a certificate saying that exactly one model is true.
You already know
The chi-squared statistic is , supplied in the formula booklet. Large values count against the null model. Use the upper chi-squared tail, or a software -value, and give a cautious population conclusion.
For goodness of fit there is one variable and a proposed distribution, rather than two factors in a contingency table. Under a uniform model on four categories, each category has probability . A sample of therefore has expected frequency in each category.
Expected frequencies and degrees of freedom for a fixed model
If the model gives probabilities for exhaustive, non-overlapping categories and the sample size is ,
When all model parameters are specified independently of this sample,
The loss of one degree of freedom reflects the fixed total frequency.
Not in the formula booklet: learn it.
The statistic and chi-squared critical-value table are supplied, but this expected-count and degrees-of-freedom rule is not. Check that model probabilities sum to , expected frequencies sum to , and expected counts are large enough for the approximation.
Worked example 1: a uniform four-category model
Question. A device assigns each item to category A, B, C or D. In a random sample of independent items, the frequencies are . Test at the level whether a uniform model is suitable for the population category distribution.
Plan. Use equal expected counts, calculate the discrepancy, then use degrees of freedom.
: a uniform model on A, B, C, D is suitable for the population category distribution. : that model is not suitable.
Why this step? The null model predicts probabilities, not identical observed counts. Random frequencies can depart from without being too unusual under the model.
Answer. There is insufficient evidence at the level to suggest that the uniform model is unsuitable for the population category distribution.
Check. All expected counts are , their total is , and software gives , consistent with not rejecting.
Change only the observed allocation, keeping the sample size, model and level fixed.
Worked example 2: a larger discrepancy
Question. Repeat the test when the observed frequencies are .
Plan. Retain and , but recalculate the statistic.
: a uniform model is suitable for the population categories. : that model is not suitable.
Why this step? The total is unchanged, so equal probabilities still give per category. The stronger observed pattern changes the discrepancy.
Answer. There is sufficient evidence at the level to suggest that the uniform model is unsuitable for the population category distribution.
Check. The -value is approximately , below , agreeing with the comparison.
A model concerns the distribution that could produce repeated observations. It is not the data that need to “fit themselves” to a distribution.
Watch out
Wrong: “The test proves that the uniform model fits” after a small statistic.
Right: there is insufficient evidence to reject the model. Another model might also be compatible with the same sample.
The next observed allocation lies nearer the decision boundary.
Respect the supplied groups and complete the tails
For a binomial or Poisson model, the categories need not be equally likely. Calculate their model probabilities before multiplying by the sample size. A tail category must include every value it names, including values not observed in the sample.
Small expected counts can make the chi-squared approximation unreliable. Categories are often pooled so that the resulting expected counts are at least . In examination questions, the grouping is supplied: you need to understand it and use it, rather than decide your own groups.
Pooling categories
Pooling combines categories by adding their observed frequencies and adding their expected frequencies. For a pooled category, calculate one new contribution
Do not add the old unpooled contributions instead. Count the categories after pooling when finding the degrees of freedom.
The pooled-contribution rule follows from the supplied test statistic. The pooling and category-count rules are not printed in the formula booklet. Binomial probabilities are supplied there; their use here is assumed from earlier study.
Worked example 3: a fully specified binomial model
Question. A random sample of independent batches, each containing items, gives the following counts of defective items per batch. Test the proposed model at the level. Use the prescribed categories .
| Number defective | |||||
|---|---|---|---|---|---|
| Frequency |
Plan. Find the three grouped probabilities, add observed frequencies within the final group, then test with no parameter estimated.
: is suitable for the population count per batch. : that model is not suitable.
The grouped observed counts are , and expected counts are . Therefore
Why this step? The value was specified, not fitted from these frequencies, so it does not cost an additional degree of freedom.
Answer. There is insufficient evidence at the level to suggest that is unsuitable for defective-item counts per batch.
Check. The expected counts sum to and all exceed . Before pooling, the expectations for and would be and , explaining why sparse tail categories need attention.
Change only the proposed success probability, from to . Keep the observations, prescribed grouping and significance level unchanged.
Worked example 4: a different fixed model on the same data
Question. Test using the same data and the categories .
Plan. Recalculate the model probabilities, retaining three categories and no fitted parameter.
: is suitable for population counts per batch. : that model is not suitable.
Thus
Why this step? Changing a specified model probability changes the expected frequencies, but does not mean that probability has been estimated from this sample.
Answer. There is insufficient evidence at the level to suggest that is unsuitable for the population batch counts.
Check. The expectations again sum to . Both this model and the previous model survive: the same data need not identify one unique distribution.
Pooling is based on small expected frequencies, not simply a small observed count. An observed zero can be quite informative when its expected count is substantial.
Watch out
Wrong: omit a category because it has no observations, or replace the tail probability by the probability of just its first value.
Right: retain all model outcomes in the supplied categories. For a binomial model, here includes ; for a Poisson model, an upper tail continues indefinitely.
Change the fixed probability again, while retaining the same grouping.
Continue this lesson.
You’re previewing NovaLearn without an account. Create a free account to read the rest.
Create free account