5.2 Masked relationship
Sometimes a real association is hidden because a confounding variable suppresses the relationship. Adding the right variable to the model can reveal an effect that was masked in the raw data. This is the opposite of a spurious association.
5.2.1 The milk energy example
The classic example uses data on milk energy content across primate species. The question: does body mass () affect milk energy ()? The bivariate association is weak, but adding brain size () reveals a strong negative effect of mass.
The causal story:
(negative: larger animals produce less energy-dense milk) (positive: larger animals have larger brains) (positive: larger brains require more energy-dense milk)
The effect of on is masked because has both a direct negative effect on and an indirect positive effect through . The total effect is near zero, but the direct effect is strongly negative.
# Simulate the milk energy data
set.seed(42)
n_species <- 30
# Body mass (log scale)
mass <- rnorm(n_species, mean = 3, sd = 1)
# Brain size is positively influenced by mass
brain <- 0.7 * mass + rnorm(n_species, sd = 0.5)
# Milk energy: negatively influenced by mass, positively by brain
energy <- -0.5 _ mass + 0.6 _ brain + rnorm(n_species, sd = 0.3)
# Standardize
mass_s <- (mass - mean(mass)) / sd(mass)
brain_s <- (brain - mean(brain)) / sd(brain)
energy_s <- (energy - mean(energy)) / sd(energy)
# Bivariate: energy ~ mass
m_biv <- lm(energy_s ~ mass_s)
cat("Bivariate (energy ~ mass):\n")
cat(" beta_mass:", round(coef(m_biv)[2], 3), "\n")
# Multivariate: energy ~ mass + brain
m_multi <- lm(energy_s ~ mass_s + brain_s)
cat("\nMultivariate (energy ~ mass + brain):\n")
cat(" beta_mass:", round(coef(m_multi)[2], 3), "\n")
cat(" beta_brain:", round(coef(m_multi)[3], 3), "\n")
cat("\nThe mass effect is masked in the bivariate model\n")
cat("but revealed in the multivariate model.\n")5.2.2 Why the relationship is masked
The bivariate coefficient of mass on energy is near zero because the total effect combines a direct negative effect and an indirect positive effect:
The indirect path () nearly cancels the direct path (). But when we include brain size in the regression, we block the indirect path, and the direct effect is revealed.
# Visualize the masked relationship
par(mfrow = c(1, 3))
# Bivariate: energy vs mass (weak)
plot(mass_s, energy_s, pch = 16, col = "steelblue",
xlab = "Body mass (standardized)", ylab = "Milk energy (standardized)",
main = sprintf("Bivariate: beta = %.3f", coef(m_biv)[2]))
abline(m_biv, lwd = 2, col = "firebrick")
# Bivariate: energy vs brain (strong)
m_brain <- lm(energy_s ~ brain_s)
plot(brain_s, energy_s, pch = 16, col = "steelblue",
xlab = "Brain size (standardized)", ylab = "Milk energy (standardized)",
main = sprintf("Bivariate: beta = %.3f", coef(m_brain)[2]))
abline(m_brain, lwd = 2, col = "firebrick")
# Coefficient comparison
barplot(c(coef(m_biv)[2], coef(m_multi)[2]),
names.arg = c("Bivariate", "Multivariate"),
col = c("steelblue", "firebrick"), border = "white",
main = "Mass effect: masked vs revealed",
ylab = "Coefficient")
abline(h = 0, lty = 2)
par(mfrow = c(1, 1))5.2.3 The causal graph
The masked relationship arises because the causal graph has two paths from mass to energy:
- Direct path: (negative)
- Indirect path: (positive)
The total effect (bivariate coefficient) is the sum of both paths. The direct effect (multivariate coefficient) blocks the indirect path by conditioning on .
Adding variables can reveal or hide effects. The masked relationship shows that adding a variable can increase the apparent effect of another variable, while the spurious association shows that adding a variable can decrease it. The direction depends on the causal graph. This is why model selection must be guided by causal reasoning, not by statistical significance or automated procedures. A variable that seems irrelevant in a bivariate model may be crucial in a multivariate model, and vice versa.
Summary of Section 5.2
- A masked relationship occurs when a confounder suppresses the association between a predictor and an outcome.
- The total effect combines direct and indirect effects, which may cancel each other.
- Adding the confounder to the model blocks the indirect path and reveals the direct effect.
- The milk energy example shows that body mass has a strong negative direct effect on milk energy, masked by the positive indirect path through brain size.
- Model selection must be guided by causal reasoning, not by statistical significance.