Adjusting for Confounding by Subtracting of Mean instead of inclusion in Model? In this preprint it is stated in the section titled "PROBLEMS OF INPUT ADJUSTMENT" that, given variables $X$ and $Y$, and confounding variable $C$, where $X$ and $Y$ are conditionally independent on $C$
$$
X \leftarrow C \rightarrow Y
$$
that one can control for confounding by creating the variable $X_{adj}$ by estimating a linear model $X \sim C$ and then subtracting from each X the the estimated effect from the linear model. One can then use model $Y$ using $X_{adj}$ as an 'unconfounded predictor"
When I saw this, I wondered if this would ever be preferable to simply modeling $Y$ with both $X$ and $C$ simultaneously? This paper seems concerned with false discovery rates, but I ran a simulation (R code below) that shows that using this method of modeling with $X_{adj}$ doesn't necessarily lead to a uniform distribution of p-values, while modeling $Y$ with both $X$ and $C$ simultaneously does. It seems that modeling with both variables simultaneously allows for better estimation of standard errors, and I therefore do not know why anyone would prefer using the method with $X_{adj}$
Thanks!
n <- 1000
n_sims <- 1000
weight <- 1

confound <- seq(0, 100, length.out = n)

p_adj <- p_con <- c()
for(i in 1:n_sims){

  x <- 10 + 5*confound + rnorm(n)*(10 + confound * weight)
  y <-  100 + 0.2 * confound + rnorm(n, sd=5)
  
  m1 <- lm(x ~ confound)
  x_adj <- x - predict(m1, confound=confound)
  
  m2 <- lm(y ~ x_adj)
  m3 <- lm(y ~ x + confound)

  p_adj <- append(p_adj, summary(m2)$coefficients[2, 4])
  p_con <- append(p_con, summary(m3)$coefficients[2, 4])
}

hist(p_adj, breaks = 100)
hist(p_con,breaks = 100)



Both methods yield the exact same point estimate; in a sense, the one-step regression method is using the two-step method implicitly. You are correct that the naive standard errors are incorrect for the two-step method, and it indeed should not be used. The authors of the paper do not propose using the naive standard errors from such a regression. Any tests they perform are omnibus tests of whether the focal predictors or "confounds" explain variance in the outcome, and they propose likelihood ratio tests to examine that. If machine learning methods are involved, a nonparametric permutation test must be used because the degrees of freedom for such models are ambiguous but required to adequately perform a traditional likelihood ratio test.
It can be useful to partial out covariates from the focal predictor to visualize the partial relationship between the focal predictor and the outcome after controlling for the covariates.
