Regression line

code:
      > ggplot(bwdf, aes(x=age, y=lwt))+ geom_point()+ geom_smooth(method='lm')

output (graph): 

                    

The method can be lm for linear regression, rlm for robust regression (needs MASS package), loess (default) for local regression to produce a smooth curve. The confidence interval bands are also drawn on the plot. The option se=F can be added if confidence interval bands are not required.


    Comments & Feedback