Tutorials › Exam PA - Predictive Analytics › Prediction Error on Original and Transformed Scales

Exam PA · Success Criteria and Metric Choice · Tutorial 86 of 966

Prediction Error on Original and Transformed Scales

Compare prediction errors on their original and transformed scales, and interpret what each scale rewards.

Beginner 10 min read

What You'll Learn

  • Define response-scale and transformed-scale prediction errors
  • Interpret log-scale errors as ratios and approximate percentage differences
  • Compare models when response-scale and transformed-scale rankings disagree
  • Check that an inverse-transformed prediction is in the transformation's domain
  • Distinguish an exponentiated log prediction from a conditional mean
  • Identify common traps in comparing errors across scales

Why the Scale of an Error Matters

A prediction error is not meaningful without knowing the scale on which it is calculated. For a monetary response, an error of $100 may be important for a $200 payment but minor for a $20,000 payment. A transformed-scale error, such as a difference between logarithms, instead describes a difference in relative size. The two scales can therefore tell different stories about the same predictions and can rank candidate models differently.

The evaluation scale should reflect what a prediction is meant to support. If a decision depends on the number of dollars by which a prediction misses, response-scale errors are directly interpretable. If proportional discrepancies matter more than dollar discrepancies, a transformed scale may be more useful. The choice is substantive, not merely a calculation detail.

Definition: Let \(y\) be an observed response and \(\hat{y}\) its prediction on the original response scale. The signed response-scale error is \(e_y=y-\hat{y}\). For a transformation \(g\), let \(z=g(y)\) and let \(\hat{z}\) be the model's prediction on the transformed scale. The signed transformed-scale error is \(e_g=g(y)-\hat{z}\). If \(\hat{z}=g(\hat{y})\), this error is \(g(y)-g(\hat{y})\); in general, it is not \(g(y-\hat{y})\).

For example, if \(g(y)=\ln(y)\), then both the observed and predicted responses must be positive. When the transformed prediction is the logarithm of a positive response-scale prediction, the transformed error is a log ratio:

$$ e_g=\ln(y)-\ln(\hat{y})=\ln\left(\frac{y}{\hat{y}}\right). $$

This error is dimensionless: it does not have units of dollars, days, or counts. Its sign indicates whether the prediction is above or below the observation, and its magnitude reflects a multiplicative discrepancy. For instance, \(e_g=\ln(1.2)\) means the observation is 1.2 times the prediction. A transformed-scale error should not be reported as though it were a dollar error.

What Log Errors Say About Relative Differences

The logarithm makes proportional differences easier to compare across response sizes. Suppose the prediction is \(y\) times a factor \(1+r\), so that \(\hat{y}/y=1+r\), with \(1+r>0\). Then the log difference from observation to prediction is \(\ln(1+r)\). For small relative errors, this is approximately \(r\), which explains why log differences are often interpreted as approximate percentage differences.

$$ \ln\left(\frac{\hat{y}}{y}\right) =\ln(1+r) =r-\frac{r^2}{2}+\frac{r^3}{3}-\cdots \approx r \quad\text{when } |r| \text{ is small.} $$

The approximation is not exact, especially for large errors. A prediction 10% above the observation has a log ratio of \(\ln(1.1)\approx0.0953\), while one 10% below has a log ratio of \(\ln(0.9)\approx-0.1054\). Their magnitudes differ because the same percentage difference, calculated relative to the observation, is not the same multiplicative factor in both directions. By contrast, a prediction that is twice the observation and one that is half the observation have log-ratio magnitudes \(\ln(2)\) in both cases.

This is one reason transformed-scale evaluation can be useful when errors are naturally understood as factors or proportions. But it also means that the transformation changes the question being answered. It does not simply make a response-scale metric easier to calculate.

Worked Example: Comparing Dollar Errors With Log Errors

A hypothetical service team predicts the dollar amount of two payments. The observed payments are $100 and $1,000. Model A predicts $50 and $1,000; Model B predicts $100 and $800. Compare the models using total absolute error on the original scale and total absolute error after taking natural logarithms. Use full precision in intermediate calculations and round reported log errors to four decimal places.

Method. Calculate each model's absolute dollar errors, then calculate \(\left|\ln(y)-\ln(\hat{y})\right|=\left|\ln(y/\hat{y})\right|\) for each observation. The first total answers a dollar-error question; the second answers a log-ratio question.

Model A, original scale. For the $100 payment, the absolute error is \(|100-50|=$50\). For the $1,000 payment, it is \(|1{,}000-1{,}000|=$0\). The total is \(50+0=$50\).

Model B, original scale. The absolute errors are \(|100-100|=$0\) and \(|1{,}000-800|=$200\). The total is \(0+200=$200\). By total absolute dollar error, Model A is preferred.

Model A, log scale. The log errors in absolute value are \(|\ln(100/50)|=\ln(2)\approx0.6931\) and \(|\ln(1{,}000/1{,}000)|=0\). The total is \(0.6931\).

Model B, log scale. The corresponding values are \(0\) and \(|\ln(1{,}000/800)|=\ln(1.25)\approx0.2231\). The total is \(0.2231\). By total absolute log error, Model B is preferred.

Check. The dollar-scale result is driven by a $200 miss on the larger payment, while the log-scale result compares multiplicative discrepancies: Model A misses one payment by a factor of two, and Model B misses one by a factor of 1.25. The rankings differ because the scales assess different kinds of error. The trap is to treat the log total as a smaller number of dollars; it is not.

Model Rankings Can Reverse

The scale can change a model ranking even when both comparisons use squared errors. This is not a contradiction: squaring errors does not remove the effect of transforming the response first. The quantities being squared are different, and their units and interpretations are different.

Worked Example: Squared Errors Before and After a Log Transformation

For two positive hypothetical claim amounts, the observed responses are \(2\) and \(6\), in thousands of dollars. Model C predicts \(1\) and \(5\); Model D predicts \(2\) and \(4\). Compare the sums of squared errors on the original scale and on the natural-log scale. Round transformed totals to four decimal places.

Original-scale calculation. Model C has errors \(2-1=1\) and \(6-5=1\), so its sum of squared errors is \(1^2+1^2=2\). Model D has errors \(2-2=0\) and \(6-4=2\), so its sum is \(0^2+2^2=4\). The original-scale sum favors Model C.

Log-scale calculation for Model C. The absolute log errors are \(\ln(2/1)=\ln(2)\) and \(\ln(6/5)=\ln(1.2)\). Their squared values are \((\ln 2)^2\approx0.480453\) and \((\ln 1.2)^2\approx0.033241\). Thus, the sum is approximately \(0.480453+0.033241=0.513694\), or \(0.5137\) to four decimal places.

Log-scale calculation for Model D. The first log error is \(\ln(2/2)=0\). The second is \(\ln(6/4)=\ln(1.5)\), whose square is approximately \(0.164402\). The sum is therefore \(0+0.164402=0.1644\), to four decimal places. On the log scale, Model D is preferred.

Check. Original-scale sums are \(2\) for C and \(4\) for D; log-scale sums are \(0.5137\) for C and \(0.1644\) for D. The ranking reversal is correct. The common calculation trap is premature rounding: \((\ln 2)^2\) is approximately \(0.4805\), and the full transformed sum is \(0.5137\), not \(0.5136\).

Returning Predictions to the Response Scale

A model that predicts \(z=g(y)\) may need to produce a response-scale prediction for operational use. If \(g\) is one-to-one over the relevant response range, and \(\hat{z}\) lies in the image of that range under \(g\), the corresponding response-scale prediction is \(g^{-1}(\hat{z})\). Both conditions matter: one-to-one behavior gives a unique inverse for values in the image, but does not make the inverse available for values outside the image.

For the natural logarithm on positive responses, the image is all real numbers, so exponentiating any finite \(\hat{z}\) gives a positive response-scale prediction. Other transformations can have more restricted images. For example, \(g(y)=y^2\) on the response range \(y>0\) is one-to-one, but its image is positive values only. A predicted transformed value of \(-1\) has no response-scale inverse in that range. It is not valid to take a square root and report a real response prediction.

Even when inversion is valid, exponentiating a prediction of a conditional mean on the log scale does not generally produce the conditional mean on the original scale. If \(\ln(Y)\mid X\) is normally distributed with mean \(m\) and variance \(\sigma^2\), then \(Y\mid X\) is lognormal, its conditional mean is \(\exp(m+\sigma^2/2)\), and its conditional median is \(\exp(m)\). Thus, \(\exp(m)\) is not the conditional mean when \(\sigma^2>0\). The intended prediction target must be clear before inverse transformation is used.

Worked Example: Interpreting Log Predictions on Both Scales

A hypothetical model predicts natural logarithms of payment amounts. For two cases, the observed amounts are $120 and $300, and the model's transformed predictions are \(\ln(100)\) and \(\ln(400)\). Calculate the response-scale predictions, signed errors on both scales, and the multiplicative interpretation of the log errors. Use the convention observed minus predicted; report log errors to four decimal places.

Step 1: Invert the predictions. Since the response is positive and the natural logarithm's image is all real numbers, the inverse is defined for both predictions. Exponentiating gives response-scale predictions of \(\exp(\ln 100)=$100\) and \(\exp(\ln 400)=$400.

Step 2: Calculate response-scale errors. The first error is \(120-100=$20\). The second is \(300-400=-$100\). The model underpredicts the first amount and overpredicts the second.

Step 3: Calculate transformed-scale errors. For the first case, \(\ln(120)-\ln(100)=\ln(1.2)\approx0.1823\). For the second, \(\ln(300)-\ln(400)=\ln(0.75)\approx-0.2877\). The signs agree with the response-scale errors, but the values are log ratios, not dollars.

Step 4: Interpret the ratios. The first observation is \(1.2\) times its prediction, or 20% higher. The second observation is \(0.75\) times its prediction, or 25% lower. These ratios explain why the log errors can be compared across payment sizes, but they do not imply that either miss has the same dollar impact.

Check. Exponentiating the stated predictions recovers $100 and $400. The first response error is positive and its log ratio exceeds zero; the second response error is negative and its log ratio is below zero. Confusing a log error with a dollar error would assign the wrong units and interpretation.

Choosing and Reporting the Evaluation Scale

The scale should be chosen before comparing candidate models, based on what a prediction is used for and how stakeholders understand a miss. Original-scale errors are usually appropriate when costs or consequences depend on absolute response differences. A transformed scale may be appropriate when relative differences are central, when response variability grows with response size, or when a multiplicative interpretation is natural. These are reasons to consider a scale, not guarantees that a particular transformation is suitable.

When reporting a comparison, name the scale, the transformation, and the error criterion. For example, “Model B has the lower mean absolute log error, so it is better by proportional fit under this criterion” is more informative than “Model B has lower error.” If original-scale consequences matter as well, report an original-scale evaluation too. Do not compare raw numeric metric values across scales as though they shared units.

1
State the prediction target.
Specify whether the required prediction is an original-scale amount, a transformed-scale quantity, or a particular conditional summary such as a mean.
2
Define the transformation and its range.
Check which response values are allowed and whether each predicted transformed value can be mapped back to a valid response.
3
Interpret the proposed errors.
Describe their units and what a large or small error means for the decision. For log errors, distinguish ratios from absolute dollar differences.
4
Compare models using a common criterion.
Apply the same scale and error definition to all models in a comparison, and report the scale explicitly. If the business meaning requires both perspectives, show both without treating them as interchangeable.
Key takeaway: A transformation changes the meaning of prediction error. Response-scale errors describe absolute misses; log-scale errors describe multiplicative differences. Model rankings may reverse, so select and label the scale that corresponds to the prediction's intended use.

Check Your Understanding

For each problem, identify the scale being evaluated and interpret the result in context.

  1. An observed positive response is 50 and its prediction is 45. What is the absolute natural-log error \(\left|\ln(y)-\ln(\hat{y})\right|\), rounded to four decimals? (Answer: \(\ln(10/9)\approx0.1054\), a log-ratio error.)
  2. An observed payment is $200 and its prediction is $250. Calculate the signed log error using observed minus predicted, to four decimals, and give the ratio interpretation. (Answer: \(\ln(200/250)=\ln(0.8)\approx-0.2231\); the observation is 0.8 times the prediction, or 20% lower.)
  3. Observed positive responses are 20 and 80. Model M predicts 10 and 80; Model N predicts 20 and 60. Which model has the lower total absolute error on the original scale, and which has the lower total absolute log error? (Answer: Original scale favors M, with total \(10\) versus \(20\); log scale favors N, with \(\ln(4/3)\approx0.2877\) versus \(\ln 2\approx0.6931\).)
  4. A model predicts \(\ln(300)\) for an observed response of 330. Give its inverse-transformed prediction and its signed log error to four decimals. (Answer: Prediction \(300\); log error \(\ln(330/300)=\ln(1.1)\approx0.0953\), so the observation is 10% higher.)
  5. The response range is \(y>0\), the transformation is \(g(y)=y^2\), and a model predicts transformed value \(-4\). Can this prediction be mapped back to a response in the stated range? (Answer: No. The image of \(g\) on \(y>0\) is positive values, so \(-4\) is outside the image and has no valid inverse there.)
Clinical Biostats