Separate two questions about the data

A language model can copy numbers from a table correctly and offer a misleading explanation of the overall rate. Suppose the share of orders completed on time has fallen. This alone does not mean the workshop performed worse within every repair category: the mix of incoming orders may have changed.

First separate two questions. What proportion of all orders was actually completed on time? How did individual repair categories perform when the periods are compared using the same category proportions? The first requires the actual overall rate; the second needs a separate calculation with a fixed mix.

A difference between the direction of subgroup and overall changes is associated with Simpson’s paradox. Microsoft’s study A Dirty Dozen examines a related pitfall in interpreting segments. Our practical output is a short report with two clearly named measures and an explanation of their difference.

Define what the rows and denominator represent

Prepare four fields for the model: period, repair category, number of orders, and number completed on time. Define which orders qualify for comparison. Our example includes orders with collection deadlines within the relevant period; every order’s outcome is known when the report is prepared.

Each order must belong to one category. Assign the repair category at intake and preserve it for analysis. Check that category names and the definition of timely completion remain consistent across both periods. Otherwise, even correct arithmetic will compare different definitions.

Calculate the overall rate by dividing the total number of timely orders by the total number of orders. Google’s official documentation on reaggregation illustrates this principle for ratios: calculate the total from the summed numerator and denominator. Simply averaging existing percentages answers a different question.

Illustrative example: improvement within both categories

All the following data are fictional. A watch repair workshop compares two periods and two categories: strap replacement and movement repair. In the first period, there were 90 strap replacement orders, with 81 completed on time. The corresponding movement repair counts were 10 and 2.

The timely completion rates are therefore 90% for strap replacements and 20% for movement repairs. Overall, 83 of 100 orders were completed on time, giving an actual first-period rate of 83%. Keep the underlying counts alongside every percentage.

In the second period, there were 10 strap replacements, all completed on time, and 90 movement repairs, with 27 completed on time. The category rates are 100% and 30%. Overall, 37 of 100 orders were timely, giving 37%.

Both categories improved by 10 percentage points, while the overall rate fell by 46 points. There is no arithmetic contradiction: movement repairs, which have a lower timely completion rate, accounted for a much larger share in the second period. The AI explanation must preserve both observations.

Recalculate both periods using the same mix

For an additional comparison, choose shared category weights. To calculate a weighted average, multiply each value by its weight, add the products, and divide by the sum of the weights. NumPy’s documentation describes this principle. Here, the weights are category proportions selected in advance.

Use the first-period mix: 90% strap replacements and 10% movement repairs. The first-period calculation is 0.9 × 90% + 0.1 × 20% = 83%. For the second period, using the same weights: 0.9 × 100% + 0.1 × 30% = 93%.

Under this fixed mix, the difference is positive 10 percentage points. The 93% figure is a hypothetical comparison measure; the actual second-period result remains 37%. Record the reason for selecting the weights beforehand and apply them identically to both periods. Choosing weights after inspecting the results makes honest interpretation harder.

Ask AI for a calculation you can check

Example request to a text model: “Compare timely completion across two periods. Show counts and percentages for each repair category, actual overall percentages, and a separate calculation for both periods using the first period’s category proportions. State the weights and intermediate calculations. Distinguish actual results from the hypothetical measure. Do not invent missing counts.”

Provide the example’s four rows together with the measure’s definition. Ask for two closing sentences: what happened across all orders, and what the fixed-mix comparison shows. This connects the conclusion to specific calculations that can be accepted or corrected independently of how persuasive the writing sounds.

A text-based analysis of the small table is sufficient for this task. Check the model’s proposed arithmetic separately with a calculator or spreadsheet. A detailed explanation does not itself establish numerical correctness: verify that the model used the intended numbers, weights, and denominators.

Check stability and the limits of the conclusion

Manually reproduce the four reference results: 83%, 37%, 83%, and 93%. Check that the fixed category proportions total 100% and that each overall measure lies between its category rates. Round after calculating the totals, and describe differences between percentages in percentage points.

For an additional check on an illustrative copy, split the first row of 81 timely orders out of 90 into three rows of 27 out of 30, retaining the same category. The actual first-period total must remain 83%. If it changes, check whether the model assigned a separate weight to every row.

If a category has no observations in one period, its rate is unknown. Do not automatically substitute zero or copy the other period’s value. Record the gap and decide whether comparison is possible using the shared portion of the data. Excluding a category explicitly changes the conclusion’s scope.

This procedure checks arithmetic and the influence of the mix. It does not establish the cause of improvements or assess statistical uncertainty. Small categories can produce unstable percentages. Retain the actual result, hypothetical calculation, underlying counts, and limitations in the final report so readers can see which conclusions the data support.

Sources