[R] How to plot the regression line of multivariable linear model?

mviljamaa mviljamaa at kapsi.fi
Sun Sep 18 17:26:52 CEST 2016


I'm having a bit of trouble plotting the regression line of 
multivariable linear model.

Specifically my model has one response and two predictors, i.e. it's of 
the form

Y = b_0+b_1*X_1+b_2*X_2

Plotting the regression line for a single predictor model

Y = b_0+b_1*X_1

is simple enough, just call abline() with the coefficients returned by 
lm().

However, I don't know if this can be adapted to multivariable linear 
models.

I also know about curve(), but I don't know how am I supposed to input 
the multivariable model's coefficients into it.



More information about the R-help mailing list