2.2.16 · D4Linear & Logistic Regression

Exercises — Interpreting model coefficients

2,163 words10 min readBack to topic

Before we start, one tiny toolkit reminder so nothing here is used before it is earned.

Figure — Interpreting model coefficients

Level 1 — Recognition

L1.1

A linear model predicts monthly electricity bill (in $): Read off, in words, what means and what means.

Recall Solution
  • : each one extra kilowatt-hour used adds $0.15 to the predicted bill, holding rooms fixed.
  • : each one extra room adds $5, holding kWh fixed.
  • The is the intercept: predicted bill when and .

L1.2

In a logistic model, a feature has coefficient . What happens to the odds of the "yes" class when that feature increases by 1?

Recall Solution

The odds get multiplied by — i.e. nothing changes. A zero coefficient means "no effect on the odds."

L1.3

Which statement is about linear regression and which about logistic? (a) "One more unit adds to the output." (b) "One more unit multiplies the odds by ."

Recall Solution

(a) is linear — coefficients add. (b) is logistic — coefficients multiply the odds after exponentiating. Mnemonic: Linear adds, Logistic multiplies.


Level 2 — Application

L2.1

House-price model (price in $): A house has 1,000 sqft and 2 bedrooms. Predict its price, then predict again after adding 150 sqft (bedrooms unchanged). By how much did the prediction rise?

Recall Solution

First prediction: . After +150 sqft: . Rise . The change is just .

L2.2

Logistic disease model (smoker = 0/1): Compute the odds ratio for being a smoker, and interpret it.

Recall Solution

Odds ratio . A smoker's odds of disease are about 2.23 times a non-smoker's — a increase in odds (not probability).

L2.3

Using the same model, compute the probability of disease for a non-smoker and for a smoker. (Recall the sigmoid , which turns any log-odds back into a probability between 0 and 1.)

Recall Solution

Non-smoker: log-odds , so . Smoker: log-odds , so . Notice: probability roughly doubled () even though the odds multiplied by . Odds and probability are different animals when is small they happen to be close; they diverge near .

Figure — Interpreting model coefficients

Level 3 — Analysis

L3.1

Two features: income (in $, values ~30,000–120,000) and age (in years, ~20–70). A linear model gives and . A colleague says "age matters 200,000× more than income." Given the standard deviations and , compute the standardized coefficients and re-rank the features.

Recall Solution

Standardized coefficient (effect per one standard deviation of the feature).

  • Income: .
  • Age: . Age still leads, but by a factor of , not 200,000. The raw comparison () was inflated purely by units (dollars vs. years). See Feature Scaling & Standardization.

L3.2

A model of test score has . After adding a highly correlated feature "hours_of_tutoring", the coefficient on hours_studied flips to . Did studying suddenly become harmful? Explain.

Recall Solution

No. This is multicollinearity: hours_studied and hours_of_tutoring move together, so the fit cannot uniquely credit the effect to one of them. The two coefficients trade off, and either can flip sign with high variance. The joint effect can still be positive; the individual numbers just became unstable. Fix: check the correlation / VIF, or shrink with Regularization (Ridge & Lasso). The sign flip is a red flag, not a finding.

L3.3

A logistic coefficient is . Estimate the percentage change in odds without a calculator, then say how far off the estimate is.

Recall Solution

Small- rule: , so → about +3% odds. Exact: → +3.045%. The approximation is off by only percentage points — excellent for small . (It gets worse as grows; at the rule gives +80% but the truth is +123%.)


Level 4 — Synthesis

L4.1

A logistic model for loan default uses standardized features: where 's are standardized (mean 0, SD 1). For an applicant with debt 1 SD above average and income exactly average (): (a) find the log-odds, (b) the odds, (c) the probability of default. Then say which feature reduces default-odds and by what per-SD multiplier.

Recall Solution

(a) log-odds . (b) odds (about 1 default per 4.48 non-defaults). (c) . Income has , so each +1 SD of income multiplies default-odds by — cutting odds by about . Debt raises odds ().

L4.2

Same model. Compare two applicants: A has ; B has (the average person). What is the odds ratio between A and B, and does it equal a product of the single-feature odds ratios? Explain why.

Recall Solution

Difference in log-odds . Odds ratio A vs B . Check the product form: debt contributes , income contributes ; product . Yes, it factors, because log-odds is additive in the features, and . Additivity in log-odds becomes multiplicativity in odds — exactly the "Logistic multiplies" mnemonic.


Level 5 — Mastery

L5.1

Derive the general odds-ratio for a change of units in feature of a logistic model (not just ). Then apply it: with per year, what is the odds ratio for being 10 years older?

Recall Solution

Log-odds is linear, so moving by changes log-odds by : Exponentiate: Apply: . Ten extra years multiplies the odds by about 1.49 (). Note this is , not the per-year effect — odds compound multiplicatively.

L5.2

Show that the linear coefficient equals the partial derivative , and explain in one sentence why a derivative is the right tool to describe "how much the prediction changes per unit."

Recall Solution

With , differentiate w.r.t. : every term without is a constant (derivative 0), and . So . Why a derivative: a derivative is precisely the definition of "instantaneous change in output per unit change in one input, holding others fixed" — the exact question a coefficient answers. For a straight line the derivative is constant, so the per-unit change is the same everywhere, and "per 1 unit" equals the derivative exactly.

L5.3 (capstone)

A researcher fits for heart-disease risk and concludes "drinking coffee causes heart disease; cut it out." Give (a) the correct statistical interpretation of , and (b) two reasons the causal claim is unjustified.

Recall Solution

(a) Each extra cup of coffee is associated with the odds of heart disease multiplying by , holding the genetic marker fixed — an association within this fitted model, nothing more. (b) Reasons the causal claim fails:

  1. Confounding / correlation ≠ causation — heavy coffee drinkers might also smoke, sleep less, or be more stressed; those unmodeled confounders could drive both. Regression measures association, not causation. See Correlation vs Causation.
  2. Model-dependence & collinearity — if coffee correlates with the genetic marker or omitted variables, the coefficient is unstable and its "holding others fixed" clause is physically unrealisable. A different feature set could shrink or flip . Correct wording: "In this sample, coffee is associated with higher modeled odds; a causal claim needs a controlled/causal design."

Connections