Simple Linear Regression for a Numerical Explanatory Variable
Perform linear regression for a numerical variable in R and learn the principles behind it.
Recall the concepts of algebra that the equation of a line is ⋅
symbol is equivalent to the *
“multiply by” mathematical symbol. We’ll use the ⋅
symbol in the rest of this course as it’s more succinct.) It’s defined by two coefficients
However, when defining a regression line, we use a slightly different notation, i.e., the equation of the regression line is
Recall that the regression line has a positive slope bty_avg
. This is because instructors tend to have higher bty_avg
scores, they also tend to have higher teaching evaluation scores
. However, what is the numerical value of the slope
We can obtain the values of the intercept bty_avg
We first fit the linear regression model using the
lm()
function and save it inscore_model
.We get the regression table by applying the
get_regression_table()
function from themoderndive
package toscore_model
Get hands-on with 1400+ tech skills courses.