Performing an OLS Regression


Using some basic R functions, you can easily perform an Ordinary Least Squares (OLS) regression and create a scatterplot comparing predicted results vs. actual results.

In this example the mtcars dataset contains data on fuel consumption for 32 vehicles manufactured in the 1973-1974 model year. This example compares actual fuel consumption to predicted fuel consumption using an OLS regression.


Patrick Wiese, ASA

Improve this page

Please let us know if you see an error or omission on this page.

Provide Feedback