LMR Exercise 7.3
FemLab appears to have the lowest P value
##
## Call:
## lm(formula = divorce ~ unemployed + femlab + marriage + birth +
## military, data = divusa)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.8611 -0.8916 -0.0496 0.8650 3.8300
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.48784 3.39378 0.733 0.4659
## unemployed -0.11125 0.05592 -1.989 0.0505 .
## femlab 0.38365 0.03059 12.543 < 2e-16 ***
## marriage 0.11867 0.02441 4.861 6.77e-06 ***
## birth -0.12996 0.01560 -8.333 4.03e-12 ***
## military -0.02673 0.01425 -1.876 0.0647 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.65 on 71 degrees of freedom
## Multiple R-squared: 0.9208, Adjusted R-squared: 0.9152
## F-statistic: 165.1 on 5 and 71 DF, p-value: < 2.2e-16
The Plot shows dash slope gets shallower in areas where the points are closer to the line.
##
## Call:
## lm(formula = divorce ~ femlab, data = divusa)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.7264 -1.6385 0.1595 1.2211 8.0442
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -3.65527 0.92798 -3.939 0.000182 ***
## femlab 0.43867 0.02302 19.056 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.361 on 75 degrees of freedom
## Multiple R-squared: 0.8288, Adjusted R-squared: 0.8265
## F-statistic: 363.1 on 1 and 75 DF, p-value: < 2.2e-16
## (Intercept) I(femlab + rnorm(50))
## -3.5182228 0.4352488
## (Intercept) I(femlab + 2 * rnorm(50))
## -3.1736670 0.4284811
##
## Naive model:
## lm(formula = divorce ~ femlab, data = divusa, x = TRUE)
##
## SIMEX-Variables: divorce
## Number of Simulations: 1000
##
## Coefficients:
## (Intercept) femlab
## -3.641 0.438
\[\verb!The predicted value of ! \hat{\beta} \verb! is: 0.4!\]
The eigen values are large in range and condition numbers are large. There is low variance inflation is low.
## year divorce unemployed femlab marriage birth military
## year 1.00 0.88 -0.23 0.99 -0.62 -0.58 0.01
## divorce 0.88 1.00 -0.21 0.91 -0.53 -0.72 0.02
## unemployed -0.23 -0.21 1.00 -0.26 -0.27 -0.31 -0.40
## femlab 0.99 0.91 -0.26 1.00 -0.65 -0.60 0.05
## marriage -0.62 -0.53 -0.27 -0.65 1.00 0.67 0.26
## birth -0.58 -0.72 -0.31 -0.60 0.67 1.00 0.14
## military 0.01 0.02 -0.40 0.05 0.26 0.14 1.00
## [1] 1.252019e+05 6.470014e+00
## [1] 1.0000 139.1082
## (Intercept) femlab
## 1.995224 1.000000
Creating random perbutation with sqrt of max vif value gives us a good p value for marriage , birth and femlab. The correlation matrix confirms that these value have the highest correlation. This linear model has a RSquared value of 0.813.
##
## Call:
## lm(formula = divorce + sqrt(max(vif(x))) * rnorm(38) ~ unemployed +
## femlab + marriage + birth + military, data = divusa)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.4289 -1.5154 0.1035 1.3819 5.0485
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.51105 4.73761 -0.319 0.7507
## unemployed -0.07458 0.07807 -0.955 0.3427
## femlab 0.42210 0.04270 9.886 5.54e-15 ***
## marriage 0.14893 0.03408 4.370 4.17e-05 ***
## birth -0.13016 0.02177 -5.979 8.21e-08 ***
## military -0.03703 0.01989 -1.862 0.0668 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.304 on 71 degrees of freedom
## Multiple R-squared: 0.864, Adjusted R-squared: 0.8544
## F-statistic: 90.21 on 5 and 71 DF, p-value: < 2.2e-16
## (Intercept) femlab
## (Intercept) 1 NA
## femlab NA 1
The new linear model with just the high correlated values result in an higher RSquared value of 0.9106.
##
## Call:
## lm(formula = divorce ~ marriage + birth + femlab, data = divusa)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.6923 -1.1934 -0.0534 1.2265 3.6701
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.54545 2.21247 -0.699 0.487
## marriage 0.12609 0.02199 5.735 2.07e-07 ***
## birth -0.11627 0.01412 -8.235 5.10e-12 ***
## femlab 0.41337 0.02275 18.174 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.695 on 73 degrees of freedom
## Multiple R-squared: 0.9141, Adjusted R-squared: 0.9106
## F-statistic: 258.9 on 3 and 73 DF, p-value: < 2.2e-16