1.) Suppose we have residuals from an existing model (call them Res1).

2.) If we have a new continuous variable (Xnew), we can we build a model to predict Xnew using the existing variables in the model. Then, store these residuals (call them Res2).

3.) Finally, predict Res1 using Res2 as an independent variable. The resulting slope will be the effect of the new variable on the original response given all the other variables in the model?

Does this procedure work with a binary variable? For example, can I use logistic regression in step 2?