Build a data set from random numbers: in the population, the outcome variable and 50 candidate predictors are independent of one another. Use 100 observations to pick out 15 of the variables, then regress again on the same data, and the software gives an overall F-test p-value of about 0.000018. There is no predictive relationship built into the data, so why does the model look so significant? This is the question Freedman's paradox asks: the screening process itself changes the distribution of the test result.

In 1983, the statistician David A. Freedman demonstrated this problem with random data: first put all 50 candidate variables into a regression together, then screen according to each variable's t-test result, and finally refit on the same data.[1] Below we follow this idea with another, independently constructed set of simulated data, to see how significant results arise.

Fit first, then screen

Each row in the simulation is one observation. First generate 100 rows and 50 columns of predictors, then generate 100 outcome values; all values are drawn independently from the standard normal distribution. There is therefore no true relationship between the predictors and the outcome. Because the constructed population has mean zero, neither regression includes an intercept.

Step one: put all 50 variables into the full regression at once, and compute the two-sided t-test p-value of each coefficient in this multiple regression model. Step two: keep the variables with p < 0.25 and refit using the original 100 rows of data. The 0.25 is the screening threshold, not the 0.05 threshold used to finally judge the significance of the overall model. This simulation kept 15 variables.

Model on the same training sample Number of variables Uncentered R² Overall F-test p-value
Full model before screening 50 0.538695 0.292765
Refit after screening 15 0.415565 0.000018

All figures in the table come from the zero-signal simulation constructed for this article; the post-screening p-value is the result of an ordinary F-test that does not correct for the screening procedure.

The full model's R² already reaches about 0.539, but its overall F-test p-value is about 0.293. After dropping 35 variables, R² falls to about 0.416, yet the overall test gives a very small p-value. The R² here is the uncentered R² used by regressions without an intercept: it compares the residual sum of squares with the sum of squares of the outcome values relative to zero.

How significance gets screened in

Even if none of the variables has a real effect, each variable's test in the first full regression is still subject to random fluctuation. Under this simulation setup, the probability that a zero coefficient has a two-sided p-value below 0.25 is 0.25; among 50 variables, the average number meeting the condition is 50×0.25 = 12.5. The tests of the individual variables need not be independent of one another for this average to hold. That 15 were kept this time does not mean 15 real predictors were discovered among them.

Although R² falls after screening, the remaining variables were picked according to their performance in the same sample. For the no-intercept model in this example, the overall F statistic can be written as F = (R²₀/k)/[(1−R²₀)/(n−k)], where R²₀ is the uncentered R², k is the number of variables in the model, and n is the training sample size. Substituting 0.415565, 15 and 100 gives F ≈ 4.029.

If these 15 variables had been fixed before looking at the data, the overall test could be computed, under the corresponding model assumptions, using the F distribution with 15 and 85 degrees of freedom. But in practice the performance of 50 variables was examined first and the more prominent ones were then kept. The ordinary F-test does not include this selection step in its reference distribution, so 0.000018 is merely a nominal p-value computed as though "15 variables were fixed in advance," not the true probability that the whole screening procedure would produce such a result under zero signal.[1][2]

With a fresh batch of data, does the prediction still hold up?

Next, generate 1000 independent test observations, predict using the variables selected and the coefficients estimated in the training stage, and compare with a baseline that always predicts zero. Zero is the known population mean of the outcome variable in this constructed data set. The baseline's test mean squared error is 0.967496, and the post-screening model's is 1.552510; the model's error is in fact about 60.5% higher.

Writing test performance as R²₀ = 1 − model test MSE / zero-prediction test MSE, this run gives about 1 − 1.552510/0.967496 = −0.604668. A negative value means that on this test data, reusing the trained model is worse than simply predicting zero. The 0.416 on the training set and the negative value on the test set answer different questions: the former measures fit to the data already used, and the latter measures prediction on new data.

Beyond the first data set, 100 more data sets were independently generated and analyzed: in 96 of them the ordinary post-screening F-test p-value was below 0.05; in all 100, the independent-test R²₀ was below zero. These counts correspond to this example's sample size, number of candidate variables and screening threshold. They show how far nominal significance can lie from predictive performance on new data when the same data are responsible both for selecting and for testing.

Post-screening test and independent test in the no-signal simulation

Figure 1 | 100 newly generated independent simulations: the outcome and the 50 candidate variables are independent by construction. Left: the ordinary F-test recomputed after screening on the same training set; right: R² of the independent test set relative to the zero prediction. The bars are the results of this simulation, and the red lines mark p = 0.05 and R² = 0; they do not represent the data in Freedman's original paper.

Separate screening, prediction and inference

If the goal is prediction, split the data first, then do variable screening and model fitting using only the training portion; finally compare the prediction error on test data that took no part in selection with a suitable baseline. When using cross-validation, screening must also be redone inside each training fold, rather than picking variables with all the data first and then carrying them into the validation folds.

If the goal is to test coefficients, variable screening must be brought into the inference problem. Berk and colleagues proposed constructing post-selection confidence intervals with simultaneous inference, one approach in linear regression whose scope depends on the method's assumptions.[2] If several coefficients are tested at once, multiple comparisons should also be considered. An independent test can assess predictive performance, but it does not automatically correct the coefficient p-values computed after screening on the original training sample.

Reproducing this simulation

The R code below generates the first data set and 100 additional ones in turn. The first line of output corresponds to the values in the table and the independent test; the last two items count, among the 100 data sets, the times the nominal F-test p < 0.05 and the times the test R²₀ < 0.

set.seed(20261104)

simulate_once <- function() {
  x <- matrix(rnorm(100 * 50), nrow = 100, ncol = 50)
  y <- rnorm(100)
  full <- summary(lm(y ~ x - 1))
  coefficient_p <- 2 * pt(abs(full$coefficients[, 3]),
                          df = 50, lower.tail = FALSE)
  chosen <- which(coefficient_p < 0.25)
  if (length(chosen) == 0) stop("No variable was selected")
  selected_x <- x[, chosen, drop = FALSE]
  fit <- lm(y ~ selected_x - 1)
  selected <- summary(fit)
  f_p <- function(model_summary) {
    statistic <- model_summary$fstatistic
    unname(pf(statistic[1], statistic[2], statistic[3],
              lower.tail = FALSE))
  }
  test_x <- matrix(rnorm(1000 * 50), nrow = 1000, ncol = 50)
  test_y <- rnorm(1000)
  prediction <- drop(test_x[, chosen, drop = FALSE] %*% coef(fit))
  zero_mse <- mean(test_y^2)
  selected_mse <- mean((test_y - prediction)^2)
  c(selected_count = length(chosen), full_r2 = full$r.squared,
    full_f_p = f_p(full), selected_r2 = selected$r.squared,
    selected_naive_f_p = f_p(selected), test_zero_mse = zero_mse,
    test_selected_mse = selected_mse,
    test_r2_zero = 1 - selected_mse / zero_mse)
}

runs <- replicate(101, simulate_once())
print(round(runs[, 1], 6))
print(sum(runs["selected_naive_f_p", -1] < 0.05))
print(sum(runs["test_r2_zero", -1] < 0))

The first data set yields, in order: 15 variables, full-model R²₀ 0.538695, full-model p-value 0.292765, post-screening R²₀ 0.415565, nominal p-value 0.000018, zero-prediction MSE 0.967496, model MSE 1.552510, and test R²₀ −0.604668; the last two counts are 96 and 100, respectively.

References

  1. [1] Freedman, David A. A Note on Screening Regression Equations. 1983-05.

  2. [2] Berk, Richard; Brown, Lawrence; Buja, Andreas; Zhang, Kai; Zhao, Linda. Valid Post-Selection Inference. 2013.

  3. Research Methods · Rituals can be imitated; understanding cannot be faked.

  4. Compiled and published by the Scholay All-in-One Academic Platform. If any infringement is found, please let us know and the item will be taken down.

  5. Also published at EnterScholar, the scholar community for the age of intelligence.