Dear all, I want to write regression equation on R graph by taking the actual values of the regression coefficients. I have problem when writing X^2 (printed as X superscripts 2). I know there's a function "expression" but still no luck to use it in this case.
Below is the R code as an example: plot(x,y,col=2) reg.quad<-lm(y~x+I(x^2)) quad.fit<-coef(reg.quad)[1]+coef(reg.quad)[2]*x+coef(reg.quad)[3]*x^2 lines(x,quad.fit,lty=1) text(4,1,paste("y=",round(coef(reg.quad)[1],4),round(coef(reg.quad)[2],4),"X",round(coef(reg.quad)[3],4),"X^2"),col=4) Thanks in advance. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.