Loading the package and making a dataframe from the Worldbank Data of the South Asian Countries
library(WDI)
library(pander)
X <- WDI(country = c('BD','IN','BT','NP','PK','LK','AF'),
indicator = c("SP.DYN.LE00.IN","SP.DYN.IMRT.IN", "NY.GDP.PCAP.PP.KD" ,
"SH.MED.BEDS.ZS","SH.MED.PHYS.ZS","SH.MED.NUMW.P3"),
start = 2000,end = 2019)
Removing the NA values and replacing the variable names
X <- X[complete.cases(X), ]
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
X <- rename_all(X,recode,SP.DYN.LE00.IN="Life Expectancy at birth(total years)",
SP.DYN.IMRT.IN = "Infant Mortality Rate(per 1000 live births)",
NY.GDP.PCAP.PP.KD = "GDP Per Capita,PPP(Constant 2017 international $)",
SH.MED.BEDS.ZS="Hospital Beds per 1000 people",
SH.MED.PHYS.ZS="Physicians per 1000 people",
SH.MED.NUMW.P3="Nurses and Midwives per 1000 people")
pander(head(X))
Table continues below
| 7 |
AF |
Afghanistan |
2006 |
58.83 |
| 8 |
AF |
Afghanistan |
2007 |
59.38 |
| 9 |
AF |
Afghanistan |
2008 |
59.93 |
| 10 |
AF |
Afghanistan |
2009 |
60.48 |
| 14 |
AF |
Afghanistan |
2013 |
62.52 |
| 15 |
AF |
Afghanistan |
2014 |
62.97 |
Table continues below
| 7 |
74.3 |
1408 |
| 8 |
71.7 |
1563 |
| 9 |
69 |
1588 |
| 10 |
66.5 |
1882 |
| 14 |
57.2 |
2264 |
| 15 |
55.2 |
2249 |
Table continues below
| 7 |
0.4 |
0.1596 |
| 8 |
0.4 |
0.1743 |
| 9 |
0.4 |
0.1744 |
| 10 |
0.4 |
0.2126 |
| 14 |
0.5 |
0.2846 |
| 15 |
0.5 |
0.2983 |
| 7 |
0.44 |
| 8 |
0.4956 |
| 9 |
0.4971 |
| 10 |
0.6078 |
| 14 |
0.2495 |
| 15 |
0.1476 |
Regression life expectancy at birth on health infrastructure
fit1 <- lm (X$`Life Expectancy at birth(total years)`
~ X$`Hospital Beds per 1000 people`
+X$`Physicians per 1000 people`
+X$`Nurses and Midwives per 1000 people`)
summary(fit1)
##
## Call:
## lm(formula = X$`Life Expectancy at birth(total years)` ~ X$`Hospital Beds per 1000 people` +
## X$`Physicians per 1000 people` + X$`Nurses and Midwives per 1000 people`)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.9176 -1.7676 -0.5887 0.5407 6.4220
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 60.8470 1.4447 42.118 < 2e-16
## X$`Hospital Beds per 1000 people` 3.4878 0.7871 4.431 0.00014
## X$`Physicians per 1000 people` 3.9854 2.3341 1.707 0.09921
## X$`Nurses and Midwives per 1000 people` -0.3059 1.5911 -0.192 0.84899
##
## (Intercept) ***
## X$`Hospital Beds per 1000 people` ***
## X$`Physicians per 1000 people` .
## X$`Nurses and Midwives per 1000 people`
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.981 on 27 degrees of freedom
## Multiple R-squared: 0.6247, Adjusted R-squared: 0.583
## F-statistic: 14.98 on 3 and 27 DF, p-value: 6.161e-06
library(broom)
tidy(fit1)
## # A tibble: 4 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) 60.8 1.44 42.1 3.63e-26
## 2 X$`Hospital Beds per 1000 people` 3.49 0.787 4.43 1.40e- 4
## 3 X$`Physicians per 1000 people` 3.99 2.33 1.71 9.92e- 2
## 4 X$`Nurses and Midwives per 1000 people` -0.306 1.59 -0.192 8.49e- 1
glance(fit1)
## # A tibble: 1 x 12
## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 0.625 0.583 2.98 15.0 6.16e-6 3 -75.7 161. 169.
## # ... with 3 more variables: deviance <dbl>, df.residual <int>, nobs <int>
Regressing infant mortality rate on health infrastructure
fit2 <- lm(X$`Infant Mortality Rate(per 1000 live births)`
~X$`Hospital Beds per 1000 people`
+X$`Physicians per 1000 people`
+X$`Nurses and Midwives per 1000 people`)
summary(fit2)
##
## Call:
## lm(formula = X$`Infant Mortality Rate(per 1000 live births)` ~
## X$`Hospital Beds per 1000 people` + X$`Physicians per 1000 people` +
## X$`Nurses and Midwives per 1000 people`)
##
## Residuals:
## Min 1Q Median 3Q Max
## -28.5693 -4.0172 0.5575 8.1405 23.0249
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 61.509 6.850 8.979 1.36e-09
## X$`Hospital Beds per 1000 people` -16.230 3.732 -4.349 0.000175
## X$`Physicians per 1000 people` 21.445 11.068 1.938 0.063197
## X$`Nurses and Midwives per 1000 people` -6.180 7.545 -0.819 0.419901
##
## (Intercept) ***
## X$`Hospital Beds per 1000 people` ***
## X$`Physicians per 1000 people` .
## X$`Nurses and Midwives per 1000 people`
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 14.13 on 27 degrees of freedom
## Multiple R-squared: 0.6604, Adjusted R-squared: 0.6227
## F-statistic: 17.5 on 3 and 27 DF, p-value: 1.64e-06
tidy(fit2)
## # A tibble: 4 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) 61.5 6.85 8.98 1.36e-9
## 2 X$`Hospital Beds per 1000 people` -16.2 3.73 -4.35 1.75e-4
## 3 X$`Physicians per 1000 people` 21.4 11.1 1.94 6.32e-2
## 4 X$`Nurses and Midwives per 1000 peo~ -6.18 7.54 -0.819 4.20e-1
glance(fit2)
## # A tibble: 1 x 12
## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 0.660 0.623 14.1 17.5 1.64e-6 3 -124. 258. 265.
## # ... with 3 more variables: deviance <dbl>, df.residual <int>, nobs <int>
Regressing GDP Per Capita on health infrastructure
fit3 <- lm(X$`GDP Per Capita,PPP(Constant 2017 international $)`
~X$`Hospital Beds per 1000 people`
+X$`Physicians per 1000 people`
+X$`Nurses and Midwives per 1000 people`)
summary(fit3)
##
## Call:
## lm(formula = X$`GDP Per Capita,PPP(Constant 2017 international $)` ~
## X$`Hospital Beds per 1000 people` + X$`Physicians per 1000 people` +
## X$`Nurses and Midwives per 1000 people`)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1434.0 -353.5 -68.4 150.8 4472.4
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 715.0 514.9 1.389 0.17633
## X$`Hospital Beds per 1000 people` 1761.5 280.5 6.279 1.02e-06
## X$`Physicians per 1000 people` 2387.5 831.9 2.870 0.00789
## X$`Nurses and Midwives per 1000 people` 230.5 567.1 0.407 0.68757
##
## (Intercept)
## X$`Hospital Beds per 1000 people` ***
## X$`Physicians per 1000 people` **
## X$`Nurses and Midwives per 1000 people`
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1062 on 27 degrees of freedom
## Multiple R-squared: 0.8007, Adjusted R-squared: 0.7785
## F-statistic: 36.15 on 3 and 27 DF, p-value: 1.346e-09
tidy(fit3)
## # A tibble: 4 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) 715. 515. 1.39 1.76e-1
## 2 X$`Hospital Beds per 1000 people` 1762. 281. 6.28 1.02e-6
## 3 X$`Physicians per 1000 people` 2388. 832. 2.87 7.89e-3
## 4 X$`Nurses and Midwives per 1000 people` 231. 567. 0.407 6.88e-1
glance(fit3)
## # A tibble: 1 x 12
## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 0.801 0.779 1062. 36.2 1.35e-9 3 -258. 526. 533.
## # ... with 3 more variables: deviance <dbl>, df.residual <int>, nobs <int>
Pearson Correlation Table
library(picante)
## Loading required package: ape
## Loading required package: vegan
## Loading required package: permute
## Loading required package: lattice
## This is vegan 2.5-6
## Loading required package: nlme
##
## Attaching package: 'nlme'
## The following object is masked from 'package:dplyr':
##
## collapse
X[1:3] <- NULL
pearson <- cor.table(X,cor.method = "pearson",cor.type = "standard")
panderOptions("table.style", "grid")
pander(pearson$r)
Table continues below
**Life Expectancy at
birth(total years)**
|
1
|
| Infant Mortality Rate(per 1000 live births) |
-0.8841
|
| GDP Per Capita,PPP(Constant 2017 international $) |
0.788
|
| Hospital Beds per 1000 people |
0.7643
|
| Physicians per 1000 people |
0.2983
|
| Nurses and Midwives per 1000 people |
0.5615
|
Table continues below
**Life Expectancy at
birth(total years)**
|
-0.8841
|
| Infant Mortality Rate(per 1000 live births) |
1
|
| GDP Per Capita,PPP(Constant 2017 international $) |
-0.6789
|
| Hospital Beds per 1000 people |
-0.7808
|
| Physicians per 1000 people |
0.1021
|
| Nurses and Midwives per 1000 people |
-0.6091
|
Table continues below
**Life Expectancy at
birth(total years)**
|
0.788
|
| Infant Mortality Rate(per 1000 live births) |
-0.6789
|
| GDP Per Capita,PPP(Constant 2017 international $) |
1
|
| Hospital Beds per 1000 people |
0.857
|
| Physicians per 1000 people |
0.3645
|
| Nurses and Midwives per 1000 people |
0.6738
|
Table continues below
**Life Expectancy at
birth(total years)**
|
0.7643
|
| Infant Mortality Rate(per 1000 live births) |
-0.7808
|
| GDP Per Capita,PPP(Constant 2017 international $) |
0.857
|
| Hospital Beds per 1000 people |
1
|
| Physicians per 1000 people |
0.1306
|
| Nurses and Midwives per 1000 people |
0.7277
|
Table continues below
**Life Expectancy at
birth(total years)**
|
0.2983
|
| Infant Mortality Rate(per 1000 live births) |
0.1021
|
| GDP Per Capita,PPP(Constant 2017 international $) |
0.3645
|
| Hospital Beds per 1000 people |
0.1306
|
| Physicians per 1000 people |
1
|
| Nurses and Midwives per 1000 people |
0.1978
|
**Life Expectancy at
birth(total years)**
|
0.5615
|
| Infant Mortality Rate(per 1000 live births) |
-0.6091
|
| GDP Per Capita,PPP(Constant 2017 international $) |
0.6738
|
| Hospital Beds per 1000 people |
0.7277
|
| Physicians per 1000 people |
0.1978
|
| Nurses and Midwives per 1000 people |
1
|
Spearman Correlation Table
spearman <- cor.table(X,cor.method = "spearman",cor.type ="standard")
pander(spearman$r)
Table continues below
**Life Expectancy at
birth(total years)**
|
1
|
| Infant Mortality Rate(per 1000 live births) |
-0.8089
|
| GDP Per Capita,PPP(Constant 2017 international $) |
0.7802
|
| Hospital Beds per 1000 people |
0.5996
|
| Physicians per 1000 people |
0.3206
|
| Nurses and Midwives per 1000 people |
0.3794
|
Table continues below
**Life Expectancy at
birth(total years)**
|
-0.8089
|
| Infant Mortality Rate(per 1000 live births) |
1
|
| GDP Per Capita,PPP(Constant 2017 international $) |
-0.4694
|
| Hospital Beds per 1000 people |
-0.4447
|
| Physicians per 1000 people |
0.1488
|
| Nurses and Midwives per 1000 people |
-0.3367
|
Table continues below
**Life Expectancy at
birth(total years)**
|
0.7802
|
| Infant Mortality Rate(per 1000 live births) |
-0.4694
|
| GDP Per Capita,PPP(Constant 2017 international $) |
1
|
| Hospital Beds per 1000 people |
0.7815
|
| Physicians per 1000 people |
0.6101
|
| Nurses and Midwives per 1000 people |
0.5153
|
Table continues below
**Life Expectancy at
birth(total years)**
|
0.5996
|
| Infant Mortality Rate(per 1000 live births) |
-0.4447
|
| GDP Per Capita,PPP(Constant 2017 international $) |
0.7815
|
| Hospital Beds per 1000 people |
1
|
| Physicians per 1000 people |
0.3573
|
| Nurses and Midwives per 1000 people |
0.5097
|
Table continues below
**Life Expectancy at
birth(total years)**
|
0.3206
|
| Infant Mortality Rate(per 1000 live births) |
0.1488
|
| GDP Per Capita,PPP(Constant 2017 international $) |
0.6101
|
| Hospital Beds per 1000 people |
0.3573
|
| Physicians per 1000 people |
1
|
| Nurses and Midwives per 1000 people |
0.2125
|
**Life Expectancy at
birth(total years)**
|
0.3794
|
| Infant Mortality Rate(per 1000 live births) |
-0.3367
|
| GDP Per Capita,PPP(Constant 2017 international $) |
0.5153
|
| Hospital Beds per 1000 people |
0.5097
|
| Physicians per 1000 people |
0.2125
|
| Nurses and Midwives per 1000 people |
1
|