#Load Data
source = "https://raw.githubusercontent.com/BDavidoff/Data605/main/who.csv"
data = read.csv(source)
#Load Libraries
library(ggplot2)
3. Using the results from 3, forecast life expectancy when TotExp^.06 =1.5. Then forecast life expectancy when TotExp^.06=2.5.
intercept = -736527910
I = 620060216
forcast = (intercept + I * 1.5)^(1/4.6)
forcast2 = (intercept + I * 2.5)^(1/4.6)
print(forcast)
## [1] 63.31153
print(forcast2)
## [1] 86.50645
4. Build the following multiple regression model and interpret the F Statistics, R^2, standard error, and p-values. How good is the model?
summary(lm(data$LifeExp ~ data$PropMD + data$TotExp + data$PropMD * data$TotExp))
##
## Call:
## lm(formula = data$LifeExp ~ data$PropMD + data$TotExp + data$PropMD *
## data$TotExp)
##
## 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 ***
## data$PropMD 1.497e+03 2.788e+02 5.371 2.32e-07 ***
## data$TotExp 7.233e-05 8.982e-06 8.053 9.39e-14 ***
## data$PropMD:data$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
The p-value is smaller than .05, the model is statistically significant. The R-squared value indicates that the independent variable accounts for 35.74% of the variability in the independent variable. The smaller F value indicates a better fit of the model.
5. Forecast LifeExp when PropMD=.03 and TotExp = 14. Does this forecast seem realistic? Why or why not?
le = ( (6.277*10^1) + (1.497*10^3)*.03 + (7.233*10^(-5))*14 - ((6.026*10^(-3))*0.03*14) )
le
## [1] 107.6785
This is not a realistic forcast, as the age is 107 which, is not likely.