#Longley's Economic Regression Data
data(longley)
dim(longley)
## [1] 16 7
head(longley)
## GNP.deflator GNP Unemployed Armed.Forces Population Year Employed
## 1947 83.0 234.289 235.6 159.0 107.608 1947 60.323
## 1948 88.5 259.426 232.5 145.6 108.632 1948 61.122
## 1949 88.2 258.054 368.2 161.6 109.773 1949 60.171
## 1950 89.5 284.599 335.1 165.0 110.929 1950 61.187
## 1951 96.2 328.975 209.9 309.9 112.075 1951 63.221
## 1952 98.1 346.999 193.2 359.4 113.270 1952 63.639
res.lm=lm(Employed~.- Unemployed+GNP+GNP.deflator+Population+Armed.Forces,data=longley)
summary(res.lm)
##
## Call:
## lm(formula = Employed ~ . - Unemployed + GNP + GNP.deflator +
## Population + Armed.Forces, data = longley)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.66533 -0.30357 0.01415 0.26417 0.77112
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -403.18616 789.53789 -0.511 0.620671
## GNP.deflator -0.17988 0.11414 -1.576 0.146112
## GNP 0.09518 0.01760 5.406 0.000299 ***
## Armed.Forces -0.00485 0.00272 -1.783 0.104971
## Population -0.76018 0.23816 -3.192 0.009624 **
## Year 0.27650 0.41690 0.663 0.522174
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4926 on 10 degrees of freedom
## Multiple R-squared: 0.9869, Adjusted R-squared: 0.9803
## F-statistic: 150.5 on 5 and 10 DF, p-value: 4.479e-09
anova(res.lm)
## Analysis of Variance Table
##
## Response: Employed
## Df Sum Sq Mean Sq F value Pr(>F)
## GNP.deflator 1 174.397 174.397 718.7018 1.205e-10 ***
## GNP 1 4.787 4.787 19.7282 0.001251 **
## Armed.Forces 1 0.138 0.138 0.5683 0.468298
## Population 1 3.153 3.153 12.9936 0.004811 **
## Year 1 0.107 0.107 0.4399 0.522174
## Residuals 10 2.427 0.243
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(res.lm)