Skip to main content

Stepwise Regression: Which Body Measurements Predict Body Fat?

Stepwise regression in R with step(), on body fat measured under water in 250 men and 13 tape measurements: forward, backward and both directions, AIC, BIC and p values by hand, all subsets, and why it is risky: findings in shuffled data, unstable choices under the bootstrap, inflated coefficients, optimistic fit, with cross-validation against the full model, lasso and ridge, and APA reporting.

The question: which measurements should we keep?

The accurate way to measure a man’s body fat is to weigh him under water: fat floats, muscle and bone sink. It needs a tank and takes time. A tape measure costs nothing. So we would like a formula that predicts the percentage of body fat from measurements that anyone can take: neck, chest, abdomen, hip, thigh and so on.

There are 13 candidates. Do we need all of them? Stepwise regression lets the computer choose: it adds the predictor that helps most, or removes the one that helps least, and repeats until nothing improves.

It is one of the most used methods of data analysis, and one of the most criticized (Harrell, 2015; Smith, 2018). This page does both things. It shows how the method works, step by step, and then it tests it: on the same data, on shuffled data, on resampled data, and against simpler alternatives.

Code
library(ggplot2)
library(leaps)     # regsubsets(): the best model of every size
library(glmnet)    # lasso and ridge, for comparison

# number formats for the text
f1   <- function(x) formatC(x, format = "f", digits = 1, big.mark = ",")
f2   <- function(x) formatC(x, format = "f", digits = 2, big.mark = ",")
f3   <- function(x) formatC(x, format = "f", digits = 3, big.mark = ",")
# no leading zero
nz <- function(x, d = 2) sub("^(-?)0", "\\1", formatC(x, format = "f", digits = d))
pval <- function(p) if (p < .001) "< .001" else paste("=", nz(p, 3))
num  <- function(x) trimws(format(x, big.mark = ","))
pct  <- function(x) paste0(formatC(100 * x, format = "f", digits = 0), "%")

1. The data

The data come from a study of 252 men by K. W. Penrose, A. G. Nelson and A. G. Fisher, published in 1985. Johnson (1996) made them available for teaching. The file has no header, so we give the names:

Code
raw <- read.table("https://jse.amstat.org/datasets/fat.dat.txt")
names(raw) <- c(
  "case", "brozek", "siri", "density", "age", "weight", "height", "adiposity", "fat_free_weight",
  "neck", "chest", "abdomen", "hip", "thigh", "knee", "ankle", "biceps", "forearm", "wrist"
)
dim(raw)
[1] 252  19

The outcome is siri, the percentage of body fat worked out from the density under water with Siri’s equation. adiposity is the body mass index and fat_free_weight is computed from the body fat itself, so neither belongs among the predictors. The circumferences are in centimeters; weight is in pounds and height in inches, which we convert.

Three rows need a decision before anything else:

Code
raw[c(39, 42, 182), c("case", "siri", "density", "age", "weight", "height", "abdomen")]
    case siri density age weight height abdomen
39    39 35.2  1.0202  46 363.15  72.25   148.1
42    42 32.9  1.0250  44 205.00  29.50   104.3
182  182  0.0  1.1089  40 118.50  68.00    69.4
  • Case 42 is 29.5 inches tall (75 cm) and weighs 205 pounds. That is almost certainly a typing error for 69.5, which we correct.
  • Case 182 has 0% fat, which no living person has: the equation gave a negative value that was set to zero. We drop him.
  • Case 39 weighs 363.1 pounds (164.7 kg), 100.4 pounds more than the next man. It is probably a correct value, but a formula for ordinary men should not be steered by him. We drop him too, and say so.
Code
predictors <- c("age", "weight", "height", "neck", "chest", "abdomen", "hip", "thigh",
                "knee", "ankle", "biceps", "forearm", "wrist")
men <- raw
men$height[42] <- 69.5
men$weight <- men$weight * 0.45359237     # kg
men$height <- men$height * 2.54           # cm
men <- men[-c(39, 182), c("siri", predictors)]
names(men)[1] <- "fat"
rownames(men) <- NULL
nrow(men)
[1] 250
Code
summary(men$fat)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   0.70   12.50   19.20   19.16   25.27   47.50 

That leaves 250 men between 22 and 81 years old, with 0.7 to 47.5 percent body fat.


2. Look at the data

Code
cors <- cor(men)
ord  <- order(cors["fat", ])
long <- as.data.frame(as.table(cors[ord, ord]))
names(long) <- c("a", "b", "r")

ggplot(long, aes(a, b, fill = r)) +
  geom_tile(colour = "white") +
  geom_text(
    aes(
      label = sub("^(-?)0\\.", "\\1.", sub("^-0.0$", "0.0", formatC(r, format = "f", digits = 1)))
    ),
    size = 2.6
  ) +
  scale_fill_gradient2(
    low = "#eb6834",
    mid = "white",
    high = "#2a78d6",
    limits = c(-1, 1),
    name = "r"
  ) +
  labs(title = "Correlations, ordered by the correlation with body fat", x = NULL, y = NULL) +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1), panel.grid = element_blank())

Correlations – 2. Look at the data

The abdomen has by far the strongest correlation with body fat, r = .82. But the measurements are also strongly correlated with each other: a heavy man is large everywhere. Weight and hip correlate at .93, weight and chest at .89. The predictors carry the same information many times over, and this is exactly the situation in which stepwise methods struggle.


3. The method step by step, with formulas

Step 1: the trade-off

Every predictor that is added lowers the sum of squared residuals, the RSS, even a column of random numbers. So a criterion must put a price on each predictor. The usual one is Akaike’s information criterion. For a linear regression with \(k\) estimated coefficients,

\[\text{AIC} = n \log\!\left(\frac{\text{RSS}}{n}\right) + 2k\]

The smaller the better: the first part rewards fit, and each coefficient costs 2. The BIC charges \(\log(n)\) per coefficient instead of 2. With \(n\) = 250 that is 5.52, so BIC keeps fewer predictors.

Step 2: one step forward

Start with no predictor. Try each of the 13 alone, and take the one with the smallest AIC:

Code
n <- nrow(men)
aic_of <- function(vars) {                     # AIC of the model with these predictors
  fit <- lm(reformulate(if (length(vars)) vars else "1", "fat"), data = men)
  n * log(sum(resid(fit)^2) / n) + 2 * length(coef(fit))
}
first <- sapply(predictors, function(v) aic_of(v))
c(none = aic_of(character(0)), head(sort(first), 4))
     none   abdomen     chest       hip    weight 
1056.2087  778.0058  894.4207  931.7096  941.1935 

The abdomen wins by a wide margin. Keep it, try each of the other 12 next to it, and continue:

Code
chosen <- character(0)
path <- data.frame(step = 0, added = "(none)", AIC = aic_of(chosen))
repeat {
  left  <- setdiff(predictors, chosen)
  tries <- sapply(left, function(v) aic_of(c(chosen, v)))
  if (!length(left) || min(tries) >= tail(path$AIC, 1)) break    # nothing improves: stop
  chosen <- c(chosen, names(which.min(tries)))
  path   <- rbind(path, data.frame(step = nrow(path), added = tail(chosen, 1), AIC = min(tries)))
}
path
  step   added       AIC
1    0  (none) 1056.2087
2    1 abdomen  778.0058
3    2  weight  742.6230
4    3   wrist  733.4977
5    4  biceps  731.6885
6    5     age  731.0730
7    6   thigh  730.7690

Forward selection stops after 6 predictors.

Step 3: backward, and both ways

Backward elimination starts from the model with all 13 and removes, one at a time, the predictor whose removal lowers the AIC most. Both directions is forward selection that checks, after each addition, whether an earlier predictor can now go.

Step 4: what AIC means as a p value

Removing one predictor is an improvement if the AIC falls, that is if the likelihood-ratio statistic of that predictor is below 2. In a large sample this statistic follows a \(\chi^2\) distribution with 1 degree of freedom, so

\[\text{AIC keeps a predictor when } p < P(\chi^2_1 > 2) = .157\]

and BIC, with \(n = 250\), when \(p < P(\chi^2_1 > \log n) = .019\). The old versions of stepwise regression used p values directly, with “\(F\) to enter” and “\(F\) to remove”. All of them are the same idea with a different price.

Step 5: how many models are we choosing from?

With 13 candidates there are \(2^{13}\) = 8,192 possible models. Stepwise looks at a small part of them, and reports the winner as if it had been the only one.


4. Fitting the model and reading the output

Code
full  <- lm(fat ~ ., data = men)                     # all 13
empty <- lm(fat ~ 1, data = men)                     # none
everything <- formula(full)

forward  <- step(empty, scope = everything, direction = "forward",  trace = 0)
backward <- step(full,                      direction = "backward", trace = 0)
both     <- step(empty, scope = everything, direction = "both",     trace = 0)
# k: the price per coefficient
bic <- step(full, direction = "backward", trace = 0, k = log(nrow(men)))

vars_of <- function(fit) names(coef(fit))[-1]
models <- list(
  "Forward, AIC" = forward,
  "Backward, AIC" = backward,
  "Both ways, AIC" = both,
  "Backward, BIC" = bic
)
chosen_table <- sapply(models, function(m) ifelse(predictors %in% vars_of(m), "x", ""))
rownames(chosen_table) <- predictors
print(chosen_table, quote = FALSE)
        Forward, AIC Backward, AIC Both ways, AIC Backward, BIC
age     x            x             x              x            
weight  x                          x                           
height               x                            x            
neck                 x                                         
chest                x                                         
abdomen x            x             x              x            
hip                                                            
thigh   x                          x                           
knee                                                           
ankle                                                          
biceps  x                          x                           
forearm              x                                         
wrist   x            x             x              x            
Code
in_all <- predictors[rowSums(chosen_table == "x") == length(models)]

The directions do not agree. Forward selection keeps 6 predictors and backward elimination 7, and they share only 3 (abdomen, wrist, age). Forward takes weight, backward throws it out and takes height, neck and chest instead. The data are the same, the criterion is the same. Only the route differs.

The output of the backward model looks like that of any regression:

Code
summary(backward)

Call:
lm(formula = fat ~ age + height + neck + chest + abdomen + forearm + 
    wrist, data = men)

Residuals:
     Min       1Q   Median       3Q      Max 
-10.6391  -3.1341  -0.2619   3.1770   9.3904 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  6.39303    8.20342   0.779  0.43656    
age          0.06061    0.02477   2.447  0.01512 *  
height      -0.12716    0.04744  -2.680  0.00786 ** 
neck        -0.32038    0.21884  -1.464  0.14449    
chest       -0.14206    0.08779  -1.618  0.10693    
abdomen      0.87515    0.06476  13.513  < 2e-16 ***
forearm      0.35281    0.19182   1.839  0.06711 .  
wrist       -1.74340    0.48375  -3.604  0.00038 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 4.231 on 242 degrees of freedom
Multiple R-squared:  0.7445,    Adjusted R-squared:  0.7371 
F-statistic: 100.7 on 7 and 242 DF,  p-value: < 2.2e-16
Code
p_back <- summary(backward)$coefficients[-1, 4]
aics   <- c(full = extractAIC(full)[2], sapply(models, function(m) extractAIC(m)[2]))
round(aics, 1)
          full   Forward, AIC  Backward, AIC Both ways, AIC  Backward, BIC 
         736.5          730.8          729.1          730.8          730.5 

The tempting way to read it: \(R^2\) = .744, almost that of the full model (.749), with 4 predictors that have p < .05. Two details already look odd. First, the signs: a larger wrist and neck go with less fat. That part can be defended: given the abdomen, a big frame means less fat. Second, some predictors are in the model without being significant, because AIC’s threshold is p < .157.

The p values, the confidence intervals and the \(R^2\) of this output were all computed as if we had chosen these 7 predictors before seeing the data. We did not. Section 5 measures what that costs.

All subsets

regsubsets() does not take steps. It finds the best model of every size among all 8,192:

Code
subsets <- summary(regsubsets(fat ~ ., data = men, nvmax = 13))
size <- 1:13
best <- data.frame(size = size,
                   adj_R2 = subsets$adjr2,
                   AIC    = n * log(subsets$rss / n) + 2 * (size + 1),
                   BIC    = n * log(subsets$rss / n) + log(n) * (size + 1))
best$predictors <- apply(subsets$which[, -1], 1, function(w) paste(predictors[w], collapse = " "))
best[c(1:4, which.min(best$AIC)), c("size", "adj_R2", "AIC", "predictors")]
  size    adj_R2      AIC                                 predictors
1    1 0.6726703 778.0058                                    abdomen
2    2 0.7169914 742.6230                             weight abdomen
3    3 0.7282092 733.4977                       weight abdomen wrist
4    4 0.7324939 730.5068                   age height abdomen wrist
7    7 0.7374730 728.7296 age height neck chest abdomen biceps wrist
Code
curve <- rbind(data.frame(size = size, value = best$AIC - min(best$AIC), criterion = "AIC"),
               data.frame(size = size, value = best$BIC - min(best$BIC), criterion = "BIC"))

ggplot(curve, aes(size, value, colour = criterion)) +
  geom_line(linewidth = 0.8) + geom_point(size = 2) +
  scale_colour_manual(values = c(AIC = "#2a78d6", BIC = "#eb6834"), name = NULL) +
  scale_x_continuous(breaks = size) +
  coord_cartesian(ylim = c(0, 40)) +
  labs(title = "The best model of each size, compared with the best of all",
       subtitle = "0 = the winner; differences of 1 or 2 mean next to nothing",
       x = "number of predictors", y = "criterion minus its minimum") +
  theme_bw() + theme(legend.position = "bottom")

All subsets

Code
near_best <- sum(best$AIC - min(best$AIC) < 2)

The bottom of the AIC curve is flat: the best models of 6 different sizes are within 2 points of the winner. The data cannot tell them apart. Searching all subsets finds the true minimum, but the minimum of a flat curve is decided by noise.


5. Testing the method

Test 1: an outcome with no relation to anything

We shuffle the body-fat column. Now each man has the body fat of another man, and all 13 predictors are useless by construction. A good method should come back empty-handed:

Code
set.seed(2026)
shuffled <- t(replicate(500, {
  fake     <- men
  fake$fat <- sample(fake$fat)
  m  <- step(lm(fat ~ ., data = fake), trace = 0)
  s  <- summary(m)
  p  <- s$coefficients[-1, 4]
  fs <- s$fstatistic
  c(kept        = length(p),
    significant = sum(p < .05),
    R2          = s$r.squared,
    p_model     = if (length(p)) pf(fs[[1]], fs[[2]], fs[[3]], lower.tail = FALSE) else 1)
}))
colMeans(shuffled[, 1:3])
       kept significant          R2 
 2.88200000  1.46600000  0.03390794 
Code
c(
  any_significant = mean(shuffled[, "significant"] > 0),
  model_significant = mean(shuffled[, "p_model"] < .05)
)
  any_significant model_significant 
            0.732             0.530 

In 500 shuffled data sets, backward elimination kept 2.9 predictors on average. In 73% of them at least one had p < .05, and in 53% the F test of the whole model was significant, where the promise is 5%. This is known as Freedman’s paradox (Freedman, 1983): screen many noise variables, refit with the survivors, and the final model looks convincing.

Test 2: would the same predictors be chosen again?

We cannot measure 250 new men, but we can draw 250 men from our own with replacement, many times, and repeat the whole selection on each of these bootstrap samples:

Code
set.seed(2027)
B <- 1000
kept <- t(replicate(B, {
  again <- men[sample(nrow(men), replace = TRUE), ]
  m <- step(lm(fat ~ ., data = again), trace = 0)
  predictors %in% names(coef(m))
}))
colnames(kept) <- predictors
frequency <- sort(colMeans(kept), decreasing = TRUE)
cbind(frequency)
        frequency
abdomen     1.000
wrist       0.985
age         0.838
height      0.660
neck        0.595
chest       0.537
forearm     0.481
biceps      0.466
thigh       0.460
hip         0.411
ankle       0.352
weight      0.313
knee        0.207
Code
as_text   <- apply(kept, 1, function(k) paste(predictors[k], collapse = " "))
n_models  <- length(unique(as_text))
our_model <- paste(predictors[predictors %in% vars_of(backward)], collapse = " ")
c(different_models = n_models, most_common = max(table(as_text)), ours = sum(as_text == our_model))
different_models      most_common             ours 
             457               18               10 
Code
freq_data <- data.frame(predictor = factor(names(frequency), levels = rev(names(frequency))),
                        share = frequency, chosen = names(frequency) %in% vars_of(backward))

ggplot(freq_data, aes(share, predictor, fill = chosen)) +
  geom_col(width = 0.7) +
  geom_vline(xintercept = 0.5, linetype = "dashed", colour = "grey40") +
  scale_fill_manual(
    values = c(`TRUE` = "#2a78d6", `FALSE` = "grey70"),
    labels = c(`TRUE` = "in our backward model", `FALSE` = "not in it"),
    name = NULL
  ) +
  scale_x_continuous(labels = function(x) paste0(100 * x, "%"), limits = c(0, 1)) +
  labs(
    title = "How often each predictor is chosen in 1,000 bootstrap samples",
    x = "share of the samples",
    y = NULL
  ) +
  theme_bw() +
  theme(legend.position = "bottom")

Bootstrap chart – Test 2: would the same predictors be chosen again?

Only 2 predictors, abdomen and wrist, are chosen nearly always. Most of the others are a coin toss. The 1,000 samples produced 457 different models; the most common one came up 18 times, and the model that backward elimination chose in our data only 10 times. A statement such as “the predictors of body fat are age, height, neck, chest, abdomen, forearm and wrist” is a statement about this sample.

Test 3: are the coefficients right?

A predictor with a weak effect gets in when, by luck, its effect looks strong in the sample. So among the selected, weak effects are overestimated (the “winner’s curse”). To see this we need to know the truth, so we make one: new body-fat values that follow the full model exactly, with its coefficients and its residual spread.

Code
set.seed(2028)
truth <- coef(full)
sims  <- 1000
estimates <- matrix(NA, sims, length(predictors), dimnames = list(NULL, predictors))
for (i in seq_len(sims)) {
  new     <- men
  new$fat <- fitted(full) + rnorm(nrow(men), 0, sigma(full))
  b <- coef(step(lm(fat ~ ., data = new), trace = 0))
  estimates[i, intersect(names(b), predictors)] <- b[intersect(names(b), predictors)]
}
curse <- data.frame(predictor = predictors, true = truth[predictors],
                    selected = colMeans(!is.na(estimates)),
                    mean_when_selected = colMeans(estimates, na.rm = TRUE))
curse$ratio <- curse$mean_when_selected / curse$true
curse <- curse[order(-curse$selected), ]
print(data.frame(predictor = curse$predictor, round(curse[, -1], 2)), row.names = FALSE)
 predictor  true selected mean_when_selected ratio
   abdomen  0.90     1.00               0.89  0.99
     wrist -1.85     0.99              -1.88  1.02
       age  0.07     0.82               0.08  1.10
    height -0.11     0.66              -0.15  1.37
      neck -0.39     0.61              -0.52  1.32
     chest -0.14     0.53              -0.21  1.53
   forearm  0.26     0.48               0.43  1.65
    biceps  0.19     0.48               0.35  1.86
     thigh  0.16     0.44               0.28  1.76
       hip -0.15     0.40              -0.26  1.73
     ankle  0.17     0.34               0.39  2.21
    weight -0.02     0.31              -0.13  6.17
      knee -0.04     0.21              -0.11  2.70
Code
curse_of <- function(v, col) curse[curse$predictor == v, col]

The abdomen and the wrist are nearly always selected, and their average estimate is close to the truth. The forearm has a true coefficient of 0.26; it is selected in 48% of the samples, and then its average estimate is 0.43, 1.7 times too large. (For the predictors that are strongly correlated with others, such as weight and hip, the coefficient also changes meaning when the others are left out, so the ratio mixes two things.)

Test 4: is the fit as good as it looks?

The \(R^2\) of a chosen model is too good, because the choice and the fit used the same men. Cross-validation measures honestly: hide a tenth of the men, do everything on the rest, predict the hidden ones. The word everything is important. If the predictors are chosen on all the men first and only the fit is cross-validated, the hidden men have already helped to choose, and the result is still too good.

Code
set.seed(2029)
cv_once <- function() {
  fold <- sample(rep(1:10, length.out = nrow(men)))
  pred <- matrix(
    NA,
    nrow(men),
    8,
    dimnames = list(
      NULL,
      c("full", "backward", "chosen_before", "bic", "abdomen", "abdomen_weight", "lasso", "ridge")
    )
  )
  for (k in 1:10) {
    train <- men[fold != k, ]
    test <- men[fold == k, ]
    x <- as.matrix(train[, predictors])
    xt <- as.matrix(test[, predictors])
    m <- lm(fat ~ ., data = train)
    out <- list(
      m,
      step(m, trace = 0), # selection inside the fold: honest
      lm(formula(backward), data = train), # predictors chosen on all men: cheating
      step(m, trace = 0, k = log(nrow(train))),
      lm(fat ~ abdomen, data = train),
      lm(fat ~ abdomen + weight, data = train)
    )
    pred[fold == k, 1:6] <- sapply(out, predict, newdata = test)
    pred[fold == k, 7] <- predict(cv.glmnet(x, train$fat, alpha = 1), xt, s = "lambda.min")
    pred[fold == k, 8] <- predict(cv.glmnet(x, train$fat, alpha = 0), xt, s = "lambda.min")
  }
  sqrt(colMeans((pred - men$fat)^2))
}
rmse <- rowMeans(replicate(20, cv_once()))          # 20 random splits, averaged
cbind(rmse)
                   rmse
full           4.369993
backward       4.434383
chosen_before  4.295433
bic            4.435918
abdomen        4.739759
abdomen_weight 4.418093
lasso          4.379392
ridge          4.490676
Code
apparent <- sqrt(mean(resid(backward)^2)) # the same men used for choosing, fitting and judging
apparent
[1] 4.1628
Code
cv_data <- data.frame(
  model = c("Full model, 13 predictors", "Backward, AIC", "Backward, AIC (cheating)",
            "Backward, BIC", "Abdomen only", "Abdomen + weight", "Lasso", "Ridge"),
  rmse = rmse)
cv_data$model <- factor(cv_data$model, levels = cv_data$model[order(-cv_data$rmse)])

ggplot(cv_data, aes(rmse, model)) +
  geom_segment(aes(xend = apparent, yend = model), colour = "grey75") +
  geom_point(size = 3, colour = "#2a78d6") +
  geom_vline(xintercept = apparent, linetype = "dashed", colour = "#eb6834") +
  labs(title = "Prediction error in men that the model has not seen",
       subtitle = "Dashed: the error of the backward model on the men it was built from",
       x = "root mean squared error (percentage points of body fat)", y = NULL) +
  theme_bw() + theme(plot.title.position = "plot")

CV chart – Test 4: is the fit as good as it looks?

  • On the men it was built from, the backward model misses by 4.16 points. On new men, with an honest cross-validation, by 4.43.
  • If the selection is left out of the cross-validation, the error looks like 4.30, better than it really is. This mistake is easy to make, and hard to see in a published paper.
  • Choosing did not help here. The full model, with all 13, has 4.37, the lasso 4.38 and ridge 4.49. Two predictors that a physician could have named beforehand, abdomen and weight, have 4.42, and the abdomen alone 4.74.
  • Apart from the model with the abdomen alone, the differences are small next to the error itself: a tape measure predicts body fat to within about \(\pm\) 8.6 points, whatever the model.

6. What to do instead

Your aim Do this
Explain: test a theory, estimate an effect Choose the predictors from theory before you look. Fit that model, report it, whatever the p values. Dropping a confounder because p > .05 does not make it harmless
Predict, with enough data Keep the full model, or shrink it: ridge, lasso or elastic net (see regularized regression)
Predict, many correlated predictors Principal components or partial least squares regression
A short formula for practical use Choose from the cost of the measurements first. If you must select by data, use backward elimination with AIC, report the bootstrap frequencies, shrink the coefficients, and validate with the selection inside the cross-validation
Explore Use whatever you like, and call it exploration. The test is the next data set

Two predictors, abdomen and weight, do almost as well as anything. This is the usual result with correlated predictors: many models are equally good, and which of them you use is a matter of convenience. What you cannot do is to say that the predictors that were left out do not matter.

Is the choice of predictors in blocks, planned before, stepwise regression? No. That is hierarchical regression: the order comes from the theory, and the p values mean what they say.


7. Things to keep in mind

  • The p values of a selected model are not p values. They ignore the search. There are corrections for some procedures (post-selection inference; Taylor & Tibshirani, 2015), but the ordinary output of summary() is not one of them.
  • “Not selected” does not mean “no effect”. Weight was not selected by backward elimination, although it correlates at .61 with body fat: its information was already in the other measurements.
  • The starting point matters. Backward elimination from the full model is usually preferred to forward selection, because it judges every predictor next to all the others (Heinze et al., 2018). It needs a full model that can be fitted: at the very least more rows than predictors, better 10 to 20 rows per candidate. Here there are 19.2.
  • Count the candidates, not the survivors. A model with 3 predictors chosen among 50 has the overfitting of a much larger model.
  • Whole factors. A factor with four levels is three columns that belong together: step() keeps or drops them together. Interactions should not stay without their main effects; step() respects that too.
  • Missing values. Adding a predictor with missing values changes the rows that are used, and the AICs are then not comparable. Decide on the rows first (or impute, see missing data).
  • The odd rows matter. We dropped two men and corrected one. With unstable selection a single unusual row can change the chosen set, so check influence before you select.

8. Reporting the results in APA style

If you use selection, the report (APA 7th edition) must let the reader judge it: all the candidates, the algorithm and its criterion, the stability, and an honest estimate of the error. The numbers come from the R objects:

Code
s_back <- summary(backward)$coefficients
ci_back <- confint(backward)
apa_table <- data.frame(
  Predictor = c("Intercept", vars_of(backward)),
  b  = f2(s_back[, 1]),
  SE = f2(s_back[, 2]),
  CI = paste0("[", f2(ci_back[, 1]), ", ", f2(ci_back[, 2]), "]"),
  freq = c("—", pct(frequency[vars_of(backward)])),
  full = f2(coef(full)[c("(Intercept)", vars_of(backward))]))

Method (data analysis):

We developed a formula for percentage of body fat, measured by underwater weighing, in 250 men (Johnson, 1996), after correcting one height that was a typing error and excluding one man with an impossible value of 0% and one man of 164.7 kg. The candidates were age, weight, height and 10 circumferences (13 in all; 19.2 men per candidate). We used backward elimination with the AIC, starting from the model with all the candidates. Stability was assessed with 1,000 bootstrap samples, and prediction error with 10-fold cross-validation, repeated 20 times, in which the selection was repeated in every fold. Analyses were conducted in R (Version 4.6.2; R Core Team, 2026).

Results:

Backward elimination kept 7 of the 13 candidates (Table 1), R² = .74 (full model: R² = .75). Only abdomen and wrist were selected in more than 90% of the bootstrap samples; the 1,000 samples gave 457 different models, and the model in Table 1 was chosen in 10 of them. The cross-validated prediction error was 4.43 percentage points (4.16 in the data used for the development), compared with 4.37 for the full model and 4.42 for a model with abdomen and weight only. Because of the selection, the confidence intervals in Table 1 are too narrow, and the table should not be read as a list of the determinants of body fat.

Table 1

Body Fat (%) Predicted From Body Measurements: Model Chosen by Backward Elimination

Predictor b SE 95% CI Bootstrap inclusion b in the full model
Intercept 6.39 8.20 [-9.77, 22.55] — 5.28
age 0.06 0.02 [0.01, 0.11] 84% 0.07
height -0.13 0.05 [-0.22, -0.03] 66% -0.11
neck -0.32 0.22 [-0.75, 0.11] 60% -0.39
chest -0.14 0.09 [-0.31, 0.03] 54% -0.14
abdomen 0.88 0.06 [0.75, 1.00] 100% 0.90
forearm 0.35 0.19 [-0.03, 0.73] 48% 0.26
wrist -1.74 0.48 [-2.70, -0.79] 98% -1.85

Note. N = 250 men. Circumferences and height in cm, weight in kg, age in years. The standard errors and intervals ignore the selection. Bootstrap inclusion: the share of 1,000 bootstrap samples in which backward elimination chose the predictor.

Points to remember:

  • List all the candidates, not only those that survived.
  • Name the algorithm, the direction and the criterion.
  • Report how stable the selection was.
  • Give the full model as well, at least in a supplement.
  • Validate with the selection inside.
  • Do not call the selected predictors “the significant predictors”, nor the others “not significant”.

9. Summary

What it is The computer adds or removes predictors one at a time, by AIC, BIC or p value
How (R) step(lm(y ~ ., d)) backward with AIC; k = log(n) for BIC; scope and direction for forward; leaps::regsubsets() for all subsets
What it costs p values too small, intervals too narrow, weak effects too large, \(R^2\) too high
What it found in noise A significant model in 53% of the shuffled data sets
How stable it was 457 different models in 1,000 bootstrap samples
Check it with Bootstrap inclusion frequencies, and cross-validation that repeats the selection
Better Predictors chosen beforehand, the full model, or shrinkage (ridge, lasso)
Not the same as Hierarchical regression, where the analyst decides the order

References

Freedman, D. A. (1983). A note on screening regression equations. The American Statistician, 37(2), 152–155. https://doi.org/10.1080/00031305.1983.10482729

Harrell, F. E., Jr. (2015). Regression modeling strategies: With applications to linear models, logistic and ordinal regression, and survival analysis (2nd ed.). Springer.

Heinze, G., Wallisch, C., & Dunkler, D. (2018). Variable selection – A review and recommendations for the practicing statistician. Biometrical Journal, 60(3), 431–449. https://doi.org/10.1002/bimj.201700067

Johnson, R. W. (1996). Fitting percentage of body fat to simple body measurements. Journal of Statistics Education, 4(1). https://doi.org/10.1080/10691898.1996.11910505

Smith, G. (2018). Step away from stepwise. Journal of Big Data, 5, Article 32. https://doi.org/10.1186/s40537-018-0143-6

Taylor, J., & Tibshirani, R. J. (2015). Statistical learning and selective inference. Proceedings of the National Academy of Sciences, 112(25), 7629–7634. https://doi.org/10.1073/pnas.1507583112