Take a look at dataset
head(airquality)
## Ozone Solar.R Wind Temp Month Day
## 1 41 190 7.4 67 5 1
## 2 36 118 8.0 72 5 2
## 3 12 149 12.6 74 5 3
## 4 18 313 11.5 62 5 4
## 5 NA NA 14.3 56 5 5
## 6 28 NA 14.9 66 5 6
Visualize the data
plot(airquality$Temp, airquality$Wind , xlab = "Temperature", ylab = "Wind Speed")

The Linear Model Fuction
attach(airquality)
liner <- lm(Wind ~ Temp)
liner
##
## Call:
## lm(formula = Wind ~ Temp)
##
## Coefficients:
## (Intercept) Temp
## 23.2337 -0.1705
Evaluate the quality of the model
summary(liner)
##
## Call:
## lm(formula = Wind ~ Temp)
##
## Residuals:
## Min 1Q Median 3Q Max
## -8.5784 -2.4489 -0.2261 1.9853 9.7398
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 23.23369 2.11239 10.999 < 2e-16 ***
## Temp -0.17046 0.02693 -6.331 2.64e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.142 on 151 degrees of freedom
## Multiple R-squared: 0.2098, Adjusted R-squared: 0.2045
## F-statistic: 40.08 on 1 and 151 DF, p-value: 2.642e-09
Resudual Analysis
plot(fitted(liner), resid(liner))

qqnorm(resid(liner))
qqline(resid(liner))
