Linear regression models the relationship between two variables.
\[ y = \beta_0 + \beta_1 x + \epsilon \]
Where:
- \(\beta_0\) is the intercept
- \(\beta_1\) is the slope
- \(\epsilon\) is the error
Linear regression models the relationship between two variables.
\[ y = \beta_0 + \beta_1 x + \epsilon \]
Where:
- \(\beta_0\) is the intercept
- \(\beta_1\) is the slope
- \(\epsilon\) is the error
ggplot(mtcars, aes(wt, mpg)) + geom_point() + geom_smooth(method = "lm")
\[ \hat{y} = 37.29 - 5.34x \]
This means for every extra 1,000 lbs in weight, MPG goes down by about 5.34.
The R-squared value is around 0.75, which means the model explains 75% of the variance in MPG.
\[ \begin{align*} 1. & \text{ Linearity} \\ 2. & \text{ Independence of errors} \\ 3. & \text{ Constant variance (Homoscedasticity)} \\ 4. & \text{ Normally distributed residuals} \end{align*} \]
Thank you!