2
$\begingroup$

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.

$\endgroup$

1 Answer 1

2
$\begingroup$

"The goal is to see if there is any association between Y controlled for variable 2 (regressed Y) and variable 1"

You are already achieving this by fitting your full model (and calculating the coefficients, p-values, etc). So while there are situations in which plotting the partial effect of individual variables is useful, it's not obvious that this is needed to fulfill your goal.

For how the partial effects are calculated, see this question and the answers.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.