library(ggplot2)
library(GGally)
## Registered S3 method overwritten by 'GGally':
##   method from   
##   +.gg   ggplot2
library(gridExtra)
library(relaimpo)
## Loading required package: MASS
## Loading required package: boot
## Loading required package: survey
## Loading required package: grid
## Loading required package: Matrix
## Loading required package: survival
## 
## Attaching package: 'survival'
## The following object is masked from 'package:boot':
## 
##     aml
## 
## Attaching package: 'survey'
## The following object is masked from 'package:graphics':
## 
##     dotchart
## Loading required package: mitools
## This is the global version of package relaimpo.
## If you are a non-US user, a version with the interesting additional metric pmvd is available
## from Ulrike Groempings web site at prof.beuth-hochschule.de/groemping.

Reading data

# data from 
# https://ceoworld.biz/2019/08/05/revealed-countries-with-the-best-health-care-systems-2019/
# Data include
# Health care infrastructure; health care professionals (doctors, nursing staff, and other health workers) competencies; cost (USD p.a.per capita); quality medicine availability, and government readiness

hci = read.csv("~/Dropbox/Temp Files/Health Care Index 2019.csv")
head(hci)
##   Rank     Country Region   HCI Infra Professional  Cost MedAvail
## 1    1      Taiwan   Asia 78.72 87.16        14.23 83.59    82.30
## 2    2 South Korea   Asia 77.70 79.05        13.06 78.39    78.99
## 3    3       Japan   Asia 74.11 90.75        30.01 82.59    92.06
## 4    4     Austria Europe 71.32 86.18        20.25 78.99    88.23
## 5    5     Denmark Europe 70.73 78.77        21.60 74.88    74.18
## 6    6    Thailand   Asia 67.99 92.58        17.37 96.22    67.51
##   GovtReady
## 1     87.89
## 2     65.09
## 3     96.30
## 4     91.80
## 5     93.20
## 6     89.91

Correlational plot

ggpairs(data=hci, columns=4:9, ggplot2::aes(colour=Region))

# Regression analysis and relative importance

mod = lm(HCI ~ Infra + Professional + Cost + MedAvail + GovtReady, data=hci)
summary(mod)
## 
## Call:
## lm(formula = HCI ~ Infra + Professional + Cost + MedAvail + GovtReady, 
##     data = hci)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -26.258  -2.533   0.123   2.515  13.263 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  20.36645    8.97358   2.270   0.0258 *  
## Infra        -0.62123    0.14183  -4.380 3.44e-05 ***
## Professional  0.01852    0.11055   0.168   0.8674    
## Cost          1.41033    0.11375  12.398  < 2e-16 ***
## MedAvail     -0.15703    0.08431  -1.863   0.0661 .  
## GovtReady    -0.05941    0.11328  -0.524   0.6013    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 6.374 on 83 degrees of freedom
## Multiple R-squared:  0.7105, Adjusted R-squared:  0.6931 
## F-statistic: 40.74 on 5 and 83 DF,  p-value: < 2.2e-16
calc.relimp(mod)
## Response variable: HCI 
## Total response variance: 132.3905 
## Analysis based on 89 observations 
## 
## 5 Regressors: 
## Infra Professional Cost MedAvail GovtReady 
## Proportion of variance explained by model: 71.05%
## Metrics are not normalized (rela=FALSE). 
## 
## Relative importance metrics: 
## 
##                      lmg
## Infra        0.105516147
## Professional 0.003741185
## Cost         0.541029121
## MedAvail     0.056283858
## GovtReady    0.003948972
## 
## Average coefficients for different model sizes: 
## 
##                      1X         2Xs        3Xs         4Xs         5Xs
## Infra        0.44551737  0.12753968 -0.1500818 -0.39539585 -0.62123327
## Professional 0.07392666  0.05496537  0.1038151  0.09452693  0.01851938
## Cost         0.78952682  1.01299778  1.1940432  1.32699413  1.41033182
## MedAvail     0.29184574  0.08583670 -0.0623709 -0.14754973 -0.15703162
## GovtReady    0.05820162 -0.06519324 -0.1365841 -0.12857408 -0.05941053