You can see how simple linear and polynomial regression work on the basis of lm function. The confidence interval of the model and data are also presented. A new function called linplot is created to produce desired chart comfortably. R and RStudio free software are used to demonstrate the method.