- a statistical method used to predict the relationship between 2 continuous variables
- Goal is to find the best fitted line for a set of data points
Independent Variable (predictor) : x
Dependent Variable (outcome) : y
2026-09-16
Independent Variable (predictor) : x
Dependent Variable (outcome) : y
\(\hat{y_{i}}=b_{0}+b_{1}x_{i}\)
cars_example = lm(mpg ~ hp, data = mtcars)
cars_example now contains the following components :
Use the coefficients of the lm() component to plot the line.
g = g + geom_abline( intercept = cars_example$coefficients[1], slope = cars_example$coefficients[2])