Tutorials › Exam ASTAM - Advanced Short-Term Actuarial Mathematics › Building Categories For Chi-Square Tests

Exam ASTAM · Empirical Goodness-of-Fit Tests · Tutorial 398 of 979

Building Categories For Chi-Square Tests

Define loss categories precisely, calculate their fitted-model probabilities, and obtain the corresponding expected counts without confusing them with observed counts.

Intermediate 12 min read

What You'll Learn

  • Define mutually exclusive and exhaustive categories for continuous and discrete losses
  • Calculate interval and tail probabilities from a fitted severity model
  • Convert category probabilities to expected counts under an independent, identically distributed sample
  • Handle discrete probability masses and category groupings correctly
  • Recognize when probabilities must be conditional on a truncated observation range

Why Categories Must Be Built Carefully

A chi-square goodness-of-fit setup compares observed counts with counts expected under a model. Before those counts can be compared, the possible losses must be organized into categories. The categories need to cover the relevant outcome space without overlapping: every observation belongs to one category, and only one.

For a continuous severity model, categories are commonly intervals, including lower and upper tail intervals. For a discrete model, categories may consist of individual values or groups of values. In either case, the model assigns a probability to each category; multiplying that probability by the sample size gives the category’s expected count.

Definition: A set of categories \(C_1,\ldots,C_k\) is a partition of the modeled outcomes if the categories are mutually exclusive and exhaustive. Mutual exclusivity means \(C_j\cap C_l=\varnothing\) for \(j\ne l\). Exhaustiveness means every modeled outcome belongs to one of the categories. Under a fitted loss model, the probability of category \(C_j\) is \(p_j=P(X\in C_j)\). For a sample of \(n\) independent losses from that model, its expected count is \(E_j=np_j\).

The expected count \(E_j\) is not the count actually observed in the data. The observed count records how many sample losses fall in \(C_j\); the expected count is determined by the fitted model and the sample size. This tutorial focuses on constructing the categories and calculating their probabilities and expected counts, not on calculating a test statistic.

From a Loss Model to Category Probabilities

Suppose \(X\) is a loss with cumulative distribution function \(F_X(x)=P(X\le x)\) and survival function \(S_X(x)=P(X>x)\). If \(X\) is continuous, the probability of a finite interval \([a,b)\) is

$$ P(a\le X<b)=F_X(b)-F_X(a). $$

For a continuous distribution, including or excluding a single finite endpoint does not change the probability, because \(P(X=a)=0\). The interval notation still needs to define categories consistently, especially when categories are listed in a table. For example, \([0,c)\) and \([c,\infty)\) are disjoint and together cover all nonnegative losses.

For a discrete distribution, a single value can have positive probability. Boundary conventions therefore matter: the probability of \(X\le c\) includes the mass at \(c\), while the probability of \(X>c\) does not. Category probabilities should be computed by summing the probability masses of the values included in each category.

Key result: For a partition \(C_1,\ldots,C_k\), the category probabilities satisfy \(p_j=P(X\in C_j)\), \(p_j\ge 0\), and \(\sum_{j=1}^k p_j=1\). With \(n\) independent losses from the specified model, the expected count in category \(C_j\) is \(E_j=np_j\). These results use probabilities under the model for the observations being counted.

Why Expected Counts Equal \(np_j\)

The expected-count formula follows directly by representing category membership with indicator variables. For observation \(r\), define \(I_{rj}=1\) if its loss falls in \(C_j\), and \(I_{rj}=0\) otherwise. The observed count in category \(j\) is the sum of these indicators.

$$ O_j=\sum_{r=1}^{n} I_{rj}. $$

Each indicator has expectation \(E[I_{rj}]=1\cdot p_j+0\cdot(1-p_j)=p_j\). By linearity of expectation,

$$ E[O_j] =E\left[\sum_{r=1}^{n}I_{rj}\right] =\sum_{r=1}^{n}E[I_{rj}] =np_j. $$

This expectation calculation does not require the category indicators to be independent of one another across categories for the same observation. They cannot be: one observation belongs to exactly one category. It does rely on each of the \(n\) observations having the same category probability \(p_j\). If the observations have different distributions or are included under a truncation rule, the relevant probabilities must reflect that sampling setup.

Worked Example: Two Categories Under a Fitted Exponential Model

A hypothetical portfolio has \(n=80\) observed losses. An exponential severity model with fitted mean \(\theta=50\) dollars is used to calculate expected category counts. Form two categories, losses below \$50 and losses of at least \$50. Find both category probabilities and expected counts. Treat the fitted model as given; each observed loss is assumed independent and to follow this model.

Method. For an exponential loss with mean \(\theta\), \(S_X(x)=e^{-x/\theta}\) for \(x\ge0\), and \(F_X(x)=1-e^{-x/\theta}\). The categories are \([0,50)\) and \([50,\infty)\), so they are disjoint and cover all nonnegative losses. Since the model is continuous, assigning the boundary at 50 to either category would not change the probabilities.

For the first category,

$$ p_1=P(X<50)=1-e^{-50/50}=1-e^{-1}=0.6321206\ldots $$

For the second category,

$$ p_2=P(X\ge50)=e^{-50/50}=e^{-1}=0.3678794\ldots $$

The probabilities sum to \(0.6321206+0.3678794=1.0000000\), as required. The expected counts are

$$ E_1=80(0.6321206\ldots)=50.5696\ldots,\qquad E_2=80(0.3678794\ldots)=29.4304\ldots. $$

Rounded to two decimal places, the expected counts are 50.57 and 29.43. Their sum is \(80.00\), which checks that the entire sample has been allocated. A common mistake is to assume that a cutoff at the mean divides an exponential distribution into equal halves. It does not: the probabilities here are approximately 0.6321 and 0.3679, not 0.5000 and 0.5000.

Several Continuous Categories, Including the Tail

With more than two categories, calculate each interval probability from the distribution function, or use the survival function for an upper tail. A useful check is that the probabilities across all categories sum to one before they are multiplied by \(n\). If they do not, a range may have been omitted, a boundary may have been counted twice, or a probability may have been evaluated incorrectly.

Worked Example: Three Categories Under an Exponential Model

A hypothetical insurer studies \(n=200\) independent losses using a fitted exponential model with mean \(\theta=100\) dollars. Use the categories \([0,50)\), \([50,150)\), and \([150,\infty)\). Calculate the probability and expected count for each category. Round expected counts to two decimal places.

Method. The fitted model has \(F_X(x)=1-e^{-x/100}\) and \(S_X(x)=e^{-x/100}\), for \(x\ge0\). For the first category,

$$ p_1=F_X(50)=1-e^{-0.5}=0.3934693\ldots. $$

For the middle interval, subtract the probability below 50 from the probability below 150:

$$ p_2=F_X(150)-F_X(50) =(1-e^{-1.5})-(1-e^{-0.5}) =e^{-0.5}-e^{-1.5} =0.3834005\ldots. $$

For the upper tail, use the survival function:

$$ p_3=S_X(150)=e^{-1.5}=0.2231302\ldots. $$

The probability check gives \(0.3934693+0.3834005+0.2231302=1.0000000\), up to displayed precision. Multiplying each probability by \(n=200\) gives

$$ E_1=200(0.3934693\ldots)=78.6939\ldots,\quad E_2=200(0.3834005\ldots)=76.6801\ldots,\quad E_3=200(0.2231302\ldots)=44.6260\ldots. $$

Thus the expected counts, rounded to two decimal places, are 78.69, 76.68, and 44.63. They sum to 200.00. The common error to avoid is calculating the middle category as \(F_X(150)\) alone: that includes all losses below 50 as well as losses from 50 to 150.

Categories for a Discrete Loss Model

For a discrete severity model, categories may group multiple possible loss amounts. The probability of a group is the sum of the probabilities of its included values. It is often convenient to use the survival function for a final category that contains all values from a threshold upward, but the threshold’s inclusion must match the category definition.

Worked Example: Grouping Values Under a Geometric Loss Model

A hypothetical product has integer-valued losses \(X=1,2,\ldots\). Under a fitted geometric model, \(P(X=k)=0.4(0.6)^{k-1}\) for \(k\ge1\). For \(n=150\) independent losses, use categories \(\{1\}\), \(\{2,3\}\), and \(\{4,5,\ldots\}\). Find the probabilities and expected counts.

Method. The first category contains only \(X=1\), so \(p_1=0.4\). For the second category, add the masses at 2 and 3:

$$ p_2=P(X=2)+P(X=3) =0.4(0.6)+0.4(0.6)^2 =0.24+0.144 =0.384. $$

The final category contains \(X\ge4\). Its probability is the remaining probability, or equivalently the geometric tail:

$$ p_3=1-p_1-p_2=1-0.4-0.384=0.216. $$

As a check, \(0.4+0.384+0.216=1\). The expected counts are

$$ E_1=150(0.4)=60,\qquad E_2=150(0.384)=57.6,\qquad E_3=150(0.216)=32.4. $$

The counts sum to \(150\), as they should. The common mistake is to calculate the last category as \(P(X>4)\), which would exclude \(X=4\). The category is \(X\ge4\), so its probability includes the mass at 4; using the complement \(1-P(X\le3)\) makes that inclusion explicit.

When the Observed Losses Are Truncated

The model probability used for an expected count must match the population from which the observations were sampled. If losses are observed only when \(X>a\), then the recorded sample is conditional on exceeding \(a\). Using unconditional category probabilities would allocate expected counts to outcomes that could not appear in the recorded data.

For an original loss model with survival function \(S_X\), and a category \(C\) contained in \(X>a\), the appropriate probability among observed losses is

$$ P(X\in C\mid X>a)=\frac{P(X\in C)}{S_X(a)}. $$

This formula follows from conditional probability because \(C\) is contained in the event \(X>a\). The resulting conditional category probabilities should sum to one over a partition of the observable range. This adjustment is for truncation, where losses below the threshold are not in the sample; it is not the same as treating a known loss above the threshold as an incomplete or censored observation.

Worked Example: Conditional Categories Above an Observation Threshold

A hypothetical data set contains \(n=90\) losses, and only losses exceeding \$50 are recorded. The underlying severity model is exponential with mean \(\theta=100\) dollars. Partition the observed range into \(50<X\le150\) and \(X>150\). Calculate the conditional probabilities and expected counts, rounding counts to two decimal places.

Method. Since the sample is restricted to \(X>50\), calculate probabilities conditional on that event. For the first category,

$$ P(50<X\le150\mid X>50) =\frac{P(50<X\le150)}{P(X>50)} =\frac{e^{-0.5}-e^{-1.5}}{e^{-0.5}} =1-e^{-1} =0.6321206\ldots. $$

For the upper category,

$$ P(X>150\mid X>50) =\frac{e^{-1.5}}{e^{-0.5}} =e^{-1} =0.3678794\ldots. $$

These conditional probabilities sum to one. The corresponding expected counts are

$$ E_1=90(0.6321206\ldots)=56.8909\ldots,\qquad E_2=90(0.3678794\ldots)=33.1091\ldots. $$

Rounded to two decimal places, the expected counts are 56.89 and 33.11, summing to 90.00. The trap is to use the unconditional probabilities \(P(50<X\le150)\) and \(P(X>150)\). Those probabilities describe all losses under the original model, not the losses in a sample where every recorded value already exceeds 50.

Checks Before Using the Category Counts

Before using the resulting expected counts in a goodness-of-fit calculation, verify the setup rather than relying only on arithmetic. In particular, identify the support of the model, specify every category boundary, and confirm that the probabilities correspond to the actual observation scheme.

  • Check exclusivity. No value should be assigned to two categories. For continuous intervals, conventions such as \([a,b)\) and \([b,c)\) avoid overlap at a shared boundary.
  • Check coverage. Every modeled outcome that can appear in the sample should be included. A final tail category is often needed.
  • Check the probability total. The category probabilities should sum to one, subject only to rounding.
  • Check the sample basis. Use unconditional probabilities for an untruncated sample and conditional probabilities when the sample is restricted to a specified range.
  • Check the counts. Expected counts should sum to \(n\), apart from small rounding differences.
Key takeaway: Define the sample’s outcome range, make the categories disjoint and exhaustive, calculate each probability under the applicable fitted model, and then multiply by \(n\). A probability total of one and an expected-count total of \(n\) are essential setup checks.

Check Your Understanding

For each problem, identify the category probabilities before calculating expected counts. Answers are rounded as stated.

  1. A hypothetical sample has \(n=50\) independent losses from an exponential model with fitted mean \(\theta=40\) dollars. Categories are \(X<40\) and \(X\ge40\). Find the probabilities and expected counts. (Answer: probabilities 0.6321 and 0.3679; expected counts 31.61 and 18.39.)
  2. A hypothetical sample of \(n=120\) losses follows a fitted exponential model with mean \(\theta=75\) dollars. Use categories \([0,75)\), \([75,225)\), and \([225,\infty)\). Give probabilities to four decimal places and expected counts to three decimals. (Answer: probabilities 0.6321, 0.3181, 0.0498; expected counts 75.854, 38.171, 5.975.)
  3. Under a fitted geometric model \(P(X=k)=0.25(0.75)^{k-1}\), \(k\ge1\), a hypothetical sample contains \(n=160\) independent losses. Use categories \(\{1,2\}\), \(\{3,4,5\}\), and \(\{6,7,\ldots\}\). Give expected counts to three decimal places. (Answer: category probabilities 0.4375, 0.3252, 0.2373; expected counts 70.000, 52.031, 37.969.)
  4. A hypothetical sample of \(n=100\) independent losses follows a fitted normal model \(X\sim N(100,20^2)\), where 20 is the standard deviation. Use categories \(X<80\), \(80\le X\le120\), and \(X>120\). Give expected counts to two decimal places. (Answer: probabilities approximately 0.1587, 0.6827, 0.1587; expected counts approximately 15.87, 68.27, 15.87.)
  5. A hypothetical sample includes only losses exceeding 50 dollars, with \(n=90\). The underlying model is exponential with mean \(\theta=100\) dollars. Partition the recorded losses into \(50<X\le150\) and \(X>150\). Find conditional probabilities and expected counts to two decimal places. (Answer: conditional probabilities 0.6321 and 0.3679; expected counts 56.89 and 33.11.)
Clinical Biostats