In this lesson of our Linear Modeling in R course, you'll begin to dig deeper into linear modeling with R. You'll use R's lm() function and the least squares criterion to fit a linear model to the data.

As you fit the model, though, you'll also be learning about how to effectively interpret your results. You'll make use of familiar statistics concepts like confidence intervals and standard error as you assess the accuracy of the coefficients.

You'll also learn to fit a trendline to a scatterplot in ggplot2 both manually and by using an lm argument.

Of course, as you work with the model, you'll also be reviewing programming and statistics concepts from earlier in our Data Analyst in R path.


  • Estimate the coefficients using least squares
  • Learn to fit, assess, and plot a model using lm

Lesson Outline

1. Introduction
2. Fitting a Bivariate Linear Regression Model
3. Estimating the Slope
4. Estimating the Intercept
5. Visualizing Model Fit
6. Estimating the Predictions
7. Estimating the Residuals
8. Estimating the Residual Sum of Squares
9. Understanding RSS
10. Recap
11. Takeaways