Question:

The attached who.csv dataset contains real-world data from 2008. The variables included follow. Country: name of the country LifeExp: average life expectancy for the country in years InfantSurvival: proportion of those surviving to one year or more Under5Survival: proportion of those surviving to five years or more TBFree: proportion of the population without TB. PropMD: proportion of the population who are MDs PropRN: proportion of the population who are RNs PersExp: mean personal expenditures on healthcare in US dollars at average exchange rate GovtExp: mean government expenditures per capita on healthcare, US dollars at average exchange rate TotExp: sum of personal and government expenditures.

  1. Provide a scatterplot of LifeExp~TotExp, and run simple linear regression. Do not transform the variables. Provide and interpret the F statistics, R^2, standard error,and p-values only. Discuss whether the assumptions of simple linear regression met.

Answer:

## 
## Call:
## lm(formula = LifeExp ~ TotExp, data = who_df)
## 
## 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 ***
## 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

The p-value for this variable is very low, which means that it has been determined to be statistically relevant in the model. The coefficient is approximately 8.08 times bigger than the standard error, which is good. The \({R}^{2}\) value of 0.26 is low but doesn’t necessarily mean that the predictor is insigificant. Finally, the F-statistic, which typically measures whether the model with n terms is a significantly better fit than an n-1 model, in this instance is showing how likely it is that we would get such a data set under no effect, \(null \quad hypotheses \quad {H}_{0}: {R}^{2}=0\).

No, all the assumptions of simple linear regression are not met. We assume that a good model would have constant variability for the predicted values and that the residuals would be normally distributed; however, for this model, that is not correct and can be seen in the following plots:

Question:

  1. Raise life expectancy to the 4.6 power (i.e., LifeExp^4.6). Raise total expenditures to the 0.06 power (nearly a log transform, TotExp^.06). Plot LifeExp^4.6 as a function of TotExp^.06, and r re-run the simple regression model using the transformed variables. Provide and interpret the F statistics, R^2, standard error, and p-values. Which model is “better?”

Answer:

## 
## Call:
## lm(formula = LifeExpPower ~ TotExpPower, data = who_q2_df)
## 
## 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 ***
## TotExpPower  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

As in the first example, the predictor variable has been determined to be relevant. The coefficient is approximately 22.53 times bigger than the standard error, which is very good. The \({R}^{2}\) value of 0.73 also indicates the model is a pretty good fit. Again, the F-statistic shows that this model is a better fit than a null hypothesis of no effect. Also, here are the additional linear fit graphs, which indicate this model is much better fit.

Question:

  1. Using the results from 3, forecast life expectancy when TotExp^.06 =1.5. Then forecast life expectancy when TotExp^.06=2.5.

Answer:

We can use the predict function to determine the resulting y value; however, we also have to raise the value to the reciprocal of the transformation to get the actual life expectancy estimate. for a value of 1.5:

## [1] 63.31153

For a value of 2.5:

## [1] 86.50645

This is an example of possible extrapolation of data. The largest x value (after transformation) within the data set is 2.193 which is very near the requested value of 2.5. I would suggest caution in considering this value as a reliable predictor.

Question:

  1. Build the following multiple regression model and interpret the F Statistics, R^2, standard error, and p-values. How good is the model? LifeExp = b0+b1 x PropMd + b2 x TotExp +b3 x PropMD x TotExp

Answer:

## 
## Call:
## lm(formula = LifeExp ~ PropMD * TotExp, data = who_q2_df)
## 
## 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 ***
## PropMD         1.497e+03  2.788e+02   5.371 2.32e-07 ***
## TotExp         7.233e-05  8.982e-06   8.053 9.39e-14 ***
## PropMD:TotExp -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

So, the p-values indicate that all the predictor variables are relevant. The adjusted \({R}^{2}\) value of 0.35 is somewhat low. The coefficients for PropMD an TotExp are fairly high, whereas the interaction variable t value is close to being considered low. The F-statistic indicates that this model is significantly better than a less complex one. However, the follow up graphs show us that there may be significan issues with the model. The residuals do not appear to have constant variability against the fitted values and the residuals are not normally distributed. Also, the residuals are not normally distributed for each of the predictor variables.

Question:

  1. Forecast LifeExp when PropMD=.03 and TotExp = 14. Does this forecast seem realistic? Why or why not?

Answer:

## [1] 107.696

So, PropMD is the proportion of people who are MDs, which ranges from [0 - 0.0351], which is pretty high in this example. Also, TotExp is the sum of personal and government expenditures, which varies from [13 - 4.827510^{5}] which is very low, comparitively. Obviously, this result does not appear to be realistic, since an age of 107.7 is atypically high. Additionally, we have noted that the model fit does not appear to be appropriate, specifically that there does not appear to be constant variability of residuals as the fitted value result varies.