April 27, 2018
##
## Call:
## lm(formula = who.data$LifeExp ~ who.data$TotExp)
##
## Residuals:
## Min 1Q Median 3Q Max
## -24.764 -4.778 3.154 7.116 13.292
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.475e+01 7.535e-01 85.933 < 2e-16 ***
## who.data$TotExp 6.297e-05 7.795e-06 8.079 7.71e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.371 on 188 degrees of freedom
## Multiple R-squared: 0.2577, Adjusted R-squared: 0.2537
## F-statistic: 65.26 on 1 and 188 DF, p-value: 7.714e-14
While our first model does not look linear, the statistics look promising:
Our F-statistic, which is equivalent to t2 in this simple case, is 65.2641982. With a critical value of 3.89 (1,188 df) it shows a statistically significant relationship.
The coefficient of determination, or R2 value is 0.2576922. This means that our model accounts for about a quarter of the variation in life expectancy.
The standard error is 9.3710333, compared to a mean life expectancy of 67.3789474. This is appropriately small.
The p-value for the slope is 7.713993110^{-14}. That means there is a very low chance that our slope is not statistically significant at a .001 significance level.
##
## Call:
## lm(formula = transformed$LifeExp ~ transformed$TotExp)
##
## Residuals:
## Min 1Q Median 3Q Max
## -308616089 -53978977 13697187 59139231 211951764
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -736527910 46817945 -15.73 <2e-16 ***
## transformed$TotExp 620060216 27518940 22.53 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 90490000 on 188 degrees of freedom
## Multiple R-squared: 0.7298, Adjusted R-squared: 0.7283
## F-statistic: 507.7 on 1 and 188 DF, p-value: < 2.2e-16
Our second model appears linear and each of the statistics shows this model is better:
Our F-statistic, which is equivalent to t2 in this simple case, is 507.6967054. With a critical value of 3.89 (1,188 df) it shows a statistically significant relationship.
The coefficient of determination, or R2 value is 0.7297673. This means that our transformed model accounts for most of the variation in life expectancy.
The standard error is 9.049239310^{7}, compared to a mean life expectancy of 3.079572110^{8}. This is appropriately small.
The p-value for the slope is 2.601428410^{-55}. That means there is a very low chance that our slope is not statistically significant at a .001 significance level.
Using our second model, our forecast life expectancy is 63.3099577 when TotExp^.06 =1.5.
Our forecast for life expectancy is 86.5041335 when TotExp^.06=2.5.
##
## Call:
## lm(formula = transformed.2$LifeExp ~ transformed.2$DoctorProportion +
## transformed.2$TotExp + transformed.2$ExpendDocs)
##
## Residuals:
## Min 1Q Median 3Q Max
## -27.320 -4.132 2.098 6.540 13.074
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.277e+01 7.956e-01 78.899 < 2e-16 ***
## transformed.2$DoctorProportion 1.497e+03 2.788e+02 5.371 2.32e-07 ***
## transformed.2$TotExp 7.233e-05 8.982e-06 8.053 9.39e-14 ***
## transformed.2$ExpendDocs -6.026e-03 1.472e-03 -4.093 6.35e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.765 on 186 degrees of freedom
## Multiple R-squared: 0.3574, Adjusted R-squared: 0.3471
## F-statistic: 34.49 on 3 and 186 DF, p-value: < 2.2e-16
Our third model is statistically significant, but the statistics shows this model is not as good as the second model.
Our F-statistic is 34.4883268. With a critical value of 2.65316 (3,186 df) it shows a statistically significant relationship. The t-statistics for each variable and the interaction term are significant at the .001 level.
The coefficient of determination, or R2 value is 0.3574352. This means that our transformed model accounts for less of the variation in life expectancy than the second model. This is not surprising because we previously discovered that the relationship between one of our explanatory variables and the dependent variable.
The standard error is 8.7654934, compared to a mean life expectancy of 67.3789474. This is appropriately small.
The p-value for the slope is 2.320602810^{-7}. That means there is a very low chance that our slope is not statistically significant at a .001 significance level. It is less significant than the second model, though.
Using our third model, our forecast life expectancy is 107.6960037 when PropMD=.03 and TotExp = 14.