head(cars)
## speed dist
## 1 4 2
## 2 4 10
## 3 7 4
## 4 7 22
## 5 8 16
## 6 9 10
plot(cars, xlab = "Speed in mph", ylab = "Stopping Distance in ft", las = 1)
lines(lowess(cars$speed, cars$dist, f = 2/3, iter = 3), col = "red")
title(main = "Cars")

plot(cars, xlab = "Speed in mph", ylab = "Stopping Distance in ft", las = 1, log = "xy")
title(main = "Cars (logarithmic scales)")
lines(lowess(cars$speed, cars$dist, f = 2/3, iter = 3), col = "red")

Speed <- log(cars$speed)
Stopping_Distance <- log(cars$dist)
lregression <- lm(Stopping_Distance ~ Speed, data = cars)
summary(lregression)
##
## Call:
## lm(formula = Stopping_Distance ~ Speed, data = cars)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.00215 -0.24578 -0.02898 0.20717 0.88289
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.7297 0.3758 -1.941 0.0581 .
## Speed 1.6024 0.1395 11.484 2.26e-15 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4053 on 48 degrees of freedom
## Multiple R-squared: 0.7331, Adjusted R-squared: 0.7276
## F-statistic: 131.9 on 1 and 48 DF, p-value: 2.259e-15
par(mfrow = c(2, 2))
plot(lregression)

- The R-squared value is 73.31% (high) and looks good.