Why Fitting Changes the Degrees of Freedom
The Pearson chi-square goodness-of-fit statistic compares observed category counts with counts expected under a model. When the model parameters are estimated from the same grouped counts being tested, the fitted probabilities adapt to those counts. That adaptation uses information in the data and changes the reference degrees of freedom.
For \(k\) categories and \(m\) independently estimated model parameters, the familiar adjustment is \(k-1-m\). The important qualification is that this rule is not simply a reward for counting every parameter that appears in a formula. Its usual justification requires a suitable fitting procedure—most commonly maximum likelihood based on the same grouped counts—and regularity conditions. In particular, a parameter estimate based on individual observations is not automatically equivalent to one based on the grouped counts.
The \(k\) counts sum to \(N\), so only \(k-1\) count residuals can vary independently. Fitting parameters from those same grouped counts typically imposes another \(m\) independent constraints on the residuals. This is the basis for the degrees-of-freedom adjustment.
Deriving the Adjustment
Let \(O_j\) be the count in category \(j\), and let \(p_j(\boldsymbol{\theta})\) be its model probability for parameter vector \(\boldsymbol{\theta}\), where \(\boldsymbol{\theta}\) has \(m\) components. Under the null model, the probabilities sum to one. Therefore, $$ \sum_{j=1}^{k}\left(O_j-Np_j(\boldsymbol{\theta})\right) =N-N\sum_{j=1}^{k}p_j(\boldsymbol{\theta})=0. $$ This identity leaves at most \(k-1\) independent residual directions before parameters are fitted.
When \(\boldsymbol{\theta}\) is estimated by maximizing the grouped multinomial likelihood, the likelihood score equations also constrain the residuals. In large samples, these equations remove \(m\) independent directions when the parameters are identifiable and the model is regular. The Pearson statistic is a squared, standardized measure of residual size. After the \(m\) fitted directions and the one total-count constraint are removed, its asymptotic reference distribution has
degrees of freedom. This argument relies on the estimation equations corresponding to the grouped counts used in the statistic. If the parameters were instead estimated from the individual observations, the grouped residuals need not satisfy those same \(m\) constraints. The statistic may then have a different limiting distribution, so subtracting \(m\) is not generally justified without further analysis or calibration.
A Practical Degrees-of-Freedom Check
Before selecting a chi-square reference distribution, record three quantities: the number \(k\) of categories in the Pearson statistic, the effective number \(m\) of independently estimated parameters, and the data and method used for fitting. The value of \(m\) is not necessarily the number of symbols in the model statement. A parameter fixed in advance is not estimated; a parameter constrained by other parameters may not add an independent fitted direction; and a non-identifiable parameter does not meet the regularity conditions for the standard rule.
Count the mutually exclusive categories whose observed and expected counts appear in the Pearson statistic. This is \(k\).
Determine how many model parameters were estimated, and whether those estimates come from the grouped category counts used in the test.
For the standard adjustment, the fitted parameters must contribute independent constraints under a regular grouped-data fitting procedure.
When the conditions hold, calculate \(k-1-m\). If they do not, state that this conventional reference distribution has not been established by the simple adjustment.
Worked Example: Fitting an Exponential Severity Model to Grouped Losses
A hypothetical insurer groups 80 positive claim severities, measured in thousands of dollars, into \([0,1]\), \((1,2]\), and \((2,\infty)\). The observed counts are \(40,20,20\). Fit an exponential severity distribution to these grouped counts by grouped maximum likelihood, then find the degrees of freedom and Pearson statistic.
Model and assumptions. Let \(X\) have an exponential distribution with rate \(\lambda>0\) per thousand dollars, so \(P(X>x)=e^{-\lambda x}\). The independent severities are grouped into the three stated categories. Both the rate and the expected counts are fitted from the grouped frequencies.
Set \(t=e^{-\lambda}\), where \(0<t<1\). The three category probabilities are \(1-t\), \(t-t^2=t(1-t)\), and \(t^2\). The grouped likelihood, omitting a factor that does not depend on \(t\), is $$ L(t)\propto(1-t)^{40}\{t(1-t)\}^{20}(t^2)^{20} =t^{60}(1-t)^{60}. $$ The log-likelihood is \(60\log t+60\log(1-t)\). Its derivative is \(60/t-60/(1-t)\), which is zero at \(\hat t=1/2\); the likelihood is maximized there. Thus \(\hat\lambda=-\log(1/2)=\log 2\), or approximately \(0.6931\) per thousand dollars.
The fitted probabilities are \(1/2,1/4,1/4\), so the expected counts are \(80(1/2)=40\), \(80(1/4)=20\), and \(80(1/4)=20\). Here \(k=3\) and \(m=1\), giving \(3-1-1=1\) degree of freedom. Each observed count equals its expected count, so $$ X^2=\frac{(40-40)^2}{40}+\frac{(20-20)^2}{20}+\frac{(20-20)^2}{20}=0. $$ Check. The fitted probabilities sum to one, and the expected counts sum to 80. The usual grouped-fit reference has one degree of freedom. The zero statistic reflects the exact match of these particular grouped counts; it does not establish that every exponential model will fit well.
Method and mistake avoided. The rate was estimated by maximizing the likelihood of the three grouped counts. The reduction by one degree of freedom is appropriate under the stated grouped-fit conditions. It would not follow merely from estimating an exponential rate by a different procedure on ungrouped severities.
Worked Examples with Different Parameter Counts
Worked Example: A Grouped Binomial Frequency Model
In a hypothetical portfolio, each policy has two independent opportunities for a reported event, each with probability \(p\). For 80 policies, the observed numbers of events per policy are: 0 events, 18 policies; 1 event, 44 policies; 2 events, 18 policies. Estimate \(p\) from these grouped counts and calculate the degrees of freedom and Pearson statistic.
Model and fitting. The count \(C\) for one policy has a binomial distribution with two trials and event probability \(p\). The category probabilities are \((1-p)^2\), \(2p(1-p)\), and \(p^2\). Grouped maximum likelihood gives $$ \hat p=\frac{O_1+2O_2}{2N} =\frac{44+2(18)}{2(80)} =\frac{80}{160}=0.5, $$ where \(O_1\) and \(O_2\) denote the observed counts for one and two events.
At \(\hat p=0.5\), the category probabilities are \(0.25,0.50,0.25\), so expected counts are \(20,40,20\). There are \(k=3\) categories and \(m=1\) fitted parameter, hence the reference degrees of freedom are \(3-1-1=1\). The Pearson statistic is $$ X^2=\frac{(18-20)^2}{20}+\frac{(44-40)^2}{40}+\frac{(18-20)^2}{20} =\frac{4}{20}+\frac{16}{40}+\frac{4}{20}=0.8. $$ Check. The observed and expected counts each sum to 80, and the three contributions sum to \(0.2+0.4+0.2=0.8\).
Method and mistake avoided. The fitted probability comes from the grouped binomial likelihood, and the one independent parameter removes one degree of freedom. Do not use \(k-1=2\) as though \(p\) had been fixed in advance.
Worked Example: Two Fitted Parameters in Four Categories
A hypothetical product groups claim settlements into four exhaustive bands. Suppose a two-parameter model assigns probabilities \(p_1=\alpha\), \(p_2=(1-\alpha)\beta\), and \(p_3=p_4=(1-\alpha)(1-\beta)/2\), where \(0<\alpha<1\) and \(0<\beta<1\). The observed counts are \(20,40,20,20\). Fit the parameters from the grouped counts and find the usual degrees of freedom.
Grouped fit. There are \(N=20+40+20+20=100\) observations. The first probability is the fraction in the first category, so \(\hat\alpha=20/100=0.2\). Among the remaining \(80\) observations, the second category has count 40; the model assigns it fraction \(\beta\) of the remaining probability. Thus $$ \hat\beta=\frac{40}{40+20+20}=\frac{40}{80}=0.5. $$ The fitted probabilities are \(0.2\), \(0.8(0.5)=0.4\), and \(0.8(0.5)/2=0.2\) for each of the last two categories. Expected counts are therefore \(20,40,20,20\).
There are \(k=4\) categories and two independently estimated parameters, so the standard grouped-fit degrees of freedom are \(4-1-2=1\). The Pearson statistic is zero because all four observed counts equal their expected counts. The expected counts sum to \(100\), as required.
Method and mistake avoided. Both parameters are estimated from the four grouped frequencies and are identifiable in this model. The adjustment subtracts two—not one—fitted directions. Conversely, counting a parameter twice because it appears in multiple category probabilities would also be incorrect.
When the Simple Rule Does Not Apply
The distinction between grouped and ungrouped fitting is essential. Suppose individual claim amounts are used to estimate severity parameters, but the Pearson statistic is then calculated from a small number of grouped claim-amount counts. The individual-data estimator generally does not satisfy the grouped multinomial score equations. As a result, the grouped residual statistic need not lose exactly one independent direction for each parameter estimated from the individual observations. Its large-sample limit may be a weighted sum of chi-square variables rather than a chi-square distribution with \(k-1-m\) degrees of freedom.
The same caution applies to frequency data. If individual policy counts are used to estimate a Poisson rate, while the statistic uses grouped cells such as 0, 1, 2, 3, and 4 or more, the grouped likelihood is based on the probabilities of those five cells. The estimator from individual counts is not generally the same as the grouped-likelihood estimator for those cells. The standard degrees-of-freedom formula is therefore not justified merely because one rate was estimated.
Possible remedies depend on the analysis. Fit parameters using the grouped likelihood corresponding to the categories being tested, if that is the intended procedure. If the fitting method is fixed by the application, use a reference distribution calibrated for that procedure, for example with an appropriately designed parametric bootstrap. Do not report \(k-1-m\) as established unless its assumptions are met.
Common Exam Trap
A frequent error is to identify the number of model parameters correctly but ignore how they were estimated. For example, a candidate may see six grouped categories and two parameters estimated from individual severities, then write \(6-1-2=3\). The arithmetic is correct, but the inference is not: the two parameters were not necessarily fitted from the six grouped counts, so the usual result does not automatically follow.
The correction is to state the fitting procedure before selecting the reference degrees of freedom. If the two parameters were estimated from those same six grouped counts by a regular grouped likelihood, the conventional result is \(6-1-2=3\). If they were estimated from the individual observations instead, do not claim three degrees of freedom without a result or calibration that accounts for that estimator.
Check Your Understanding
For each problem, identify the fitting setup before deciding whether the standard degrees-of-freedom adjustment is justified.
- A grouped multinomial model has seven categories. Two identifiable parameters are estimated by maximum likelihood from those same seven counts. Find the conventional degrees of freedom. (Answer: \(7-1-2=4\).)
- A test uses five grouped categories, while one rate parameter was estimated from the individual observations before grouping. Can the standard grouped-fit rule alone establish the degrees of freedom? (Answer: No; \(5-1-1=3\) is not justified automatically for that fitting procedure.)
- A model has six grouped categories and two named parameters, but the grouped probabilities depend only on one identifiable combination of them. Is subtracting two parameters justified by the standard rule? (Answer: No; the two parameters are not independently identifiable, so the regular grouped-fit conditions fail.)
- A fully specified model has four exhaustive categories, with all probabilities fixed before observing the data. What is the usual reference degrees of freedom? (Answer: \(4-1=3\).)
- A grouped likelihood fits two identifiable parameters to five categories. A candidate calculates \(5-1-2\), then notices that one category has an expected count of zero under the fitted model. Is the usual chi-square approximation established? (Answer: No; although the arithmetic gives 2, a zero expected count violates the regularity needed for the ordinary Pearson chi-square approximation.)