# How to get the regressed output?

I have a model Y = slope1*variable1 + slope2*variable2 + Intercept.

I used lm in R to get slope1, slope2 and Intercept.

In this case, variable1 is my main effect and I want to remove the effect of variable2. The goal is to see if there is any association between Y controlled for variable 2 (regressed Y) and variable 1.

In order to plot these :

(1) Should I subtract observed_Y-slope2*variable2-Intercept-Residuals and whatever is remaining (I call this regressed Y) is actually the value that is due to variable 1 or

(2) Can I use model_fitted_dot_values from R and plot that as a function of variable1 and claim that model_fitted_dot_values are the regressed values of my dependent variable?

Any help is greatly appreciated.