Learning outcomes

After this lesson, you will be able to:

The problemA model has only three coefficients, and its prediction fits on one line. Does that mean we understand why it returned a particular value? Only if we know what the features and units mean, how the coefficients were obtained, how stable they are, and where the model applies.

1. Why a linear model can be inspected directly

In the previous lesson, we distinguished a model's own interpretability from an explanation produced by an additional method. A linear model is often called interpretable by design: its structure explicitly connects features and predictions.

Its advantage is not magical transparency but a compact representation. We can inspect which features enter the equation, which weights are assigned to them, and how their values participate in the calculation. Keep three claims separate: the formula is readable; coefficients can be estimated; and coefficients provide a meaningful explanation for the task. The first does not guarantee the other two.

Linear modelA model whose prediction is a linear combination of specified features and estimated parameters. Linearity refers to the parameters; input features may have been transformed beforehand.
Interpretable by designA property of a model whose structure allows its inputs, parameters, and outputs to be inspected directly, without a separate post-hoc explainer.

2. What makes up a linear prediction

For a numerical prediction, the basic model is an intercept plus the sum of feature values multiplied by their coefficients.

The linear modelŷ = β₀ + β₁x₁ + β₂x₂ + … + βₚxₚA prediction as a reference level plus weighted features

Here, ŷ is the model prediction, not necessarily the observed value; xⱼ is feature j; βⱼ is its coefficient; β₀ is the intercept; and p is the number of features.

CoefficientA numerical parameter describing how much the model prediction changes when the corresponding feature increases by one unit, with other features held fixed.
InterceptThe prediction produced when all included features equal zero. Its substantive meaning depends on whether that point is meaningful in the application domain.

The key qualification is “holding other features constant.” β₂ describes the change in the model prediction when x₂ increases by one unit while the other x values remain unchanged. This is a conditional relationship inside the specified model, not a promise that the real world can be changed while everything else stays fixed. Linearity means a constant step on the chosen prediction scale, not proof of a linear law in nature.

An important nuance: linearity refers to the coefficients

“Linear” does not mean that a formula can contain only raw features to the first power. For example, we may include squared floor area:

A transformed featureŷ = β₀ + β₁S + β₂S²The relationship with S may curve, while the coefficients enter linearly

Once S and S² are computed as features, the model is still linear in β₀, β₁, and β₂. Its prediction curve as a function of area may be curved. More precisely, linear regression is linear in its estimated coefficients, not necessarily in the original measurements.

This can help when the same increase in area may matter differently for a small apartment and a very large one. Transformations should have a subject-matter rationale and be checked against data, not added arbitrarily.

3. Read coefficients in a worked example

Consider a teaching example of monthly apartment rent. The target is measured in thousands of rubles. Features are centered at a reference apartment: 50 m² of floor area and 1.5 km from a metro station. The coefficients are invented for teaching and were not estimated from real market data.

Rent model with centered featuresŷ = 55 + 0.45 · (S − 50) − 1.2 · (D − 1.5)Predicted rent in thousands of rubles per month
  • S is floor area in square metres;
  • D is distance to the metro in kilometres;
  • 0.45 is the prediction change, in thousand rubles, for +1 m² when D is unchanged;
  • −1.2 is the prediction change for +1 km when S is unchanged;
  • 55 is the prediction for a 50 m² apartment 1.5 km from the station.

The positive area coefficient means that, at the same metro distance, one additional square metre raises the prediction by 0.45 thousand rubles, or 450 rubles. The negative distance coefficient means that, at the same floor area, one additional kilometre lowers the prediction by 1.2 thousand rubles.

For a 60 m² apartment 0.5 km from the station, the area deviation is +10 m² and the distance deviation is −1 km:

Step-by-step predictionŷ = 55 + 0.45 · 10 − 1.2 · (−1) = 60.760.7 thousand rubles per month

The area contribution is +4.5 thousand rubles, the distance contribution is +1.2 thousand, and the reference level is 55 thousand. The distance coefficient is negative, but this apartment is closer than the reference point, so its contribution relative to that point is positive. This shows the model's arithmetic; it does not prove a causal effect of floor area on actual rent.

Test the rule on three apartments

Keep the coefficients fixed and compare three properties. Amounts are in thousands of rubles per month. These are teaching calculations, not real market estimates.

One set of coefficients, three predictions
ApartmentAreaTo metroArea contributionDistance contributionPrediction
Reference50 m²1.5 km0055.00
Closer and larger60 m²0.5 km+4.50+1.2060.70
Farther and smaller45 m²2.5 km−2.25−1.2051.55

The distance coefficient is always −1.2, but its contribution changes because distance changes relative to 1.5 km. Farther than the reference point gives a negative contribution; closer gives a positive one. The coefficient answers “what is the model's rule for change?” The contribution answers “how did that rule affect this case?”

Pause and predict: if area stays at 60 m² while distance increases from 0.5 to 1.0 km, the prediction falls by 0.6 thousand rubles: distance changes by +0.5 km and its coefficient is −1.2.

4. Global structure and local contribution

A coefficient describes the model as a whole. A feature's contribution to one prediction also depends on its value relative to a chosen reference point. In this example, the area coefficient is always 0.45 thousand rubles per square metre. But the contribution for 51 m² is +0.45 thousand, for 60 m² it is +4.5 thousand, and for 45 m² it is −2.25 thousand relative to 50 m².

From a coefficient to a contributionThe path from a feature value through a coefficient and a deviation from the reference to a local contribution and prediction.From a feature to a prediction contributionFeature valuexⱼCoefficientβⱼDeviationxⱼ − xⱼ,refLocal contributionβⱼ · deviationPredictionsum of contributions
The same coefficient describes the model rule; a local contribution shows how one object's feature value shifts its prediction relative to a reference level.
Local decomposition of a centered modelŷ(x) = β₀ + Σⱼ βⱼ · (xⱼ − xⱼ,ref)Reference level β₀ plus individual feature contributions

A reference value xⱼ,ref may be a mean, median, or meaningful benchmark. Changing it changes the baseline-and-contribution decomposition, but not the prediction when the equation is rewritten consistently. Do not treat βⱼ and βⱼxⱼ as the same thing: a coefficient is the model slope; a contribution multiplies it by a feature value or deviation.

5. Units, scaling, and encoding

A coefficient is tied to a unit of measurement. If area is measured in tens of square metres instead of square metres, its numerical coefficient changes by a factor of ten even though predictions remain the same. We therefore cannot simply call the feature with the largest absolute coefficient the most important.

Standardized coefficient for a continuous featureβⱼ* = βⱼ · SD(xⱼ) / SD(y)Prediction change in standard deviations of y for a one-standard-deviation change in xⱼ

SD(xⱼ) is the feature standard deviation; SD(y) is the target standard deviation. Standardization can compare continuous-feature effects on a common scale, but it does not create a universal importance measure. A binary feature's 0-to-1 step has another meaning; a one-hot coefficient compares a category with the omitted reference category; logarithmic and nonlinear transformations change the unit interpretation. Always state the encoding, units, reference point, and “holding other features constant” condition.

Mini-experiment: change the unit, not the apartment

Suppose area is recorded in units of ten square metres rather than individual square metres. Let z = (S − 50) / 10. The area contribution can be written in two equivalent ways:

The same model on a different scale0.45 · (S − 50) = 4.5 · z0.45 per 1 m² is equivalent to 4.5 per 10 m²

The coefficient is now ten times larger, but the prediction has not changed. Area has not suddenly become ten times more important; only the unit changed. Compare coefficient magnitudes only after checking units, encodings, and feature scales.

6. When coefficients are unreliable as explanations

Even a simple model can produce unstable or misleading coefficients. The causes often lie in the data and problem specification, not in the length of the formula.

MulticollinearityA situation in which one feature is strongly related to one or more other features, potentially making individual coefficient estimates unstable.
Coefficient stabilityThe ability of an estimate to remain similar under reasonable changes to the sample, model specification, or fitting procedure.
  • Correlated features. Floor area and number of rooms are related. A model may predict rent well while separating their individual contributions unreliably.
  • Wrong functional form. One constant coefficient may average across nonlinear regimes. Check linearity using residuals and held-out data.
  • Omitted or poorly measured features. Coefficients of included features may reflect more than the relationship attributed to them.
  • Extrapolation. Beyond the data range, the formula extends a line even when that continuation has no substantive meaning.
  • Statistical significance. A small p-value does not prove substantive importance, stability, or causality. Statistical uncertainty, predictive quality, and explanatory quality are different questions.

Ridge and Lasso can reduce coefficient variability or set some weights to zero, but they change the estimation problem and introduce bias. With correlated features, Lasso's selection can depend on the sample. Regularization does not prove that the remaining coefficients are true explanations.

A regression coefficient does not become a causal effect merely because the model is transparent and includes other features. Causal conclusions require a separate causal question, control of confounding, and additional assumptions.

A practical situation: floor area or number of rooms?

In property listings, larger apartments often have more rooms. If a model includes area alone, its coefficient may partly reflect differences in room count. Adding room count asks the model to separate two closely related features. Estimates may change across samples or feature sets even when overall predictions remain similar.

  1. Compare coefficients before and after adding the related feature.
  2. Check how much estimates change across resamples or small data changes.
  3. Inspect uncertainty and predictive performance on held-out data.
  4. Do not call a coefficient a “pure effect” without a separate causal argument.

A coefficient depends on the feature set, relationships among features, and the data used to fit the model. It should not be read in isolation.

7. Practical experiment: change one feature

Our hypothesis is that, with other features fixed, changing one feature by Δxⱼ changes the prediction by βⱼ·Δxⱼ. Calculate the prediction for a 60 m² apartment 0.5 km from the station, then change only the distance to 1.0 km.

def predict(area_m2, distance_km):
    area_effect = 0.45 * (area_m2 - 50)
    distance_effect = -1.2 * (distance_km - 1.5)
    baseline = 55.0
    prediction = baseline + area_effect + distance_effect
    return prediction, baseline, area_effect, distance_effect

for distance in (0.5, 1.0):
    result = predict(area_m2=60, distance_km=distance)
    print(result)

Expected output: (60.7, 55.0, 4.5, 1.2) and (60.1, 55.0, 4.5, 0.6).

When distance increases from 0.5 to 1.0 km, the prediction falls by 0.6 thousand rubles: −1.2 × 0.5. The code does not fit a model or prove coefficient quality; it checks how the specified formula maps inputs to predictions.

Independent task. Change area from 60 to 62 m² while keeping distance fixed. Before running the code, predict the change: +0.9 thousand rubles. Verify it, then explain why this is not a causal experiment on the housing market.

Extra practice: explain the result in words
  1. For an apartment of 45 m² located 2.5 km from the metro, state the sign of each contribution before calculating the prediction.
  2. Explain why the negative distance coefficient gives this apartment a negative distance contribution.
  3. Convert the area coefficient from “per 1 m²” to “per 10 m²” and show that the prediction remains unchanged.

A strong answer: states units, reference point, sign and size of each contribution, the “holding other features constant” condition, and avoids causal claims based only on model arithmetic.

8. How to assess whether a linear model is explainable

Before presenting coefficients, check not only whether the equation exists but also whether the conditions for interpreting it are reasonable.

  • Meaningful features. Each feature has a clear definition, unit, and reproducible measurement rule.
  • Transparent encoding. Reference categories, transformations, missing-value handling, interactions, and centering are documented.
  • Stability. Coefficients do not change radically under reasonable sample or specification changes; estimation uncertainty is reported.
  • Adequate form. Residuals and held-out validation do not indicate severe nonlinearity or systematic error.
  • Scope. The case lies within the data domain; limitations and prohibited causal claims are explicit.
  • Audience comprehension. The explanation states units and the “holding other features constant” condition, not just the sign and number.

If these conditions fail, say: “The model has a simple linear form, but its individual coefficients cannot be reliably treated as standalone explanations.”

A template for a careful coefficient explanation

When reporting a coefficient, use five parts:

  1. Feature and unit: which measurement are we discussing?
  2. Change: by how many units does the feature change?
  3. Direction and magnitude: how much does the model prediction change?
  4. Condition: which other features are held constant?
  5. Limitation: where does the statement apply, and why is it not automatically causal?

For example: “In this teaching model, a 1 m² increase in area is associated with a 0.45-thousand-ruble increase in predicted rent, holding distance to the metro constant. This is a conditional relationship within the model and the illustrated range, not an estimate of a causal effect.”

9. Summary and the next lesson

A linear model is convenient to inspect because it exposes an explicit prediction formula. But a meaningful explanation requires more than reading a coefficient's sign.

  • The formula shows how features and parameters produce a prediction.
  • A coefficient describes prediction change per feature unit, with other features fixed and encoding specified.
  • A local contribution depends on the feature value and reference point.
  • Scale determines the coefficient's numerical value and whether comparisons are meaningful.
  • Correlated features, instability, misspecification, extrapolation, and confusing association with causation limit naive interpretation.

In lesson 6.1.4, we will move from coefficients to decision trees and examine how a sequence of conditions creates an understandable path from features to a prediction.

Sources and further reading

  1. James et al. An Introduction to Statistical Learning, 2nd ed. — Linear regression, estimation, and diagnostics.
  2. Hastie, Tibshirani, Friedman. The Elements of Statistical Learning, 2nd ed. — Linear models, regularization, and statistical limitations.
  3. Molnar. Interpretable Machine Learning — Linear Models. — Coefficient interpretation and limitations of linear models.
  4. scikit-learn. Linear Models. — Documentation on linear models and coefficient estimation.
  5. NIST/SEMATECH e-Handbook of Statistical Methods. — Regression analysis, diagnostics, and residuals.

Lesson glossary

01Linear modelRussian: Линейная модель

A prediction represented as a linear combination of features and parameters.

02CoefficientRussian: Коэффициент

A parameter describing prediction change per feature unit, holding other features fixed.

03InterceptRussian: Свободный член

The formula value when features are zero; meaning depends on the reference point.

04Local contributionRussian: Локальный вклад

The part of a prediction associated with a feature's deviation from a chosen reference.

05CenteringRussian: Центрирование

Subtracting a reference feature value to make interpretation easier.

06StandardizationRussian: Стандартизация

Transforming a feature to a common scale using its mean and standard deviation.

07MulticollinearityRussian: Мультиколлинеарность

Strong dependence among features that can make individual coefficients unstable.

08ExtrapolationRussian: Экстраполяция

Applying a model outside the range of data where its adequacy was checked.

09Linearity in parametersЛинейность по параметрам

A property of a model whose estimated coefficients enter linearly, even when transformed features are used.

Self-check

Choose one answer and select Check answer. Feedback explains the principle and what to review.

1. How should β₂ be read in a linear model?

2. What does the intercept mean in the centered rent model?

3. Why does distance coefficient −1.2 create a positive contribution for D = 0.5 km?

4. Can coefficients for area in m² and tens of m² be compared directly?

5. What can happen under multicollinearity?

6. Does statistical significance prove a causal interpretation?

7. What does the practical experiment test?