car_model <- lm(mpg ~ wt, data = mtcars)
summary(car_model)$coefficients
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 37.285126 1.877627 19.857575 8.241799e-19
## wt -5.344472 0.559101 -9.559044 1.293959e-10
cat("R-squared:", summary(car_model)$r.squared, "\n")
## R-squared: 0.7528328
- The coefficients show the estimated intercept and slope
- The p-values indicate whether the relationship is statistically significant
- R-squared shows how much of the fuel efficiency variation is explained by weight