Skip to course content
Free R statistics course

Statistical Data Analytics with R

Unit 09.00: Every slope is now conditional

Adding a second predictor changes what the first one means. That is the whole point, and it is where most misreadings start.

Every slope is now conditional

lm(y ~ a + b) estimates a slope for each predictor, and each slope is the association with y holding the other predictor fixed. In a simple regression the slope carries everything correlated with that predictor; in a multiple regression it carries only what is left once the others are accounted for.

That means the same variable can have a different coefficient in two models and both be correct โ€” they answer different questions.

Adding a genuinely relevant predictor also shrinks the residual spread, which is the practical benefit: the model's typical error falls.

This block fits price on size, then on size and age.

suppressPackageStartupMessages(library(broom))
set.seed(601)
n <- 200
size    <- runif(n, 40, 200)              # square metres
age     <- runif(n, 0, 60)                # years
price   <- 50 + 2.1 * size - 0.8 * age + rnorm(n, 0, 25)
d <- data.frame(price, size, age)

simple   <- lm(price ~ size, data = d)
multiple <- lm(price ~ size + age, data = d)

cat("price ~ size\n");        print(tidy(simple)[, c("term", "estimate", "p.value")])
cat("\nprice ~ size + age\n"); print(tidy(multiple)[, c("term", "estimate", "p.value")])

cat("\nThe formula `y ~ a + b` reads: model y as a function of a AND b.\n")
cat("Each slope is now the effect of that variable HOLDING THE OTHER FIXED.\n\n")
cat("R-squared:", round(summary(simple)$r.squared, 4), "->",
    round(summary(multiple)$r.squared, 4), "\n")
cat("Residual SD:", round(summary(simple)$sigma, 2), "->",
    round(summary(multiple)$sigma, 2), "\n")
cat("Adding a genuinely relevant predictor cut the typical error by",
    round((1 - summary(multiple)$sigma / summary(simple)$sigma) * 100), "%.\n")

The size slope is 2.06 alone and 2.07 with age included โ€” barely changed, because size and age were generated independently. Age enters at โˆ’0.837. R-squared rises from 0.906 to 0.9274 and the residual SD falls from 29.76 to 26.21, cutting the typical error by 12%. When predictors are uncorrelated, adding one leaves the others alone; when they are correlated, it will not.

The mistake this prevents

The mistake is describing a multiple-regression coefficient without the 'holding the others fixed' clause. It is a conditional quantity, and dropping the condition changes what the sentence claims.

Takeaway

State which variables are in the model whenever you quote a coefficient, and say 'adjusted for' explicitly. Report the residual SD alongside R-squared, because it is in the outcome's own units.