Tutorials › Exam PA - Predictive Analytics › Summarizing Numeric and Categorical Outcomes

Exam PA · Data Structures and Exploratory Summaries · Tutorial 117 of 966

Summarizing Numeric and Categorical Outcomes

Choose summaries that match the target’s data type, then interpret what those summaries reveal—and what they do not.

Beginner 10 min read

What You'll Learn

  • Distinguish numeric outcomes from categorical outcomes when choosing summaries
  • Use summary(), mean(), median(), quantile(), and IQR() to describe numeric targets
  • Use table() and prop.table() to summarize categorical targets
  • Interpret a binary outcome’s mean as an occurrence proportion when it is coded as an indicator
  • Check denominators and missing values before interpreting a summary
  • Explain why an overall summary describes a sample but does not establish a cause

Match the Summary to the Outcome

A useful exploratory summary begins by asking what the target represents and how it is stored. Claim amount in dollars is numeric: arithmetic such as an average amount has a direct interpretation. Claim occurrence, recorded as “Yes” or “No,” is categorical: counts and proportions of the categories are the natural summaries. Treating both targets the same way can produce an answer that is numerically valid but answers the wrong question.

The earlier material on variable classes and basic summaries provides the R tools used here. This tutorial focuses on choosing among those tools and interpreting the result in context. For a numeric target, a summary can describe location, spread, and range. For a categorical target, it can describe how observations are distributed across categories. In either case, first identify which observations are included and what the denominator represents.

Definition: A numeric outcome is a target recorded on a quantitative scale, for which numerical operations such as differences and averages are meaningful. A categorical outcome assigns each observation to a category; its basic summaries are category counts and proportions. A binary outcome has exactly two categories, such as claim occurrence recorded as “No” or “Yes.”

In R, `summary(x)` provides a compact first look, but its output depends on the class of `x`. For a numeric vector, it reports the minimum, first quartile, median, mean, third quartile, and maximum, with missing values noted when present. For a factor, it reports counts by level. Use `table(x)` when you want explicit category counts, and `prop.table(table(x))` when you want the corresponding proportions.

Summarizing a Numeric Target

For numeric outcomes, no single statistic tells the whole story. The mean uses all observed values but can be pulled by unusually large or small values. The median marks the middle of the ordered observations and is less affected by extreme values. The quartiles and interquartile range describe the middle half of the data, while the minimum and maximum show the observed endpoints. These measures are descriptive: they summarize the data provided, not every possible future outcome.

For a numeric vector `x`, R’s `mean(x)` and `median(x)` calculate the mean and median. `quantile(x)` returns selected quantiles, including the quartiles by default, and `IQR(x)` returns the difference between the third and first quartiles. R’s default quantile calculation uses interpolation, so a reported quartile need not be an observed data value. If there are missing observations, `mean(x, na.rm = TRUE)`, for example, excludes them from that calculation. The resulting statistic then describes the non-missing observations, so the number excluded should also be checked.

Worked Example: Summarizing Claim Amounts

A hypothetical insurer reviews six positive claim amounts, in dollars: 120, 180, 180, 240, 480, and 900. Find the mean, median, quartiles, and interquartile range, and state what the mean and median suggest about these observed amounts.

Method. Treat the six values as a numeric severity outcome. They are already ordered, so first calculate the mean and median, then use R’s default type 7 quartiles to describe the middle half.

Mean. The total is \(120 + 180 + 180 + 240 + 480 + 900 = 2{,}100\). Dividing by six gives \(2{,}100 / 6 = 350\) dollars.

Median. With six observations, the median is the average of the third and fourth values: \((180 + 240)/2 = 210\) dollars.

Quartiles. With R’s default type 7 rule, the first-quartile position is \(1 + (6 - 1)(0.25) = 2.25\). The second and third values are both 180, so the first quartile is 180. The third-quartile position is \(1 + (6 - 1)(0.75) = 4.75\). Interpolating three quarters of the way from 240 to 480 gives \(240 + 0.75(480 - 240) = 420\). Thus, the interquartile range is \(420 - 180 = 240\) dollars.

In R, `summary(amount)` would report a minimum of 120, first quartile 180, median 210, mean 350, third quartile 420, and maximum 900. The mean exceeds the median because the larger observations, especially 900, pull the mean upward. The median describes the center of these observed claims in a way that is less sensitive to the largest amount. The calculations check: the mean uses all six values, and the two quartiles give an interquartile range of 240 dollars.

Common mistake avoided. Calling 350 dollars “the typical claim” without qualification hides the influence of the large values. Report the mean and a resistant center such as the median when the distribution may be skewed.

Summarizing a Categorical Target

A categorical outcome is summarized by how many observations fall into each category. If the categories are “No” and “Yes,” `table(occurrence)` gives their counts. Dividing each count by the total number of eligible observations gives a proportion; in R, `prop.table(table(occurrence))` performs that division. A proportion is interpretable only alongside its denominator and the rule for which observations were included.

For claim occurrence, a “Yes” proportion describes the fraction of the specified observations with a recorded claim. It is not automatically a claim frequency per unit of exposure: that interpretation would require an appropriate exposure denominator and definition. Also, a table of factor levels may include a category with a count of zero, which can be useful because it makes the intended categories visible. Missing values require an explicit decision; they are not the same as “No.”

Worked Example: Claim-Occurrence Counts and Proportions

A hypothetical review includes 20 policies, each observed for the same stated period. Twelve have a recorded claim and eight do not. Summarize occurrence with counts and proportions, and interpret the result.

Method. Occurrence is categorical, so use a frequency table and divide each category count by the number of observed policies. In R, `table(occurrence)` produces the counts and `prop.table(table(occurrence))` produces proportions.

Counts. The “Yes” count is 12 and the “No” count is 8. Their total is \(12 + 8 = 20\), which checks against the number of policies.

Proportions. The “Yes” proportion is \(12/20 = 0.60\), or 60%. The “No” proportion is \(8/20 = 0.40\), or 40%. They sum to \(0.60 + 0.40 = 1.00\).

The observed claim-occurrence proportion is 60% among these 20 policies over the stated period. It does not say that 60% of all policies in a larger population will have a claim, nor does it explain why the observed policies differ. The denominator and observation period are part of the interpretation.

Common mistake avoided. Reporting “12 claims” could confuse a count of policies with claims or omit the relevant denominator. Here the data say that 12 of 20 policies had a recorded claim, and the corresponding proportion is 60%.

A Binary Indicator and Its Mean

A binary outcome can also be coded numerically as an indicator: let \(Y_i = 1\) when observation \(i\) is a “Yes” and \(Y_i = 0\) when it is a “No.” The average of this indicator equals the proportion of “Yes” outcomes. This gives a useful connection between numeric calculation and a categorical summary, but only because the coding has a specific meaning.

$$ \bar{Y} = \frac{1}{n}\sum_{i=1}^{n}Y_i = \frac{\text{number of Yes outcomes}}{n} $$

To see why, each “Yes” contributes 1 to the sum and each “No” contributes 0. Therefore, the sum of the indicators is exactly the number of “Yes” outcomes. Dividing by the number \(n\) of observed outcomes gives the fraction that are “Yes,” which is the “Yes” proportion. If an observation is missing, it contributes to neither the indicator sum nor the denominator when it is excluded; it must not be silently counted as a “No.”

Worked Example: Separating Occurrence From Severity

For ten hypothetical policies observed over the same period, four have a claim and six have none. The positive claim amounts are 100, 200, 200, and 500 dollars. Calculate the occurrence proportion and the mean positive claim amount. Explain why they answer different questions.

Method. Summarize the binary occurrence outcome across all ten policies, then summarize the numeric severity outcome only among the four policies with a positive claim. Keep the two denominators separate.

Occurrence. The proportion with a claim is \(4/10 = 0.40\), or 40%. With an indicator coded 1 for a claim and 0 otherwise, the indicator mean is also \(4/10 = 0.40\).

Positive claim amount. The total of the four positive amounts is \(100 + 200 + 200 + 500 = 1{,}000\) dollars. Their mean is \(1{,}000/4 = 250\) dollars. The ordered amounts are 100, 200, 200, and 500, so their median is \((200 + 200)/2 = 200\) dollars.

The 40% proportion describes how many of the ten policies had a claim. The 250-dollar mean describes the average amount among the four positive claims, not the average across all ten policies. The calculations check against their respective denominators: ten for occurrence and four for positive severity.

Common mistake avoided. Dividing the positive claim total of 1,000 dollars by ten gives 100 dollars per policy, but that is not the mean positive claim amount. It is the total positive amount divided across all ten policies; it answers a different question. Do not call it an average severity.

Choosing and Reporting a Summary

The appropriate summary follows from the target and the question being asked. Use numeric summaries to describe the values of a quantitative outcome. Use category counts and proportions to describe a categorical outcome. For a binary target encoded as 0 and 1, its mean is a proportion, not a general-purpose average of category labels.

1
Identify the target and its class.
Decide whether the target is quantitative, categorical, or binary. A numeric-looking code is not necessarily a quantitative measurement.
2
Set the analysis population.
State which observations are included, the relevant period, and how missing target values are handled.
3
Select summaries that answer the question.
For numeric values, consider a center and measures of spread or range. For categories, report counts and proportions with their denominator.
4
Interpret in context.
Describe what the observed values show, and avoid turning an overall descriptive summary into a causal or population-wide claim without supporting design and analysis.

A common exam trap is to confuse the data type of the target with the R storage class. A binary indicator stored as an integer can be summarized with a mean, but the mean is meaningful as an occurrence proportion only when zero and one have the stated “No” and “Yes” interpretation. Likewise, an integer amount in dollars remains a numeric outcome; its integer storage does not make it categorical.

Another trap is to compare summaries with different denominators as though they were interchangeable. Positive claim severity excludes policies with no claim, while occurrence includes both policies with and without claims. Missing observations can change either denominator. A careful report states the summary, the included observations, and the unit of measurement. These choices support clear exploratory analysis aligned with the SOA Exam PA (Predictive Analytics) syllabus.

Key takeaway: Numeric targets call for summaries of values; categorical targets call for counts and proportions. Always state the denominator, identify exclusions such as missing values, and interpret each statistic as an answer to a specific question.

Check Your Understanding

For each problem, choose a suitable summary and keep the target’s meaning and denominator explicit.

  1. A hypothetical set of five positive repair claims is 80, 120, 120, 280, and 400 dollars. Find the mean and median. (Answer: mean = $200; median = $120.)
  2. In a hypothetical review of 25 accounts, 7 have a late payment and 18 do not. Give the late-payment count and proportion, and check the category proportions sum to one. (Answer: 7 late, proportion 0.28; 18 not late, proportion 0.72; total proportion 1.00.)
  3. A binary outcome is coded 1 for “renewed” and 0 for “did not renew.” Among 40 observed policies, 30 renewed. What is the indicator mean, and how should it be interpreted? (Answer: 0.75, the observed renewal proportion among the 40 policies.)
  4. A hypothetical portfolio has 12 policies, 3 with positive claims and 9 with none. The positive amounts are 150, 250, and 500 dollars. Find the positive-claim mean and the occurrence proportion, identifying both denominators. (Answer: mean positive claim amount = $300 using 3 claims; occurrence proportion = 0.25 using 12 policies.)
  5. A numeric outcome has 8 recorded values and 2 missing values. If `mean(x, na.rm = TRUE)` returns 45, how many observed values contribute to the mean, and what must be stated when interpreting it? (Answer: 8 observed values contribute; state that the mean describes the non-missing values, with 2 of the 10 records excluded.)
Clinical Biostats