I use data from Moodle E-learning course, the dataset name is Life Expectancy Data Set, and I narrowed down the data to the year 2015 and the following variables:
Adult Mortality
Hepatitis B
HIV/AIDS
Diphtheria
I use this code:
adot.tmp <- read.csv(“Life_Expectancy_Data.csv”, sep = “,”, header = TRUE, dec = “.”, check.names = TRUE)
attach(adot.tmp)
adot <- adot.tmp[Year == 2015, c(“Country”, “Adult.Mortality”,“Hepatitis.B”, “HIVAIDS”, “Diphtheria”, “GDP”)]
detach(adot.tmp)
attach(adot)
I made some statistical summaries:
summary(adot)
Country Adult.Mortality Hepatitis.B HIVAIDS
Length:183 Min. : 1.0 Min. : 6.00 Min. :0.1000
Class :character 1st Qu.: 74.0 1st Qu.:78.75 1st Qu.:0.1000
Mode :character Median :138.0 Median :93.00 Median :0.1000
Mean :152.9 Mean :82.43 Mean :0.6607
3rd Qu.:213.0 3rd Qu.:97.00 3rd Qu.:0.4000
Max. :484.0 Max. :99.00 Max. :9.3000
NA's :9
Diphtheria GDP
Min. : 6.00 Min. : 33.68
1st Qu.:83.50 1st Qu.: 766.01
Median :93.00 Median : 2916.23
Mean :84.63 Mean : 7185.33
3rd Qu.:97.00 3rd Qu.: 7290.11
Max. :99.00 Max. :66346.52
NA's :29
The regression model examines the relationship between Adult Mortality (dependent variable) and the Hepatitis B, HIV/AIDS, and Diphtheria (independent variables). It is expressed as:
Adult.Mortality=β0+β1Hepatitis.B+β2HIV/AIDS+β3Diphtheria+ϵ
regr <- lm(Adult.Mortality ~ +1 + Hepatitis.B + HIVAIDS + Diphtheria)
summary(regr)
Call:
lm(formula = Adult.Mortality ~ +1 + Hepatitis.B + HIVAIDS + Diphtheria)
Residuals:
Min 1Q Median 3Q Max
-288.617 -49.594 6.956 46.333 262.486
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 146.5063 26.4191 5.545 1.10e-07 ***
Hepatitis.B 1.0883 0.6049 1.799 0.0738 .
HIVAIDS 42.2123 4.7345 8.916 7.37e-16 ***
Diphtheria -1.2871 0.6596 -1.951 0.0527 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 76.9 on 170 degrees of freedom
(9 observations deleted due to missingness)
Multiple R-squared: 0.3955, Adjusted R-squared: 0.3848
F-statistic: 37.07 on 3 and 170 DF, p-value: < 2.2e-16
plot(regr)
Multiple R-squared is 0.3955, this indicates that approximately 39.55% of the variance in Adult Mortality can be explained by the predictors (Hepatitis B, HIV/AIDS, and Diphtheria). Adjusted R-squared is 0.3848, this adjusts the R-squared value for the number of predictors in the model. It is slightly lower than the Multiple R-squared, suggesting that the inclusion of predictors may not significantly improve the model’s explanatory power. The model is significant with a very low p-value (< 2.2e-16), it indicates that at least one of the predictors has a significant effect on Adult Mortality. Overall, the model suggests that the HIV/AIDS variable has a statistically significant positive association with Adult Mortality, while the associations with Hepatitis B and Diphtheria variables are less clear and require further investigation.