Tutorials › Regression Analysis (Undergraduate) › Maintenance Costs for Explanation and Prediction

Integrated Applied Case Studies · Tutorial 987 of 991

Maintenance Costs for Explanation and Prediction

Compare models for explaining adjusted relationships between vehicle age, usage, and maintenance cost with models judged by how accurately they predict costs for new vehicles.

Advanced 12 min read

What You'll Learn

  • Define an adjusted association and distinguish it from a causal effect.
  • Interpret age and usage coefficients in a multiple regression for annual maintenance cost.
  • Calculate and compare validation-set prediction errors using MAE and RMSE.
  • Evaluate how nonlinear terms and useful predictors can improve prediction without answering the same explanatory question.
  • Identify assumptions, data checks, and common pitfalls when comparing models for different purposes.

Two Questions About Fleet Costs

A fleet manager may ask, “How is annual maintenance cost associated with vehicle age, after accounting for usage?” An analyst answering this question needs a model whose terms match the adjusted relationship of interest and whose coefficients can be interpreted accordingly. The manager may also ask, “How accurately can we predict next year’s maintenance cost for vehicles we have not yet analyzed?” That calls for judging predictions on data not used to fit the model.

These questions concern the same outcome, but they are not interchangeable. A model that is useful for describing an adjusted association is not automatically the most accurate predictor. Conversely, a predictor can use a convenient signal without giving a meaningful estimate of the relationship between age and cost. Neither objective, by itself, establishes that vehicle age causes maintenance costs to change.

Definition: An adjusted association describes the relationship between a predictor and an outcome while holding specified other predictors fixed in a model. A prediction model is judged by how accurately its predicted outcomes approximate outcomes for new observations drawn from the intended use setting.

Set the Outcome, Predictors, and Objective

Suppose \(Y_i\) is the annual maintenance cost, in dollars, for vehicle \(i\). Let \(A_i\) denote the vehicle’s age in years, \(U_i\) its annual usage in thousands of miles, and \(C_i\) an indicator equal to 1 for a heavy-duty vehicle and 0 otherwise. A simple multiple linear regression specification is

$$ Y_i=\beta_0+\beta_A A_i+\beta_U U_i+\beta_C C_i+\varepsilon_i. $$

Here, \(\beta_A\), \(\beta_U\), and \(\beta_C\) are population regression coefficients, and \(\varepsilon_i\) represents variation in cost not accounted for by the predictors. The corresponding fitted model replaces the coefficients with estimates. In this specification, \(\beta_A\) describes the difference in mean cost associated with a one-year difference in age when usage and vehicle class are held fixed. It does not describe the effect of changing a vehicle’s age while everything else in the real world is somehow held constant.

For conventional coefficient-based inference in this model, the conditional mean must be represented adequately by the stated linear form; observations must be independent; and the error variance must be constant across predictor values. Exact small-sample \(t\)-based inference also assumes normally distributed errors conditional on the predictors. The predictors must not be perfectly collinear. These assumptions support inference about the model coefficients, not a causal interpretation. For prediction, the main practical requirements are that inputs will be available at the time predictions are made, the outcome is defined consistently, and the evaluation data reasonably represent the intended future setting.

Key distinction: Choose an explanatory specification to represent the adjusted relationship the question asks about. Choose a predictive specification by its performance on data not used to fit it. In either case, state what the model can and cannot support.

Why a Coefficient Is an Adjusted Association

The meaning of the age coefficient follows directly by comparing fitted conditional means for two vehicles that differ in age but have the same usage and class. In the model above, their difference in age is one year, and the other terms cancel:

$$ \begin{aligned} E(Y\mid A=a+1,U=u,C=c)-E(Y\mid A=a,U=u,C=c) &=\beta_0+\beta_A(a+1)+\beta_Uu+\beta_Cc\\ &\quad-(\beta_0+\beta_Aa+\beta_Uu+\beta_Cc)\\ &=\beta_A. \end{aligned} $$

This justifies interpreting \(\beta_A\) as a one-year adjusted association in this particular model. If the model omits an important variable related to both age and cost, or if the linear form is inappropriate, the fitted coefficient may not describe the intended adjusted relationship well. The interpretation is also specific to the predictors included: “adjusted for usage and class” is not the same as “adjusted for every relevant factor.”

Worked Example: Interpreting an Adjusted Age Coefficient

Hypothetical data: An analyst fits the model above to 60 fleet vehicles. The fitted age coefficient is \(\hat{\beta}_A=\$145\) per year, with \(SE(\hat{\beta}_A)=\$52\). Suppose the residual and design checks give no major concern about the linear form, independence, constant variance, or collinearity, and the residual distribution is plausible for the stated \(t\)-based interval. There are four fitted coefficients including the intercept, so \(df=60-4=56\).

Using \(t^*=2.003\) for a 95% interval with 56 degrees of freedom, the interval is

$$ 145\pm 2.003(52)=145\pm104.156, $$

which gives approximately \((\$40.8,\$249.2)\) per year. In this fitted linear model, among vehicles with the same annual usage and class, a one-year age difference is associated with an estimated \(\$145\) difference in mean annual maintenance cost. The interval is consistent with adjusted increases from about \(\$40.8\) to \(\$249.2\) per year under the model assumptions. It is not evidence that making a vehicle one year older causes its cost to rise by this amount.

Assess Predictions on Separate Data

A model’s fitted values describe the data used to estimate its coefficients. They do not, by themselves, establish how well the model predicts new vehicles. A direct assessment holds aside observations from fitting, generates predictions for them using only their available predictors, and compares the predictions with their observed costs. The held-aside data must not also be used to choose between candidate models; otherwise the reported performance can be overly optimistic.

For a held-aside set of \(m\) vehicles, let \(y_i\) be the observed cost and \(\hat{y}_i\) the prediction. The mean absolute error (MAE) is the average absolute prediction error; the root mean squared error (RMSE) is the square root of the average squared prediction error. Both are measured in the outcome’s units, here dollars. Lower values indicate closer predictions on that evaluation set, though neither guarantees equally good performance for every subgroup or future fleet.

$$ \operatorname{MAE}=\frac{1}{m}\sum_{i=1}^{m}|y_i-\hat{y}_i|, \qquad \operatorname{RMSE}=\sqrt{\frac{1}{m}\sum_{i=1}^{m}(y_i-\hat{y}_i)^2}. $$

Worked Example: Comparing Two Models on Held-Aside Vehicles

Hypothetical data: Four vehicles held out from model fitting have observed annual costs of \(\$1{,}200\), \(\$1{,}600\), \(\$2{,}000\), and \(\$2{,}400\). Model L predicts \(\$1{,}300\), \(\$1{,}700\), \(\$1{,}900\), and \(\$2{,}100\). Model F predicts \(\$1{,}150\), \(\$1{,}750\), \(\$1{,}900\), and \(\$2{,}350\). Assume these vehicles represent the setting in which predictions will be used, and both models were finalized without using these four outcomes.

For Model L, the absolute errors are \(\$100,\$100,\$100,\$300\), so

$$ \operatorname{MAE}_L=\frac{100+100+100+300}{4}=\$150, \qquad \operatorname{RMSE}_L=\sqrt{\frac{100^2+100^2+100^2+300^2}{4}} =\sqrt{30{,}000}\approx\$173.2. $$

For Model F, the absolute errors are \(\$50,\$150,\$100,\$50\), so

$$ \operatorname{MAE}_F=\frac{50+150+100+50}{4}=\$87.50, \qquad \operatorname{RMSE}_F=\sqrt{\frac{50^2+150^2+100^2+50^2}{4}} =\sqrt{9{,}375}\approx\$96.82. $$

Model F has the lower MAE and RMSE on these four held-aside vehicles. That is evidence of better prediction on this small evaluation set, not proof that it will always predict better. RMSE gives relatively greater influence to larger errors because it squares them before averaging; MAE summarizes absolute errors without squaring. The metric should reflect the costs of prediction errors in the intended application.

Different Objectives Can Favor Different Specifications

An explanatory model is often chosen to answer a clearly defined relationship question. Its predictors should reflect the adjustment the question calls for, and its form should be defensible for that interpretation. A prediction model instead may benefit from a nonlinear term or a variable that is informative about future costs, even if that variable is not central to the adjusted association of interest. Predictive usefulness does not make a variable a confounder, and an accurate prediction does not make its coefficients causal.

For instance, annual maintenance costs might rise slowly for newer vehicles and more rapidly for older ones. A linear age term forces the same predicted increase per year at every age. A prediction candidate might instead include age squared:

$$ \hat{Y}=500+65A+30U+3A^2, $$

where \(U\) is annual usage in thousands of miles and all predictions are in dollars. The predicted cost for an 8-year-old vehicle driven 18 thousand miles per year is

$$ \hat{Y}=500+65(8)+30(18)+3(8^2) =500+520+540+192=\$1{,}752. $$

The age-related increase in this prediction equation is not constant. Comparing ages \(A+1\) and \(A\), at the same usage, gives

$$ [65(A+1)+3(A+1)^2]-[65A+3A^2]=65+3(2A+1). $$

At age 8, this model predicts a difference of \(65+3(17)=\$116\) between ages 8 and 9 at the same usage. That is a feature of this fitted prediction equation, not a universal effect of aging. The quadratic form should be retained for prediction only if it improves performance in an appropriate evaluation and is suitable for the intended age range. Extrapolating it far beyond the observed ages can produce implausible predictions.

Worked Example: Naming the Objective Before Choosing a Model

Hypothetical situation: A fleet analyst is asked both to report the adjusted association between vehicle age and annual cost, controlling for usage and vehicle class, and to provide next-year budget predictions. A prespecified linear model gives an estimated age coefficient of \(\$110\) per year, adjusted for usage and class. A second candidate adds \(A^2\) and has smaller errors on a suitable held-aside sample.

For the adjusted-association question, the analyst should report the coefficient from the model that represents the specified adjustment and state that it assumes a constant age association in the linear form. The coefficient is not replaced merely because another specification predicts better: adding \(A^2\) changes the age relationship being described.

For budgeting, the model with \(A^2\) may be preferred if the held-aside comparison is trustworthy and the intended predictions concern vehicles in the observed age and usage ranges. The model’s predicted costs can then be useful even though its coefficients answer a different question. The same fleet data can therefore support two different model choices, provided the objective and limitations are reported clearly.

Common Mistakes and Practical Checks

  • Calling an adjusted association a causal effect. Holding measured predictors fixed in a regression does not eliminate all confounding or establish that changing age would change cost. Describe the coefficient as an adjusted association unless a justified causal design supports stronger language.
  • Choosing a prediction model from its training fit alone. A flexible model can fit its training observations closely without predicting new vehicles well. Compare candidates on observations not used to fit or select them.
  • Using a prediction winner to answer every question. Better prediction does not ensure that the model gives the desired adjusted association. State the target question before selecting the specification.
  • Ignoring when predictors become available. A variable recorded only after next year’s maintenance cannot be used for a genuine advance prediction of that year’s cost.
  • Reporting a validation score without context. State the metric, its dollar units, the evaluation sample, and whether that sample represents intended use. A score from a small or unrepresentative set may be imprecise or misleading.

The practical value of separating objectives is communication as well as analysis. A fleet manager can use an adjusted association to understand how age relates to costs after specified adjustment, and can use a separately assessed prediction model to plan budgets. Reporting the purpose of each model prevents readers from treating predictive accuracy as causal evidence—or treating an interpretable coefficient as a guarantee of accurate future costs.

Check Your Understanding

Answer each question using the fleet-maintenance setting.

  1. In a linear model with age and usage, what does the age coefficient describe when usage is held fixed? Why is that not automatically a causal effect?
  2. A model has a lower RMSE on its training data than another model. What additional evidence is needed before concluding that it predicts new vehicles better?
  3. Why might adding an age-squared term change the interpretation of the age-cost relationship?
  4. Give one reason a variable might be useful for predicting maintenance costs but not belong in a model chosen to estimate a particular adjusted age association.
  5. What does an RMSE of \(\$200\) mean, and what does it not mean?