I have a parametric polynomial regression
in R
, that I fitted to my data like so:
poly_model <- lm(mydataframef$y ~ poly(mydataframe$x,degree=5))
mydf
obviously contains y
and x
. Then I plot it like this
plot(mydataframe$x, mydataframe$y, xlab='regressor or predictor variable polynomial regression', ylab='outcome or label')
Then I want to add the polynomial that was fitted, so I do the following:
abline(poly_model)
This gives me a warning:
Warning message:
In abline(poly_model) :
only using the first two of 6 regression coefficients
Of course, the plot is all out of wack because , as promised it only uses the first two, which are the intercept and slope. Why would it be only using the first two coefficients, when I only have one predictor variable? So, the plot should be 2-d anyway? Confused. Thanks.