Somewhat newbie question here. I'd like to use ggplot2 to plot my multiple regression model, but I ran into an error. I did some research on the forum before deciding to ask the community.
I understand how to plot a simple linear regression:
ggplot(data, aes(x=X, y=Y))+geom_point()+
geom_smooth(method='lm',formula=Y~X)
But when I tried to do it for multiple regression:
Model<-lm(Y~x1*x2*x3*x4*x5, data, na.action=na.omit)
ggplot(data, aes(x=X, y=Model))+geom_point()+
geom_smooth(method='lm',formula=Y~x1*x2*x3*x4*x5)
I get this error:
Don't know how to automatically pick scale for object of type lm. Defaulting to continuous.
Error: Aesthetics must be either length 1 or the same as the data (209): x, y