Simple linear regression studies the relationship between:
- one explanatory variable \(x\)
- one response variable \(y\)
In this example:
- \(x\) = car weight (wt)
- \(y\) = miles per gallon (mpg)
Simple linear regression studies the relationship between:
In this example:
\[ Y = \beta_0 + \beta_1 x + \varepsilon \]
\[ H_0: \beta_1 = 0 \]
\[ H_a: \beta_1 \neq 0 \]
If the p-value is small, we reject \(H_0\).
## mpg wt ## Mazda RX4 21.0 2.620 ## Mazda RX4 Wag 21.0 2.875 ## Datsun 710 22.8 2.320 ## Hornet 4 Drive 21.4 3.215 ## Hornet Sportabout 18.7 3.440 ## Valiant 18.1 3.460
This dataset includes:
ggplot(mtcars, aes(wt, mpg)) +
geom_point() +
geom_smooth(method = "lm") +
labs(
title = "MPG vs Weight",
x = "Weight (1000 lbs)",
y = "Miles per Gallon"
)