I am conducting an OLS regression panel data analysis with package PLM
in R.
I use the following script to obtain a plot and fitting line of variables D and GDPCAP:
yhat <-ols$fitted
plot(mydata$GDPCAP, mydata$D, pch=19, xlab="GDPCAP", ylab="D")
abline(lm(mydata$D~mydata$G),lwd=3, col="red")
Is there any script that can fit a quadratic line as well as provide the quadratic equation coefficients of the line?