GALAXY HAPPINESS CASE STUDY

Task :Identify what makes galaxies better off;

Setting up environment

Notes:The following packages were used(description shown)

library(tidyverse)#For data cleaning and organizing
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5     v purrr   0.3.4
## v tibble  3.1.5     v dplyr   1.0.7
## v tidyr   1.1.4     v stringr 1.4.0
## v readr   2.0.2     v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(ggplot2)#For plotting
library(knitr)#For use with rmarkdown in presentation
library(lubridate)#For date use and conversion
## 
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
## 
##     date, intersect, setdiff, union
library(rmarkdown)#For creating a sharable document
library(janitor)#For easing data cleaning
## 
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
## 
##     chisq.test, fisher.test
library(skimr)#For easy summary

IMPORT THE DATA(PREPARE)

Notes:One data set was imported for this analysis

#IMPORT THE DATA
#used only the validation dataset to increase accuracy
Test <- read_csv("C:\\Users\\Lusui\\OneDrive - CM Advocates, LLP\\Documents\\R\\Data\\Validation.csv")
## Rows: 720 Columns: 81
## -- Column specification --------------------------------------------------------
## Delimiter: ","
## chr  (1): galaxy
## dbl (79): ID, galactic year, existence expectancy index, existence expectanc...
## lgl  (1): Predicted Well-Being Index
## 
## i Use `spec()` to retrieve the full column specification for this data.
## i Specify the column types or set `show_col_types = FALSE` to quiet this message.

PREVIEW THE DATA AND FIND THE STRUCTURE

Notes: Just the first 6 rows & then look at the structure

head(Test)
## # A tibble: 6 x 81
##       ID `galactic year` galaxy       `existence expectan~ `existence expectanc~
##    <dbl>           <dbl> <chr>                       <dbl>                 <dbl>
## 1 886447         1004004 Andromeda G~                0.804                  82.7
## 2 687564         1005006 Andromeda G~                0.860                  73.7
## 3 494935         1006009 Andromeda G~                0.811                  68.5
## 4 378919         1015056 Andromeda G~                0.837                  68.7
## 5 421878         1004004 Andromeda I                 0.749                  72.1
## 6 949719         1005006 Andromeda I                 0.780                  73.3
## # ... with 76 more variables: Gross income per capita <dbl>,
## #   Income Index <dbl>, Expected years of education (galactic years) <dbl>,
## #   Mean years of education (galactic years) <dbl>,
## #   Intergalactic Development Index (IDI) <dbl>, Education Index <dbl>,
## #   Intergalactic Development Index (IDI), Rank <dbl>,
## #   Population using at least basic drinking-water services (%) <dbl>,
## #   Population using at least basic sanitation services (%) <dbl>, ...
tail(Test)
## # A tibble: 6 x 81
##       ID `galactic year` galaxy         `existence expectan~ `existence expecta~
##    <dbl>           <dbl> <chr>                         <dbl>               <dbl>
## 1 881904         1012036 Willman 1                     1.02                 88.9
## 2 389587         1015056 Willman 1                     1.01                 92.5
## 3  17112         1003002 Wolf-Lundmark~                0.628                58.8
## 4 583782         1004004 Wolf-Lundmark~                0.604                58.3
## 5 823832         1005006 Wolf-Lundmark~                0.574                53.4
## 6 872042         1006009 Wolf-Lundmark~                0.615                58.8
## # ... with 76 more variables: Gross income per capita <dbl>,
## #   Income Index <dbl>, Expected years of education (galactic years) <dbl>,
## #   Mean years of education (galactic years) <dbl>,
## #   Intergalactic Development Index (IDI) <dbl>, Education Index <dbl>,
## #   Intergalactic Development Index (IDI), Rank <dbl>,
## #   Population using at least basic drinking-water services (%) <dbl>,
## #   Population using at least basic sanitation services (%) <dbl>, ...
dim(Test)
## [1] 720  81
#Structure of the validation data set
str(Test)
## spec_tbl_df [720 x 81] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
##  $ ID                                                                                     : num [1:720] 886447 687564 494935 378919 421878 ...
##  $ galactic year                                                                          : num [1:720] 1004004 1005006 1006009 1015056 1004004 ...
##  $ galaxy                                                                                 : chr [1:720] "Andromeda Galaxy (M31)" "Andromeda Galaxy (M31)" "Andromeda Galaxy (M31)" "Andromeda Galaxy (M31)" ...
##  $ existence expectancy index                                                             : num [1:720] 0.804 0.86 0.811 0.837 0.749 ...
##  $ existence expectancy at birth                                                          : num [1:720] 82.7 73.7 68.5 68.7 72.1 ...
##  $ Gross income per capita                                                                : num [1:720] 17300 24972 15944 20953 30068 ...
##  $ Income Index                                                                           : num [1:720] 0.691 0.67 0.766 0.757 0.641 ...
##  $ Expected years of education (galactic years)                                           : num [1:720] 16.1 12.9 14.2 14.3 12.5 ...
##  $ Mean years of education (galactic years)                                               : num [1:720] 11.28 10.49 9.96 10.33 7.13 ...
##  $ Intergalactic Development Index (IDI)                                                  : num [1:720] 0.716 0.728 0.757 0.759 0.674 ...
##  $ Education Index                                                                        : num [1:720] 0.746 0.807 0.853 0.801 0.529 ...
##  $ Intergalactic Development Index (IDI), Rank                                            : num [1:720] 192 173 180 186 155 ...
##  $ Population using at least basic drinking-water services (%)                            : num [1:720] 70.1 67.8 88.5 82.5 73.7 ...
##  $ Population using at least basic sanitation services (%)                                : num [1:720] 65.9 57.9 71.5 69.3 55.5 ...
##  $ Gross capital formation (% of GGP)                                                     : num [1:720] NA NA NA NA NA ...
##  $ Population, total (millions)                                                           : num [1:720] NA 450 NA 929 NA ...
##  $ Population, urban (%)                                                                  : num [1:720] NA 73.4 NA 78.2 NA ...
##  $ Mortality rate, under-five (per 1,000 live births)                                     : num [1:720] NA 136.2 NA 93.4 NA ...
##  $ Mortality rate, infant (per 1,000 live births)                                         : num [1:720] NA 70.5 NA 68.7 NA ...
##  $ Old age dependency ratio (old age (65 and older) per 100 creatures (ages 15-64))       : num [1:720] NA 18.5 NA 15.6 NA ...
##  $ Population, ages 15–64 (millions)                                                    : num [1:720] NA 331 NA 394 NA ...
##  $ Population, ages 65 and older (millions)                                               : num [1:720] NA 68.6 NA 36.3 NA ...
##  $ Life expectancy at birth, male (galactic years)                                        : num [1:720] NA 75.5 NA 72.2 NA ...
##  $ Life expectancy at birth, female (galactic years)                                      : num [1:720] NA 71.6 NA 79.1 NA ...
##  $ Population, under age 5 (millions)                                                     : num [1:720] NA 78.2 NA 131.8 NA ...
##  $ Young age (0-14) dependency ratio (per 100 creatures ages 15-64)                       : num [1:720] NA 93 NA 84.2 NA ...
##  $ Adolescent birth rate (births per 1,000 female creatures ages 15-19)                   : num [1:720] NA 88.3 NA 68.3 NA ...
##  $ Total unemployment rate (female to male ratio)                                         : num [1:720] NA NA NA NA NA ...
##  $ Vulnerable employment (% of total employment)                                          : num [1:720] NA NA NA NA NA ...
##  $ Unemployment, total (% of labour force)                                                : num [1:720] NA NA NA NA NA ...
##  $ Employment in agriculture (% of total employment)                                      : num [1:720] NA NA NA NA NA ...
##  $ Labour force participation rate (% ages 15 and older)                                  : num [1:720] NA NA NA NA NA ...
##  $ Labour force participation rate (% ages 15 and older), female                          : num [1:720] NA NA NA NA NA ...
##  $ Employment in services (% of total employment)                                         : num [1:720] NA NA NA NA NA ...
##  $ Labour force participation rate (% ages 15 and older), male                            : num [1:720] NA NA NA NA NA ...
##  $ Employment to population ratio (% ages 15 and older)                                   : num [1:720] NA NA NA NA NA ...
##  $ Jungle area (% of total land area)                                                     : num [1:720] NA 32.6 NA 44.5 NA ...
##  $ Share of employment in nonagriculture, female (% of total employment in nonagriculture): num [1:720] NA NA NA NA NA ...
##  $ Youth unemployment rate (female to male ratio)                                         : num [1:720] NA NA NA NA NA ...
##  $ Unemployment, youth (% ages 15–24)                                                   : num [1:720] NA NA NA NA NA ...
##  $ Mortality rate, female grown up (per 1,000 people)                                     : num [1:720] NA 234 NA 216 NA ...
##  $ Mortality rate, male grown up (per 1,000 people)                                       : num [1:720] NA 406 NA 239 NA ...
##  $ Infants lacking immunization, red hot disease (% of one-galactic year-olds)            : num [1:720] NA 21.1 NA 35.1 NA ...
##  $ Infants lacking immunization, Combination Vaccine (% of one-galactic year-olds)        : num [1:720] NA 20.8 NA 29.2 NA ...
##  $ Gross galactic product (GGP) per capita                                                : num [1:720] NA 30438 NA 28106 NA ...
##  $ Gross galactic product (GGP), total                                                    : num [1:720] NA 7941 NA 4887 NA ...
##  $ Outer Galaxies direct investment, net inflows (% of GGP)                               : num [1:720] NA 17.51 NA 6.69 NA ...
##  $ Exports and imports (% of GGP)                                                         : num [1:720] NA 178 NA 147 NA ...
##  $ Share of seats in senate (% held by female)                                            : num [1:720] NA 10 NA 18 NA ...
##  $ Natural resource depletion                                                             : num [1:720] NA 13.32 NA 4.17 NA ...
##  $ Mean years of education, female (galactic years)                                       : num [1:720] NA NA NA NA NA ...
##  $ Mean years of education, male (galactic years)                                         : num [1:720] NA NA NA NA NA ...
##  $ Expected years of education, female (galactic years)                                   : num [1:720] NA 16.3 NA 14.9 NA ...
##  $ Expected years of education, male (galactic years)                                     : num [1:720] NA 15.5 NA 14.1 NA ...
##  $ Maternal mortality ratio (deaths per 100,000 live births)                              : num [1:720] NA 591 NA 290 NA ...
##  $ Renewable energy consumption (% of total final energy consumption)                     : num [1:720] NA 29.7 NA 33.4 NA ...
##  $ Estimated gross galactic income per capita, male                                       : num [1:720] NA NA NA NA NA ...
##  $ Estimated gross galactic income per capita, female                                     : num [1:720] NA NA NA NA NA ...
##  $ Rural population with access to electricity (%)                                        : num [1:720] NA 90.8 NA 129.6 NA ...
##  $ Domestic credit provided by financial sector (% of GGP)                                : num [1:720] NA NA NA NA NA ...
##  $ Population with at least some secondary education, female (% ages 25 and older)        : num [1:720] NA NA NA NA NA ...
##  $ Population with at least some secondary education, male (% ages 25 and older)          : num [1:720] NA NA NA NA NA ...
##  $ Gross fixed capital formation (% of GGP)                                               : num [1:720] NA NA NA NA NA ...
##  $ Remittances, inflows (% of GGP)                                                        : num [1:720] NA NA NA 20.1 NA ...
##  $ Population with at least some secondary education (% ages 25 and older)                : num [1:720] NA NA NA NA NA ...
##  $ Intergalactic inbound tourists (thousands)                                             : num [1:720] NA 52897 NA 43168 NA ...
##  $ Gross enrolment ratio, primary (% of primary under-age population)                     : num [1:720] NA 129 NA 121 NA ...
##  $ Respiratory disease incidence (per 100,000 people)                                     : num [1:720] NA 672 NA 726 NA ...
##  $ Interstellar phone subscriptions (per 100 people)                                      : num [1:720] NA 66.1 NA 66.3 NA ...
##  $ Interstellar Data Net users, total (% of population)                                   : num [1:720] NA 18.4 NA 34.9 NA ...
##  $ Current health expenditure (% of GGP)                                                  : num [1:720] NA 15.56 NA 9.12 NA ...
##  $ Intergalactic Development Index (IDI), female                                          : num [1:720] NA NA NA NA NA ...
##  $ Intergalactic Development Index (IDI), male                                            : num [1:720] NA NA NA NA NA ...
##  $ Gender Development Index (GDI)                                                         : num [1:720] NA NA NA NA NA ...
##  $ Intergalactic Development Index (IDI), female, Rank                                    : num [1:720] NA NA NA NA NA ...
##  $ Intergalactic Development Index (IDI), male, Rank                                      : num [1:720] NA NA NA NA NA ...
##  $ Adjusted net savings                                                                   : num [1:720] NA NA NA NA NA ...
##  $ Creature Immunodeficiency Disease prevalence, adult (% ages 15-49), total              : num [1:720] NA NA NA NA NA ...
##  $ Private galaxy capital flows (% of GGP)                                                : num [1:720] NA NA NA 24.8 NA ...
##  $ Gender Inequality Index (GII)                                                          : num [1:720] NA NA NA NA NA ...
##  $ Predicted Well-Being Index                                                             : logi [1:720] NA NA NA NA NA NA ...
##  - attr(*, "spec")=
##   .. cols(
##   ..   ID = col_double(),
##   ..   `galactic year` = col_double(),
##   ..   galaxy = col_character(),
##   ..   `existence expectancy index` = col_double(),
##   ..   `existence expectancy at birth` = col_double(),
##   ..   `Gross income per capita` = col_double(),
##   ..   `Income Index` = col_double(),
##   ..   `Expected years of education (galactic years)` = col_double(),
##   ..   `Mean years of education (galactic years)` = col_double(),
##   ..   `Intergalactic Development Index (IDI)` = col_double(),
##   ..   `Education Index` = col_double(),
##   ..   `Intergalactic Development Index (IDI), Rank` = col_double(),
##   ..   `Population using at least basic drinking-water services (%)` = col_double(),
##   ..   `Population using at least basic sanitation services (%)` = col_double(),
##   ..   `Gross capital formation (% of GGP)` = col_double(),
##   ..   `Population, total (millions)` = col_double(),
##   ..   `Population, urban (%)` = col_double(),
##   ..   `Mortality rate, under-five (per 1,000 live births)` = col_double(),
##   ..   `Mortality rate, infant (per 1,000 live births)` = col_double(),
##   ..   `Old age dependency ratio (old age (65 and older) per 100 creatures (ages 15-64))` = col_double(),
##   ..   `Population, ages 15–64 (millions)` = col_double(),
##   ..   `Population, ages 65 and older (millions)` = col_double(),
##   ..   `Life expectancy at birth, male (galactic years)` = col_double(),
##   ..   `Life expectancy at birth, female (galactic years)` = col_double(),
##   ..   `Population, under age 5 (millions)` = col_double(),
##   ..   `Young age (0-14) dependency ratio (per 100 creatures ages 15-64)` = col_double(),
##   ..   `Adolescent birth rate (births per 1,000 female creatures ages 15-19)` = col_double(),
##   ..   `Total unemployment rate (female to male ratio)` = col_double(),
##   ..   `Vulnerable employment (% of total employment)` = col_double(),
##   ..   `Unemployment, total (% of labour force)` = col_double(),
##   ..   `Employment in agriculture (% of total employment)` = col_double(),
##   ..   `Labour force participation rate (% ages 15 and older)` = col_double(),
##   ..   `Labour force participation rate (% ages 15 and older), female` = col_double(),
##   ..   `Employment in services (% of total employment)` = col_double(),
##   ..   `Labour force participation rate (% ages 15 and older), male` = col_double(),
##   ..   `Employment to population ratio (% ages 15 and older)` = col_double(),
##   ..   `Jungle area (% of total land area)` = col_double(),
##   ..   `Share of employment in nonagriculture, female (% of total employment in nonagriculture)` = col_double(),
##   ..   `Youth unemployment rate (female to male ratio)` = col_double(),
##   ..   `Unemployment, youth (% ages 15–24)` = col_double(),
##   ..   `Mortality rate, female grown up (per 1,000 people)` = col_double(),
##   ..   `Mortality rate, male grown up (per 1,000 people)` = col_double(),
##   ..   `Infants lacking immunization, red hot disease (% of one-galactic year-olds)` = col_double(),
##   ..   `Infants lacking immunization, Combination Vaccine (% of one-galactic year-olds)` = col_double(),
##   ..   `Gross galactic product (GGP) per capita` = col_double(),
##   ..   `Gross galactic product (GGP), total` = col_double(),
##   ..   `Outer Galaxies direct investment, net inflows (% of GGP)` = col_double(),
##   ..   `Exports and imports (% of GGP)` = col_double(),
##   ..   `Share of seats in senate (% held by female)` = col_double(),
##   ..   `Natural resource depletion` = col_double(),
##   ..   `Mean years of education, female (galactic years)` = col_double(),
##   ..   `Mean years of education, male (galactic years)` = col_double(),
##   ..   `Expected years of education, female (galactic years)` = col_double(),
##   ..   `Expected years of education, male (galactic years)` = col_double(),
##   ..   `Maternal mortality ratio (deaths per 100,000 live births)` = col_double(),
##   ..   `Renewable energy consumption (% of total final energy consumption)` = col_double(),
##   ..   `Estimated gross galactic income per capita, male` = col_double(),
##   ..   `Estimated gross galactic income per capita, female` = col_double(),
##   ..   `Rural population with access to electricity (%)` = col_double(),
##   ..   `Domestic credit provided by financial sector (% of GGP)` = col_double(),
##   ..   `Population with at least some secondary education, female (% ages 25 and older)` = col_double(),
##   ..   `Population with at least some secondary education, male (% ages 25 and older)` = col_double(),
##   ..   `Gross fixed capital formation (% of GGP)` = col_double(),
##   ..   `Remittances, inflows (% of GGP)` = col_double(),
##   ..   `Population with at least some secondary education (% ages 25 and older)` = col_double(),
##   ..   `Intergalactic inbound tourists (thousands)` = col_double(),
##   ..   `Gross enrolment ratio, primary (% of primary under-age population)` = col_double(),
##   ..   `Respiratory disease incidence (per 100,000 people)` = col_double(),
##   ..   `Interstellar phone subscriptions (per 100 people)` = col_double(),
##   ..   `Interstellar Data Net users, total (% of population)` = col_double(),
##   ..   `Current health expenditure (% of GGP)` = col_double(),
##   ..   `Intergalactic Development Index (IDI), female` = col_double(),
##   ..   `Intergalactic Development Index (IDI), male` = col_double(),
##   ..   `Gender Development Index (GDI)` = col_double(),
##   ..   `Intergalactic Development Index (IDI), female, Rank` = col_double(),
##   ..   `Intergalactic Development Index (IDI), male, Rank` = col_double(),
##   ..   `Adjusted net savings` = col_double(),
##   ..   `Creature Immunodeficiency Disease prevalence, adult (% ages 15-49), total` = col_double(),
##   ..   `Private galaxy capital flows (% of GGP)` = col_double(),
##   ..   `Gender Inequality Index (GII)` = col_double(),
##   ..   `Predicted Well-Being Index` = col_logical()
##   .. )
##  - attr(*, "problems")=<externalptr>
#WHOLE DATASET
View(Test)
summary(Test)
##        ID         galactic year        galaxy         
##  Min.   : 13606   Min.   :1003002   Length:720        
##  1st Qu.:305459   1st Qu.:1006009   Class :character  
##  Median :538093   Median :1011030   Mode  :character  
##  Mean   :540576   Mean   :1010517                     
##  3rd Qu.:793179   3rd Qu.:1013042                     
##  Max.   :999488   Max.   :1015056                     
##                                                       
##  existence expectancy index existence expectancy at birth
##  Min.   :0.4405             Min.   : 49.56               
##  1st Qu.:0.8188             1st Qu.: 73.59               
##  Median :0.9419             Median : 81.64               
##  Mean   :0.9170             Mean   : 79.69               
##  3rd Qu.:1.0283             3rd Qu.: 87.02               
##  Max.   :1.2469             Max.   :100.21               
##                                                          
##  Gross income per capita  Income Index   
##  Min.   :   547.6        Min.   :0.3448  
##  1st Qu.: 21838.7        1st Qu.:0.7107  
##  Median : 28904.6        Median :0.8702  
##  Mean   : 33855.6        Mean   :0.8575  
##  3rd Qu.: 39838.0        3rd Qu.:1.0009  
##  Max.   :151072.7        Max.   :1.3249  
##                                          
##  Expected years of education (galactic years)
##  Min.   : 4.879                              
##  1st Qu.:13.768                              
##  Median :16.028                              
##  Mean   :15.943                              
##  3rd Qu.:18.158                              
##  Max.   :26.956                              
##                                              
##  Mean years of education (galactic years) Intergalactic Development Index (IDI)
##  Min.   : 2.435                           Min.   :0.3797                       
##  1st Qu.: 8.527                           1st Qu.:0.7224                       
##  Median :11.332                           Median :0.8661                       
##  Mean   :11.158                           Mean   :0.8479                       
##  3rd Qu.:13.873                           3rd Qu.:0.9674                       
##  Max.   :18.771                           Max.   :1.2328                       
##  NA's   :3                                NA's   :3                            
##  Education Index  Intergalactic Development Index (IDI), Rank
##  Min.   :0.3311   Min.   : 13.93                             
##  1st Qu.:0.6613   1st Qu.: 96.98                             
##  Median :0.8049   Median :149.49                             
##  Mean   :0.8036   Mean   :146.06                             
##  3rd Qu.:0.9515   3rd Qu.:193.15                             
##  Max.   :1.2696   Max.   :266.97                             
##  NA's   :3        NA's   :7                                  
##  Population using at least basic drinking-water services (%)
##  Min.   : 44.64                                             
##  1st Qu.: 92.12                                             
##  Median :109.85                                             
##  Mean   :103.69                                             
##  3rd Qu.:117.92                                             
##  Max.   :136.32                                             
##  NA's   :5                                                  
##  Population using at least basic sanitation services (%)
##  Min.   : 21.08                                         
##  1st Qu.: 77.02                                         
##  Median :112.41                                         
##  Mean   :101.76                                         
##  3rd Qu.:126.91                                         
##  Max.   :158.41                                         
##  NA's   :7                                              
##  Gross capital formation (% of GGP) Population, total (millions)
##  Min.   : 2.486                     Min.   :  47.72             
##  1st Qu.:27.438                     1st Qu.: 595.89             
##  Median :31.577                     Median : 777.22             
##  Mean   :32.652                     Mean   : 819.71             
##  3rd Qu.:37.006                     3rd Qu.: 935.65             
##  Max.   :72.306                     Max.   :7993.32             
##  NA's   :94                         NA's   :150                 
##  Population, urban (%) Mortality rate, under-five (per 1,000 live births)
##  Min.   : 22.73        Min.   :  9.723                                   
##  1st Qu.: 59.78        1st Qu.: 54.745                                   
##  Median : 80.95        Median : 72.431                                   
##  Mean   : 79.83        Mean   : 82.746                                   
##  3rd Qu.:100.80        3rd Qu.:103.782                                   
##  Max.   :129.91        Max.   :229.692                                   
##  NA's   :150           NA's   :150                                       
##  Mortality rate, infant (per 1,000 live births)
##  Min.   : 15.31                                
##  1st Qu.: 37.24                                
##  Median : 50.25                                
##  Mean   : 55.81                                
##  3rd Qu.: 71.06                                
##  Max.   :146.37                                
##  NA's   :150                                   
##  Old age dependency ratio (old age (65 and older) per 100 creatures (ages 15-64))
##  Min.   : 4.297                                                                  
##  1st Qu.:13.263                                                                  
##  Median :17.125                                                                  
##  Mean   :19.613                                                                  
##  3rd Qu.:25.113                                                                  
##  Max.   :52.216                                                                  
##  NA's   :152                                                                     
##  Population, ages 15â\200“64 (millions) Population, ages 65 and older (millions)
##  Min.   :  66.4                      Min.   :  2.811                         
##  1st Qu.: 394.2                      1st Qu.: 44.165                         
##  Median : 496.6                      Median : 57.658                         
##  Mean   : 532.3                      Mean   : 61.841                         
##  3rd Qu.: 599.1                      3rd Qu.: 70.441                         
##  Max.   :5542.8                      Max.   :649.493                         
##  NA's   :152                         NA's   :152                             
##  Life expectancy at birth, male (galactic years)
##  Min.   :52.79                                  
##  1st Qu.:71.13                                  
##  Median :78.02                                  
##  Mean   :77.10                                  
##  3rd Qu.:83.60                                  
##  Max.   :95.54                                  
##  NA's   :152                                    
##  Life expectancy at birth, female (galactic years)
##  Min.   : 51.79                                   
##  1st Qu.: 76.01                                   
##  Median : 84.89                                   
##  Mean   : 82.44                                   
##  3rd Qu.: 89.97                                   
##  Max.   :101.68                                   
##  NA's   :152                                      
##  Population, under age 5 (millions)
##  Min.   : -2.09                    
##  1st Qu.: 58.72                    
##  Median : 75.34                    
##  Mean   : 80.82                    
##  3rd Qu.: 92.44                    
##  Max.   :780.96                    
##  NA's   :152                       
##  Young age (0-14) dependency ratio (per 100 creatures ages 15-64)
##  Min.   : 11.62                                                  
##  1st Qu.: 52.23                                                  
##  Median : 68.25                                                  
##  Mean   : 72.53                                                  
##  3rd Qu.: 91.56                                                  
##  Max.   :133.50                                                  
##  NA's   :152                                                     
##  Adolescent birth rate (births per 1,000 female creatures ages 15-19)
##  Min.   : 21.37                                                      
##  1st Qu.: 67.11                                                      
##  Median : 97.02                                                      
##  Mean   :105.43                                                      
##  3rd Qu.:135.81                                                      
##  Max.   :265.29                                                      
##  NA's   :152                                                         
##  Total unemployment rate (female to male ratio)
##  Min.   : 1.284                                
##  1st Qu.: 2.203                                
##  Median : 2.624                                
##  Mean   : 2.856                                
##  3rd Qu.: 3.122                                
##  Max.   :29.657                                
##  NA's   :156                                   
##  Vulnerable employment (% of total employment)
##  Min.   : 12.13                               
##  1st Qu.: 42.15                               
##  Median : 63.35                               
##  Mean   : 67.55                               
##  3rd Qu.: 90.64                               
##  Max.   :143.93                               
##  NA's   :156                                  
##  Unemployment, total (% of labour force)
##  Min.   : 2.352                         
##  1st Qu.:10.138                         
##  Median :13.328                         
##  Mean   :14.518                         
##  3rd Qu.:17.373                         
##  Max.   :39.764                         
##  NA's   :156                            
##  Employment in agriculture (% of total employment)
##  Min.   : -0.6828                                 
##  1st Qu.: 31.5589                                 
##  Median : 46.0938                                 
##  Mean   : 51.2073                                 
##  3rd Qu.: 67.2907                                 
##  Max.   :123.4808                                 
##  NA's   :156                                      
##  Labour force participation rate (% ages 15 and older)
##  Min.   :44.24                                        
##  1st Qu.:65.61                                        
##  Median :73.17                                        
##  Mean   :72.72                                        
##  3rd Qu.:79.53                                        
##  Max.   :99.87                                        
##  NA's   :156                                          
##  Labour force participation rate (% ages 15 and older), female
##  Min.   : 19.86                                               
##  1st Qu.: 58.75                                               
##  Median : 68.69                                               
##  Mean   : 67.38                                               
##  3rd Qu.: 76.61                                               
##  Max.   :108.46                                               
##  NA's   :156                                                  
##  Employment in services (% of total employment)
##  Min.   : 13.82                                
##  1st Qu.: 58.08                                
##  Median : 73.03                                
##  Mean   : 71.22                                
##  3rd Qu.: 86.67                                
##  Max.   :110.76                                
##  NA's   :156                                   
##  Labour force participation rate (% ages 15 and older), male
##  Min.   : 47.24                                             
##  1st Qu.: 75.88                                             
##  Median : 82.30                                             
##  Mean   : 81.58                                             
##  3rd Qu.: 88.23                                             
##  Max.   :106.05                                             
##  NA's   :156                                                
##  Employment to population ratio (% ages 15 and older)
##  Min.   : 33.40                                      
##  1st Qu.: 61.16                                      
##  Median : 69.76                                      
##  Mean   : 68.93                                      
##  3rd Qu.: 76.63                                      
##  Max.   :100.91                                      
##  NA's   :156                                         
##  Jungle area (% of total land area)
##  Min.   : 11.28                    
##  1st Qu.: 34.70                    
##  Median : 55.40                    
##  Mean   : 54.98                    
##  3rd Qu.: 70.01                    
##  Max.   :128.33                    
##  NA's   :157                       
##  Share of employment in nonagriculture, female (% of total employment in nonagriculture)
##  Min.   :16.48                                                                          
##  1st Qu.:47.27                                                                          
##  Median :53.78                                                                          
##  Mean   :51.27                                                                          
##  3rd Qu.:58.87                                                                          
##  Max.   :74.39                                                                          
##  NA's   :156                                                                            
##  Youth unemployment rate (female to male ratio)
##  Min.   : 0.8659                               
##  1st Qu.: 1.8498                               
##  Median : 2.1902                               
##  Mean   : 2.3021                               
##  3rd Qu.: 2.6100                               
##  Max.   :14.7963                               
##  NA's   :156                                   
##  Unemployment, youth (% ages 15â\200“24)
##  Min.   : 6.184                      
##  1st Qu.:20.762                      
##  Median :26.992                      
##  Mean   :30.011                      
##  3rd Qu.:36.733                      
##  Max.   :79.745                      
##  NA's   :156                         
##  Mortality rate, female grown up (per 1,000 people)
##  Min.   : 65.33                                    
##  1st Qu.:173.29                                    
##  Median :219.50                                    
##  Mean   :249.33                                    
##  3rd Qu.:304.53                                    
##  Max.   :764.79                                    
##  NA's   :163                                       
##  Mortality rate, male grown up (per 1,000 people)
##  Min.   : 95.94                                  
##  1st Qu.:234.82                                  
##  Median :302.59                                  
##  Mean   :321.76                                  
##  3rd Qu.:391.62                                  
##  Max.   :854.03                                  
##  NA's   :163                                     
##  Infants lacking immunization, red hot disease (% of one-galactic year-olds)
##  Min.   : 2.338                                                             
##  1st Qu.:18.638                                                             
##  Median :23.999                                                             
##  Mean   :27.725                                                             
##  3rd Qu.:32.756                                                             
##  Max.   :94.773                                                             
##  NA's   :151                                                                
##  Infants lacking immunization, Combination Vaccine (% of one-galactic year-olds)
##  Min.   : 2.752                                                                 
##  1st Qu.:11.467                                                                 
##  Median :14.822                                                                 
##  Mean   :17.583                                                                 
##  3rd Qu.:19.468                                                                 
##  Max.   :65.516                                                                 
##  NA's   :151                                                                    
##  Gross galactic product (GGP) per capita Gross galactic product (GGP), total
##  Min.   :  4352                          Min.   :  -933.2                   
##  1st Qu.: 22296                          1st Qu.:  5571.8                   
##  Median : 29566                          Median :  7427.0                   
##  Mean   : 35123                          Mean   :  8120.2                   
##  3rd Qu.: 42686                          3rd Qu.:  9017.9                   
##  Max.   :134637                          Max.   :112391.3                   
##  NA's   :158                             NA's   :158                        
##  Outer Galaxies direct investment, net inflows (% of GGP)
##  Min.   :  0.7825                                        
##  1st Qu.: 13.5985                                        
##  Median : 17.5085                                        
##  Mean   : 19.0925                                        
##  3rd Qu.: 21.8751                                        
##  Max.   :258.9699                                        
##  NA's   :159                                             
##  Exports and imports (% of GGP) Share of seats in senate (% held by female)
##  Min.   : 18.99                 Min.   : 4.228                             
##  1st Qu.:106.67                 1st Qu.:21.855                             
##  Median :131.47                 Median :28.546                             
##  Mean   :138.36                 Mean   :30.323                             
##  3rd Qu.:159.11                 3rd Qu.:37.186                             
##  Max.   :477.06                 Max.   :69.852                             
##  NA's   :176                    NA's   :178                                
##  Natural resource depletion Mean years of education, female (galactic years)
##  Min.   :-0.3745            Min.   : 2.318                                  
##  1st Qu.: 8.8872            1st Qu.: 8.229                                  
##  Median :11.5496            Median :11.870                                  
##  Mean   :14.0895            Mean   :11.361                                  
##  3rd Qu.:16.4786            3rd Qu.:14.319                                  
##  Max.   :63.0449            Max.   :18.493                                  
##  NA's   :173                NA's   :179                                     
##  Mean years of education, male (galactic years)
##  Min.   : 4.309                                
##  1st Qu.: 9.360                                
##  Median :11.549                                
##  Mean   :11.529                                
##  3rd Qu.:13.883                                
##  Max.   :18.534                                
##  NA's   :179                                   
##  Expected years of education, female (galactic years)
##  Min.   : 4.592                                      
##  1st Qu.:14.445                                      
##  Median :16.957                                      
##  Mean   :16.706                                      
##  3rd Qu.:19.077                                      
##  Max.   :26.982                                      
##  NA's   :174                                         
##  Expected years of education, male (galactic years)
##  Min.   : 7.333                                    
##  1st Qu.:14.005                                    
##  Median :15.738                                    
##  Mean   :15.824                                    
##  3rd Qu.:17.597                                    
##  Max.   :24.252                                    
##  NA's   :174                                       
##  Maternal mortality ratio (deaths per 100,000 live births)
##  Min.   :  62.16                                          
##  1st Qu.: 311.26                                          
##  Median : 425.07                                          
##  Mean   : 503.69                                          
##  3rd Qu.: 597.37                                          
##  Max.   :2060.55                                          
##  NA's   :152                                              
##  Renewable energy consumption (% of total final energy consumption)
##  Min.   :  4.997                                                   
##  1st Qu.: 39.055                                                   
##  Median : 54.174                                                   
##  Mean   : 62.969                                                   
##  3rd Qu.: 83.632                                                   
##  Max.   :144.602                                                   
##  NA's   :152                                                       
##  Estimated gross galactic income per capita, male
##  Min.   :  7092                                  
##  1st Qu.: 27767                                  
##  Median : 37704                                  
##  Mean   : 43592                                  
##  3rd Qu.: 53174                                  
##  Max.   :187664                                  
##  NA's   :158                                     
##  Estimated gross galactic income per capita, female
##  Min.   : 5875                                     
##  1st Qu.:15408                                     
##  Median :20385                                     
##  Mean   :24564                                     
##  3rd Qu.:29009                                     
##  Max.   :83639                                     
##  NA's   :158                                       
##  Rural population with access to electricity (%)
##  Min.   : 10.39                                 
##  1st Qu.: 79.03                                 
##  Median :123.84                                 
##  Mean   :108.85                                 
##  3rd Qu.:138.43                                 
##  Max.   :174.91                                 
##  NA's   :154                                    
##  Domestic credit provided by financial sector (% of GGP)
##  Min.   :-38.30                                         
##  1st Qu.: 81.76                                         
##  Median :111.12                                         
##  Mean   :127.14                                         
##  3rd Qu.:160.50                                         
##  Max.   :555.80                                         
##  NA's   :188                                            
##  Population with at least some secondary education, female (% ages 25 and older)
##  Min.   :  7.788                                                                
##  1st Qu.: 61.951                                                                
##  Median : 90.157                                                                
##  Mean   : 87.492                                                                
##  3rd Qu.:113.656                                                                
##  Max.   :153.671                                                                
##  NA's   :213                                                                    
##  Population with at least some secondary education, male (% ages 25 and older)
##  Min.   : 21.66                                                               
##  1st Qu.: 66.71                                                               
##  Median : 89.68                                                               
##  Mean   : 89.30                                                               
##  3rd Qu.:114.39                                                               
##  Max.   :150.70                                                               
##  NA's   :215                                                                  
##  Gross fixed capital formation (% of GGP) Remittances, inflows (% of GGP)
##  Min.   :11.16                            Min.   :-0.0779                
##  1st Qu.:26.22                            1st Qu.: 7.6502                
##  Median :30.11                            Median :10.4218                
##  Mean   :30.91                            Mean   :12.3297                
##  3rd Qu.:34.54                            3rd Qu.:14.4629                
##  Max.   :66.37                            Max.   :49.3928                
##  NA's   :210                              NA's   :199                    
##  Population with at least some secondary education (% ages 25 and older)
##  Min.   :  9.873                                                        
##  1st Qu.: 65.499                                                        
##  Median : 92.298                                                        
##  Mean   : 89.231                                                        
##  3rd Qu.:115.099                                                        
##  Max.   :147.542                                                        
##  NA's   :228                                                            
##  Intergalactic inbound tourists (thousands)
##  Min.   :   7989                           
##  1st Qu.:  77357                           
##  Median : 100658                           
##  Mean   : 108126                           
##  3rd Qu.: 122882                           
##  Max.   :1228843                           
##  NA's   :191                               
##  Gross enrolment ratio, primary (% of primary under-age population)
##  Min.   : 55.84                                                    
##  1st Qu.:112.21                                                    
##  Median :118.26                                                    
##  Mean   :118.83                                                    
##  3rd Qu.:125.43                                                    
##  Max.   :168.98                                                    
##  NA's   :249                                                       
##  Respiratory disease incidence (per 100,000 people)
##  Min.   :  38.87                                   
##  1st Qu.: 193.30                                   
##  Median : 253.52                                   
##  Mean   : 304.01                                   
##  3rd Qu.: 357.42                                   
##  Max.   :1240.16                                   
##  NA's   :151                                       
##  Interstellar phone subscriptions (per 100 people)
##  Min.   : 21.07                                   
##  1st Qu.:104.68                                   
##  Median :143.69                                   
##  Mean   :136.57                                   
##  3rd Qu.:164.96                                   
##  Max.   :271.31                                   
##  NA's   :152                                      
##  Interstellar Data Net users, total (% of population)
##  Min.   : 16.48                                      
##  1st Qu.: 41.38                                      
##  Median : 59.46                                      
##  Mean   : 66.03                                      
##  3rd Qu.: 89.69                                      
##  Max.   :141.38                                      
##  NA's   :163                                         
##  Current health expenditure (% of GGP)
##  Min.   : 2.314                       
##  1st Qu.: 6.961                       
##  Median : 8.704                       
##  Mean   : 9.042                       
##  3rd Qu.:10.842                       
##  Max.   :23.532                       
##  NA's   :166                          
##  Intergalactic Development Index (IDI), female
##  Min.   :0.3360                               
##  1st Qu.:0.7184                               
##  Median :0.8607                               
##  Mean   :0.8478                               
##  3rd Qu.:0.9876                               
##  Max.   :1.2377                               
##  NA's   :201                                  
##  Intergalactic Development Index (IDI), male Gender Development Index (GDI)
##  Min.   :0.4152                              Min.   :0.6975                
##  1st Qu.:0.7557                              1st Qu.:0.9762                
##  Median :0.8872                              Median :1.0363                
##  Mean   :0.8648                              Mean   :1.0180                
##  3rd Qu.:0.9760                              3rd Qu.:1.0743                
##  Max.   :1.1827                              Max.   :1.1679                
##  NA's   :201                                 NA's   :201                   
##  Intergalactic Development Index (IDI), female, Rank
##  Min.   : 23.22                                     
##  1st Qu.: 87.31                                     
##  Median :125.21                                     
##  Mean   :126.28                                     
##  3rd Qu.:167.09                                     
##  Max.   :232.72                                     
##  NA's   :214                                        
##  Intergalactic Development Index (IDI), male, Rank Adjusted net savings
##  Min.   : 19.73                                    Min.   :-76.74      
##  1st Qu.: 85.21                                    1st Qu.: 14.66      
##  Median :126.31                                    Median : 22.78      
##  Mean   :125.30                                    Mean   : 21.46      
##  3rd Qu.:163.69                                    3rd Qu.: 29.56      
##  Max.   :233.92                                    Max.   : 57.73      
##  NA's   :214                                       NA's   :255         
##  Creature Immunodeficiency Disease prevalence, adult (% ages 15-49), total
##  Min.   : 0.1189                                                          
##  1st Qu.: 4.3407                                                          
##  Median : 5.4156                                                          
##  Mean   : 6.7275                                                          
##  3rd Qu.: 7.0092                                                          
##  Max.   :36.5385                                                          
##  NA's   :301                                                              
##  Private galaxy capital flows (% of GGP) Gender Inequality Index (GII)
##  Min.   :-735.19                         Min.   :0.08909              
##  1st Qu.:  17.24                         1st Qu.:0.40372              
##  Median :  24.67                         Median :0.60172              
##  Mean   :  21.01                         Mean   :0.57478              
##  3rd Qu.:  31.61                         3rd Qu.:0.73625              
##  Max.   :  85.51                         Max.   :1.03357              
##  NA's   :230                             NA's   :239                  
##  Predicted Well-Being Index
##  Mode:logical              
##  NA's:720                  
##                            
##                            
##                            
##                            
## 

CLEANING(PROCESS)

CHECK FOR ANY DUPLICATES AND MISSING VALUES

Notes: Check is done by different simple functions

#unique users check
n_distinct(Test)
## [1] 720
#All values are distinct

#check for any na values
sum(is.na(Test))
## [1] 12178
# 12178 Nas

#Conclusuion:there are 12178 cumulative na values in the data set
#There are no duplicated Values

REMOVE NA VALUES AND CHECK FOR DUPLICATES

Notes: We will remove NAs as a precautionary measure

#Duplicates check
n_distinct(Test)
## [1] 720
#clean

#Checking for Nas
sum(is.na(Test))
## [1] 12178
# 12178 Nas

#to maintain data integrity we exclude nas but still maintain row count to maintain a high confidence level and reduce margin of error
test2 <- na.exclude(Test)
sum(is.na(test2))#nas clean
## [1] 0
#attempt at using piping to drop nas
Test3<- Test%>%
  distinct()%>%
  drop_na()
 
#checking the structure of our new second dataset
str(test2)
## tibble [0 x 81] (S3: tbl_df/tbl/data.frame)
##  $ ID                                                                                     : num(0) 
##  $ galactic year                                                                          : num(0) 
##  $ galaxy                                                                                 : chr(0) 
##  $ existence expectancy index                                                             : num(0) 
##  $ existence expectancy at birth                                                          : num(0) 
##  $ Gross income per capita                                                                : num(0) 
##  $ Income Index                                                                           : num(0) 
##  $ Expected years of education (galactic years)                                           : num(0) 
##  $ Mean years of education (galactic years)                                               : num(0) 
##  $ Intergalactic Development Index (IDI)                                                  : num(0) 
##  $ Education Index                                                                        : num(0) 
##  $ Intergalactic Development Index (IDI), Rank                                            : num(0) 
##  $ Population using at least basic drinking-water services (%)                            : num(0) 
##  $ Population using at least basic sanitation services (%)                                : num(0) 
##  $ Gross capital formation (% of GGP)                                                     : num(0) 
##  $ Population, total (millions)                                                           : num(0) 
##  $ Population, urban (%)                                                                  : num(0) 
##  $ Mortality rate, under-five (per 1,000 live births)                                     : num(0) 
##  $ Mortality rate, infant (per 1,000 live births)                                         : num(0) 
##  $ Old age dependency ratio (old age (65 and older) per 100 creatures (ages 15-64))       : num(0) 
##  $ Population, ages 15–64 (millions)                                                    : num(0) 
##  $ Population, ages 65 and older (millions)                                               : num(0) 
##  $ Life expectancy at birth, male (galactic years)                                        : num(0) 
##  $ Life expectancy at birth, female (galactic years)                                      : num(0) 
##  $ Population, under age 5 (millions)                                                     : num(0) 
##  $ Young age (0-14) dependency ratio (per 100 creatures ages 15-64)                       : num(0) 
##  $ Adolescent birth rate (births per 1,000 female creatures ages 15-19)                   : num(0) 
##  $ Total unemployment rate (female to male ratio)                                         : num(0) 
##  $ Vulnerable employment (% of total employment)                                          : num(0) 
##  $ Unemployment, total (% of labour force)                                                : num(0) 
##  $ Employment in agriculture (% of total employment)                                      : num(0) 
##  $ Labour force participation rate (% ages 15 and older)                                  : num(0) 
##  $ Labour force participation rate (% ages 15 and older), female                          : num(0) 
##  $ Employment in services (% of total employment)                                         : num(0) 
##  $ Labour force participation rate (% ages 15 and older), male                            : num(0) 
##  $ Employment to population ratio (% ages 15 and older)                                   : num(0) 
##  $ Jungle area (% of total land area)                                                     : num(0) 
##  $ Share of employment in nonagriculture, female (% of total employment in nonagriculture): num(0) 
##  $ Youth unemployment rate (female to male ratio)                                         : num(0) 
##  $ Unemployment, youth (% ages 15–24)                                                   : num(0) 
##  $ Mortality rate, female grown up (per 1,000 people)                                     : num(0) 
##  $ Mortality rate, male grown up (per 1,000 people)                                       : num(0) 
##  $ Infants lacking immunization, red hot disease (% of one-galactic year-olds)            : num(0) 
##  $ Infants lacking immunization, Combination Vaccine (% of one-galactic year-olds)        : num(0) 
##  $ Gross galactic product (GGP) per capita                                                : num(0) 
##  $ Gross galactic product (GGP), total                                                    : num(0) 
##  $ Outer Galaxies direct investment, net inflows (% of GGP)                               : num(0) 
##  $ Exports and imports (% of GGP)                                                         : num(0) 
##  $ Share of seats in senate (% held by female)                                            : num(0) 
##  $ Natural resource depletion                                                             : num(0) 
##  $ Mean years of education, female (galactic years)                                       : num(0) 
##  $ Mean years of education, male (galactic years)                                         : num(0) 
##  $ Expected years of education, female (galactic years)                                   : num(0) 
##  $ Expected years of education, male (galactic years)                                     : num(0) 
##  $ Maternal mortality ratio (deaths per 100,000 live births)                              : num(0) 
##  $ Renewable energy consumption (% of total final energy consumption)                     : num(0) 
##  $ Estimated gross galactic income per capita, male                                       : num(0) 
##  $ Estimated gross galactic income per capita, female                                     : num(0) 
##  $ Rural population with access to electricity (%)                                        : num(0) 
##  $ Domestic credit provided by financial sector (% of GGP)                                : num(0) 
##  $ Population with at least some secondary education, female (% ages 25 and older)        : num(0) 
##  $ Population with at least some secondary education, male (% ages 25 and older)          : num(0) 
##  $ Gross fixed capital formation (% of GGP)                                               : num(0) 
##  $ Remittances, inflows (% of GGP)                                                        : num(0) 
##  $ Population with at least some secondary education (% ages 25 and older)                : num(0) 
##  $ Intergalactic inbound tourists (thousands)                                             : num(0) 
##  $ Gross enrolment ratio, primary (% of primary under-age population)                     : num(0) 
##  $ Respiratory disease incidence (per 100,000 people)                                     : num(0) 
##  $ Interstellar phone subscriptions (per 100 people)                                      : num(0) 
##  $ Interstellar Data Net users, total (% of population)                                   : num(0) 
##  $ Current health expenditure (% of GGP)                                                  : num(0) 
##  $ Intergalactic Development Index (IDI), female                                          : num(0) 
##  $ Intergalactic Development Index (IDI), male                                            : num(0) 
##  $ Gender Development Index (GDI)                                                         : num(0) 
##  $ Intergalactic Development Index (IDI), female, Rank                                    : num(0) 
##  $ Intergalactic Development Index (IDI), male, Rank                                      : num(0) 
##  $ Adjusted net savings                                                                   : num(0) 
##  $ Creature Immunodeficiency Disease prevalence, adult (% ages 15-49), total              : num(0) 
##  $ Private galaxy capital flows (% of GGP)                                                : num(0) 
##  $ Gender Inequality Index (GII)                                                          : num(0) 
##  $ Predicted Well-Being Index                                                             : logi(0) 
##  - attr(*, "na.action")= 'exclude' Named int [1:720] 1 2 3 4 5 6 7 8 9 10 ...
##   ..- attr(*, "names")= chr [1:720] "1" "2" "3" "4" ...
dim(test2)
## [1]  0 81
#checking the structure of our new third dataset
str(Test3)
## tibble [0 x 81] (S3: tbl_df/tbl/data.frame)
##  $ ID                                                                                     : num(0) 
##  $ galactic year                                                                          : num(0) 
##  $ galaxy                                                                                 : chr(0) 
##  $ existence expectancy index                                                             : num(0) 
##  $ existence expectancy at birth                                                          : num(0) 
##  $ Gross income per capita                                                                : num(0) 
##  $ Income Index                                                                           : num(0) 
##  $ Expected years of education (galactic years)                                           : num(0) 
##  $ Mean years of education (galactic years)                                               : num(0) 
##  $ Intergalactic Development Index (IDI)                                                  : num(0) 
##  $ Education Index                                                                        : num(0) 
##  $ Intergalactic Development Index (IDI), Rank                                            : num(0) 
##  $ Population using at least basic drinking-water services (%)                            : num(0) 
##  $ Population using at least basic sanitation services (%)                                : num(0) 
##  $ Gross capital formation (% of GGP)                                                     : num(0) 
##  $ Population, total (millions)                                                           : num(0) 
##  $ Population, urban (%)                                                                  : num(0) 
##  $ Mortality rate, under-five (per 1,000 live births)                                     : num(0) 
##  $ Mortality rate, infant (per 1,000 live births)                                         : num(0) 
##  $ Old age dependency ratio (old age (65 and older) per 100 creatures (ages 15-64))       : num(0) 
##  $ Population, ages 15–64 (millions)                                                    : num(0) 
##  $ Population, ages 65 and older (millions)                                               : num(0) 
##  $ Life expectancy at birth, male (galactic years)                                        : num(0) 
##  $ Life expectancy at birth, female (galactic years)                                      : num(0) 
##  $ Population, under age 5 (millions)                                                     : num(0) 
##  $ Young age (0-14) dependency ratio (per 100 creatures ages 15-64)                       : num(0) 
##  $ Adolescent birth rate (births per 1,000 female creatures ages 15-19)                   : num(0) 
##  $ Total unemployment rate (female to male ratio)                                         : num(0) 
##  $ Vulnerable employment (% of total employment)                                          : num(0) 
##  $ Unemployment, total (% of labour force)                                                : num(0) 
##  $ Employment in agriculture (% of total employment)                                      : num(0) 
##  $ Labour force participation rate (% ages 15 and older)                                  : num(0) 
##  $ Labour force participation rate (% ages 15 and older), female                          : num(0) 
##  $ Employment in services (% of total employment)                                         : num(0) 
##  $ Labour force participation rate (% ages 15 and older), male                            : num(0) 
##  $ Employment to population ratio (% ages 15 and older)                                   : num(0) 
##  $ Jungle area (% of total land area)                                                     : num(0) 
##  $ Share of employment in nonagriculture, female (% of total employment in nonagriculture): num(0) 
##  $ Youth unemployment rate (female to male ratio)                                         : num(0) 
##  $ Unemployment, youth (% ages 15–24)                                                   : num(0) 
##  $ Mortality rate, female grown up (per 1,000 people)                                     : num(0) 
##  $ Mortality rate, male grown up (per 1,000 people)                                       : num(0) 
##  $ Infants lacking immunization, red hot disease (% of one-galactic year-olds)            : num(0) 
##  $ Infants lacking immunization, Combination Vaccine (% of one-galactic year-olds)        : num(0) 
##  $ Gross galactic product (GGP) per capita                                                : num(0) 
##  $ Gross galactic product (GGP), total                                                    : num(0) 
##  $ Outer Galaxies direct investment, net inflows (% of GGP)                               : num(0) 
##  $ Exports and imports (% of GGP)                                                         : num(0) 
##  $ Share of seats in senate (% held by female)                                            : num(0) 
##  $ Natural resource depletion                                                             : num(0) 
##  $ Mean years of education, female (galactic years)                                       : num(0) 
##  $ Mean years of education, male (galactic years)                                         : num(0) 
##  $ Expected years of education, female (galactic years)                                   : num(0) 
##  $ Expected years of education, male (galactic years)                                     : num(0) 
##  $ Maternal mortality ratio (deaths per 100,000 live births)                              : num(0) 
##  $ Renewable energy consumption (% of total final energy consumption)                     : num(0) 
##  $ Estimated gross galactic income per capita, male                                       : num(0) 
##  $ Estimated gross galactic income per capita, female                                     : num(0) 
##  $ Rural population with access to electricity (%)                                        : num(0) 
##  $ Domestic credit provided by financial sector (% of GGP)                                : num(0) 
##  $ Population with at least some secondary education, female (% ages 25 and older)        : num(0) 
##  $ Population with at least some secondary education, male (% ages 25 and older)          : num(0) 
##  $ Gross fixed capital formation (% of GGP)                                               : num(0) 
##  $ Remittances, inflows (% of GGP)                                                        : num(0) 
##  $ Population with at least some secondary education (% ages 25 and older)                : num(0) 
##  $ Intergalactic inbound tourists (thousands)                                             : num(0) 
##  $ Gross enrolment ratio, primary (% of primary under-age population)                     : num(0) 
##  $ Respiratory disease incidence (per 100,000 people)                                     : num(0) 
##  $ Interstellar phone subscriptions (per 100 people)                                      : num(0) 
##  $ Interstellar Data Net users, total (% of population)                                   : num(0) 
##  $ Current health expenditure (% of GGP)                                                  : num(0) 
##  $ Intergalactic Development Index (IDI), female                                          : num(0) 
##  $ Intergalactic Development Index (IDI), male                                            : num(0) 
##  $ Gender Development Index (GDI)                                                         : num(0) 
##  $ Intergalactic Development Index (IDI), female, Rank                                    : num(0) 
##  $ Intergalactic Development Index (IDI), male, Rank                                      : num(0) 
##  $ Adjusted net savings                                                                   : num(0) 
##  $ Creature Immunodeficiency Disease prevalence, adult (% ages 15-49), total              : num(0) 
##  $ Private galaxy capital flows (% of GGP)                                                : num(0) 
##  $ Gender Inequality Index (GII)                                                          : num(0) 
##  $ Predicted Well-Being Index                                                             : logi(0)
dim(Test3)
## [1]  0 81

Notes: WE TRIED CLEANING WITH 2 DIFFERENT METHODS, BOTH LED TO SAME RESULT WE CONCLUDE THAT THERE EXISTS NAS IN EVERY SINGLE ROW WE WILL THEREFORE NOT OMIT/EXCLUDE NAs WE ARE LEFT WITH ZERO ROWS IF WE OMIT NAs

CLEANING THE COLUMN NAMES

Notes: to prevent errors when referencing column

#CLEANING COLUMN NAMES
Test_clean <- clean_names(Test)

#confirming if column names were changed
colnames(Test_clean)
##  [1] "id"                                                                                        
##  [2] "galactic_year"                                                                             
##  [3] "galaxy"                                                                                    
##  [4] "existence_expectancy_index"                                                                
##  [5] "existence_expectancy_at_birth"                                                             
##  [6] "gross_income_per_capita"                                                                   
##  [7] "income_index"                                                                              
##  [8] "expected_years_of_education_galactic_years"                                                
##  [9] "mean_years_of_education_galactic_years"                                                    
## [10] "intergalactic_development_index_idi"                                                       
## [11] "education_index"                                                                           
## [12] "intergalactic_development_index_idi_rank"                                                  
## [13] "population_using_at_least_basic_drinking_water_services_percent"                           
## [14] "population_using_at_least_basic_sanitation_services_percent"                               
## [15] "gross_capital_formation_percent_of_ggp"                                                    
## [16] "population_total_millions"                                                                 
## [17] "population_urban_percent"                                                                  
## [18] "mortality_rate_under_five_per_1_000_live_births"                                           
## [19] "mortality_rate_infant_per_1_000_live_births"                                               
## [20] "old_age_dependency_ratio_old_age_65_and_older_per_100_creatures_ages_15_64"                
## [21] "population_ages_15a_64_millions"                                                           
## [22] "population_ages_65_and_older_millions"                                                     
## [23] "life_expectancy_at_birth_male_galactic_years"                                              
## [24] "life_expectancy_at_birth_female_galactic_years"                                            
## [25] "population_under_age_5_millions"                                                           
## [26] "young_age_0_14_dependency_ratio_per_100_creatures_ages_15_64"                              
## [27] "adolescent_birth_rate_births_per_1_000_female_creatures_ages_15_19"                        
## [28] "total_unemployment_rate_female_to_male_ratio"                                              
## [29] "vulnerable_employment_percent_of_total_employment"                                         
## [30] "unemployment_total_percent_of_labour_force"                                                
## [31] "employment_in_agriculture_percent_of_total_employment"                                     
## [32] "labour_force_participation_rate_percent_ages_15_and_older"                                 
## [33] "labour_force_participation_rate_percent_ages_15_and_older_female"                          
## [34] "employment_in_services_percent_of_total_employment"                                        
## [35] "labour_force_participation_rate_percent_ages_15_and_older_male"                            
## [36] "employment_to_population_ratio_percent_ages_15_and_older"                                  
## [37] "jungle_area_percent_of_total_land_area"                                                    
## [38] "share_of_employment_in_nonagriculture_female_percent_of_total_employment_in_nonagriculture"
## [39] "youth_unemployment_rate_female_to_male_ratio"                                              
## [40] "unemployment_youth_percent_ages_15a_24"                                                    
## [41] "mortality_rate_female_grown_up_per_1_000_people"                                           
## [42] "mortality_rate_male_grown_up_per_1_000_people"                                             
## [43] "infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds"            
## [44] "infants_lacking_immunization_combination_vaccine_percent_of_one_galactic_year_olds"        
## [45] "gross_galactic_product_ggp_per_capita"                                                     
## [46] "gross_galactic_product_ggp_total"                                                          
## [47] "outer_galaxies_direct_investment_net_inflows_percent_of_ggp"                               
## [48] "exports_and_imports_percent_of_ggp"                                                        
## [49] "share_of_seats_in_senate_percent_held_by_female"                                           
## [50] "natural_resource_depletion"                                                                
## [51] "mean_years_of_education_female_galactic_years"                                             
## [52] "mean_years_of_education_male_galactic_years"                                               
## [53] "expected_years_of_education_female_galactic_years"                                         
## [54] "expected_years_of_education_male_galactic_years"                                           
## [55] "maternal_mortality_ratio_deaths_per_100_000_live_births"                                   
## [56] "renewable_energy_consumption_percent_of_total_final_energy_consumption"                    
## [57] "estimated_gross_galactic_income_per_capita_male"                                           
## [58] "estimated_gross_galactic_income_per_capita_female"                                         
## [59] "rural_population_with_access_to_electricity_percent"                                       
## [60] "domestic_credit_provided_by_financial_sector_percent_of_ggp"                               
## [61] "population_with_at_least_some_secondary_education_female_percent_ages_25_and_older"        
## [62] "population_with_at_least_some_secondary_education_male_percent_ages_25_and_older"          
## [63] "gross_fixed_capital_formation_percent_of_ggp"                                              
## [64] "remittances_inflows_percent_of_ggp"                                                        
## [65] "population_with_at_least_some_secondary_education_percent_ages_25_and_older"               
## [66] "intergalactic_inbound_tourists_thousands"                                                  
## [67] "gross_enrolment_ratio_primary_percent_of_primary_under_age_population"                     
## [68] "respiratory_disease_incidence_per_100_000_people"                                          
## [69] "interstellar_phone_subscriptions_per_100_people"                                           
## [70] "interstellar_data_net_users_total_percent_of_population"                                   
## [71] "current_health_expenditure_percent_of_ggp"                                                 
## [72] "intergalactic_development_index_idi_female"                                                
## [73] "intergalactic_development_index_idi_male"                                                  
## [74] "gender_development_index_gdi"                                                              
## [75] "intergalactic_development_index_idi_female_rank"                                           
## [76] "intergalactic_development_index_idi_male_rank"                                             
## [77] "adjusted_net_savings"                                                                      
## [78] "creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total"               
## [79] "private_galaxy_capital_flows_percent_of_ggp"                                               
## [80] "gender_inequality_index_gii"                                                               
## [81] "predicted_well_being_index"

ANALYZING OUR DATA USING MULTIPLE REGRESSION

We will use elimination method to get our final model

Notes:We Get summaries of our data

#WE WIll create a model to check p values of our variables

test_mod_1 <- lm( existence_expectancy_index ~ 
                    existence_expectancy_at_birth+
                    gross_income_per_capita+
                    income_index+
                    expected_years_of_education_galactic_years+
                    mean_years_of_education_galactic_years+
                    intergalactic_development_index_idi+
                    education_index+
                    intergalactic_development_index_idi_rank+
                    population_using_at_least_basic_drinking_water_services_percent+
                    population_using_at_least_basic_sanitation_services_percent+
                    gross_capital_formation_percent_of_ggp+
                    population_total_millions+
                    population_urban_percent+
                    mortality_rate_under_five_per_1_000_live_births+
                    mortality_rate_infant_per_1_000_live_births+
                    old_age_dependency_ratio_old_age_65_and_older_per_100_creatures_ages_15_64+
                    population_ages_15a_64_millions+
                    population_ages_65_and_older_millions+
                    life_expectancy_at_birth_male_galactic_years+
                    life_expectancy_at_birth_female_galactic_years+
                    population_under_age_5_millions+
                    young_age_0_14_dependency_ratio_per_100_creatures_ages_15_64+
                    adolescent_birth_rate_births_per_1_000_female_creatures_ages_15_19+
                    total_unemployment_rate_female_to_male_ratio+
                    vulnerable_employment_percent_of_total_employment+
                    unemployment_total_percent_of_labour_force+
                    employment_in_agriculture_percent_of_total_employment+
                    labour_force_participation_rate_percent_ages_15_and_older+
                    labour_force_participation_rate_percent_ages_15_and_older_female+
                    employment_in_services_percent_of_total_employment+
                    labour_force_participation_rate_percent_ages_15_and_older_male+
                    employment_to_population_ratio_percent_ages_15_and_older+
                    jungle_area_percent_of_total_land_area+
                    share_of_employment_in_nonagriculture_female_percent_of_total_employment_in_nonagriculture+
                    youth_unemployment_rate_female_to_male_ratio+
                    unemployment_youth_percent_ages_15a_24+
                    mortality_rate_female_grown_up_per_1_000_people+
                    mortality_rate_male_grown_up_per_1_000_people+
                    infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds+
                    infants_lacking_immunization_combination_vaccine_percent_of_one_galactic_year_olds+
                    gross_galactic_product_ggp_per_capita+
                    gross_galactic_product_ggp_total+
                    outer_galaxies_direct_investment_net_inflows_percent_of_ggp+
                    exports_and_imports_percent_of_ggp+
                    share_of_seats_in_senate_percent_held_by_female+
                    natural_resource_depletion+
                    mean_years_of_education_female_galactic_years+
                    +
                    expected_years_of_education_female_galactic_years+
                    expected_years_of_education_male_galactic_years+
                    maternal_mortality_ratio_deaths_per_100_000_live_births+
                    renewable_energy_consumption_percent_of_total_final_energy_consumption+
                    estimated_gross_galactic_income_per_capita_male+
                    estimated_gross_galactic_income_per_capita_female+
                    rural_population_with_access_to_electricity_percent+
                    domestic_credit_provided_by_financial_sector_percent_of_ggp+
                    population_with_at_least_some_secondary_education_female_percent_ages_25_and_older+
                    population_with_at_least_some_secondary_education_male_percent_ages_25_and_older+
                    gross_fixed_capital_formation_percent_of_ggp+
                    remittances_inflows_percent_of_ggp+
                    population_with_at_least_some_secondary_education_percent_ages_25_and_older+
                    intergalactic_inbound_tourists_thousands+
                    gross_enrolment_ratio_primary_percent_of_primary_under_age_population+
                    respiratory_disease_incidence_per_100_000_people+
                    interstellar_phone_subscriptions_per_100_people+
                    interstellar_data_net_users_total_percent_of_population+
                    current_health_expenditure_percent_of_ggp+
                    intergalactic_development_index_idi_female+
                    intergalactic_development_index_idi_male+
                    gender_development_index_gdi+
                    intergalactic_development_index_idi_female_rank+
                    intergalactic_development_index_idi_male_rank+
                    adjusted_net_savings+
                    creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total+
                    private_galaxy_capital_flows_percent_of_ggp+
                    gender_inequality_index_gii
                , data = Test_clean)
summary(test_mod_1)
## 
## Call:
## lm(formula = existence_expectancy_index ~ existence_expectancy_at_birth + 
##     gross_income_per_capita + income_index + expected_years_of_education_galactic_years + 
##     mean_years_of_education_galactic_years + intergalactic_development_index_idi + 
##     education_index + intergalactic_development_index_idi_rank + 
##     population_using_at_least_basic_drinking_water_services_percent + 
##     population_using_at_least_basic_sanitation_services_percent + 
##     gross_capital_formation_percent_of_ggp + population_total_millions + 
##     population_urban_percent + mortality_rate_under_five_per_1_000_live_births + 
##     mortality_rate_infant_per_1_000_live_births + old_age_dependency_ratio_old_age_65_and_older_per_100_creatures_ages_15_64 + 
##     population_ages_15a_64_millions + population_ages_65_and_older_millions + 
##     life_expectancy_at_birth_male_galactic_years + life_expectancy_at_birth_female_galactic_years + 
##     population_under_age_5_millions + young_age_0_14_dependency_ratio_per_100_creatures_ages_15_64 + 
##     adolescent_birth_rate_births_per_1_000_female_creatures_ages_15_19 + 
##     total_unemployment_rate_female_to_male_ratio + vulnerable_employment_percent_of_total_employment + 
##     unemployment_total_percent_of_labour_force + employment_in_agriculture_percent_of_total_employment + 
##     labour_force_participation_rate_percent_ages_15_and_older + 
##     labour_force_participation_rate_percent_ages_15_and_older_female + 
##     employment_in_services_percent_of_total_employment + labour_force_participation_rate_percent_ages_15_and_older_male + 
##     employment_to_population_ratio_percent_ages_15_and_older + 
##     jungle_area_percent_of_total_land_area + share_of_employment_in_nonagriculture_female_percent_of_total_employment_in_nonagriculture + 
##     youth_unemployment_rate_female_to_male_ratio + unemployment_youth_percent_ages_15a_24 + 
##     mortality_rate_female_grown_up_per_1_000_people + mortality_rate_male_grown_up_per_1_000_people + 
##     infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds + 
##     infants_lacking_immunization_combination_vaccine_percent_of_one_galactic_year_olds + 
##     gross_galactic_product_ggp_per_capita + gross_galactic_product_ggp_total + 
##     outer_galaxies_direct_investment_net_inflows_percent_of_ggp + 
##     exports_and_imports_percent_of_ggp + share_of_seats_in_senate_percent_held_by_female + 
##     natural_resource_depletion + mean_years_of_education_female_galactic_years + 
##     +expected_years_of_education_female_galactic_years + expected_years_of_education_male_galactic_years + 
##     maternal_mortality_ratio_deaths_per_100_000_live_births + 
##     renewable_energy_consumption_percent_of_total_final_energy_consumption + 
##     estimated_gross_galactic_income_per_capita_male + estimated_gross_galactic_income_per_capita_female + 
##     rural_population_with_access_to_electricity_percent + domestic_credit_provided_by_financial_sector_percent_of_ggp + 
##     population_with_at_least_some_secondary_education_female_percent_ages_25_and_older + 
##     population_with_at_least_some_secondary_education_male_percent_ages_25_and_older + 
##     gross_fixed_capital_formation_percent_of_ggp + remittances_inflows_percent_of_ggp + 
##     population_with_at_least_some_secondary_education_percent_ages_25_and_older + 
##     intergalactic_inbound_tourists_thousands + gross_enrolment_ratio_primary_percent_of_primary_under_age_population + 
##     respiratory_disease_incidence_per_100_000_people + interstellar_phone_subscriptions_per_100_people + 
##     interstellar_data_net_users_total_percent_of_population + 
##     current_health_expenditure_percent_of_ggp + intergalactic_development_index_idi_female + 
##     intergalactic_development_index_idi_male + gender_development_index_gdi + 
##     intergalactic_development_index_idi_female_rank + intergalactic_development_index_idi_male_rank + 
##     adjusted_net_savings + creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total + 
##     private_galaxy_capital_flows_percent_of_ggp + gender_inequality_index_gii, 
##     data = Test_clean)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.115761 -0.031712 -0.003362  0.029146  0.141299 
## 
## Coefficients:
##                                                                                              Estimate
## (Intercept)                                                                                 6.552e-01
## existence_expectancy_at_birth                                                               1.711e-03
## gross_income_per_capita                                                                     5.671e-07
## income_index                                                                                2.442e-02
## expected_years_of_education_galactic_years                                                 -1.612e-03
## mean_years_of_education_galactic_years                                                     -1.402e-03
## intergalactic_development_index_idi                                                        -7.235e-02
## education_index                                                                             3.083e-02
## intergalactic_development_index_idi_rank                                                   -9.195e-05
## population_using_at_least_basic_drinking_water_services_percent                            -3.144e-04
## population_using_at_least_basic_sanitation_services_percent                                 1.768e-04
## gross_capital_formation_percent_of_ggp                                                      1.295e-04
## population_total_millions                                                                  -2.370e-05
## population_urban_percent                                                                    1.008e-04
## mortality_rate_under_five_per_1_000_live_births                                            -5.725e-04
## mortality_rate_infant_per_1_000_live_births                                                -6.841e-04
## old_age_dependency_ratio_old_age_65_and_older_per_100_creatures_ages_15_64                 -5.478e-04
## population_ages_15a_64_millions                                                            -2.229e-05
## population_ages_65_and_older_millions                                                       5.365e-04
## life_expectancy_at_birth_male_galactic_years                                                3.217e-03
## life_expectancy_at_birth_female_galactic_years                                              3.171e-03
## population_under_age_5_millions                                                            -5.182e-06
## young_age_0_14_dependency_ratio_per_100_creatures_ages_15_64                                5.033e-04
## adolescent_birth_rate_births_per_1_000_female_creatures_ages_15_19                          2.971e-04
## total_unemployment_rate_female_to_male_ratio                                                7.104e-03
## vulnerable_employment_percent_of_total_employment                                          -4.547e-04
## unemployment_total_percent_of_labour_force                                                  2.252e-03
## employment_in_agriculture_percent_of_total_employment                                      -1.875e-04
## labour_force_participation_rate_percent_ages_15_and_older                                  -1.130e-03
## labour_force_participation_rate_percent_ages_15_and_older_female                           -4.316e-05
## employment_in_services_percent_of_total_employment                                         -1.166e-03
## labour_force_participation_rate_percent_ages_15_and_older_male                             -2.336e-04
## employment_to_population_ratio_percent_ages_15_and_older                                    1.489e-03
## jungle_area_percent_of_total_land_area                                                     -4.389e-05
## share_of_employment_in_nonagriculture_female_percent_of_total_employment_in_nonagriculture  1.212e-04
## youth_unemployment_rate_female_to_male_ratio                                               -3.737e-03
## unemployment_youth_percent_ages_15a_24                                                      2.939e-04
## mortality_rate_female_grown_up_per_1_000_people                                             6.604e-05
## mortality_rate_male_grown_up_per_1_000_people                                              -1.820e-04
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds             -1.179e-03
## infants_lacking_immunization_combination_vaccine_percent_of_one_galactic_year_olds         -8.492e-04
## gross_galactic_product_ggp_per_capita                                                      -1.705e-07
## gross_galactic_product_ggp_total                                                            8.764e-07
## outer_galaxies_direct_investment_net_inflows_percent_of_ggp                                -2.639e-04
## exports_and_imports_percent_of_ggp                                                          2.341e-05
## share_of_seats_in_senate_percent_held_by_female                                             4.081e-04
## natural_resource_depletion                                                                 -8.736e-04
## mean_years_of_education_female_galactic_years                                               5.576e-03
## expected_years_of_education_female_galactic_years                                           6.133e-03
## expected_years_of_education_male_galactic_years                                            -2.373e-03
## maternal_mortality_ratio_deaths_per_100_000_live_births                                    -1.330e-06
## renewable_energy_consumption_percent_of_total_final_energy_consumption                     -4.462e-04
## estimated_gross_galactic_income_per_capita_male                                             4.628e-07
## estimated_gross_galactic_income_per_capita_female                                          -5.184e-07
## rural_population_with_access_to_electricity_percent                                        -2.363e-04
## domestic_credit_provided_by_financial_sector_percent_of_ggp                                -2.264e-05
## population_with_at_least_some_secondary_education_female_percent_ages_25_and_older          2.066e-04
## population_with_at_least_some_secondary_education_male_percent_ages_25_and_older           -8.116e-04
## gross_fixed_capital_formation_percent_of_ggp                                               -5.579e-04
## remittances_inflows_percent_of_ggp                                                         -2.142e-03
## population_with_at_least_some_secondary_education_percent_ages_25_and_older                 6.132e-04
## intergalactic_inbound_tourists_thousands                                                   -1.438e-07
## gross_enrolment_ratio_primary_percent_of_primary_under_age_population                      -1.820e-04
## respiratory_disease_incidence_per_100_000_people                                            6.694e-06
## interstellar_phone_subscriptions_per_100_people                                             2.983e-04
## interstellar_data_net_users_total_percent_of_population                                    -3.351e-04
## current_health_expenditure_percent_of_ggp                                                   2.630e-03
## intergalactic_development_index_idi_female                                                 -6.463e-02
## intergalactic_development_index_idi_male                                                    4.041e-02
## gender_development_index_gdi                                                               -1.518e-01
## intergalactic_development_index_idi_female_rank                                            -1.846e-04
## intergalactic_development_index_idi_male_rank                                               2.571e-04
## adjusted_net_savings                                                                        3.781e-04
## creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total                -4.432e-03
## private_galaxy_capital_flows_percent_of_ggp                                                -6.034e-05
## gender_inequality_index_gii                                                                 1.408e-02
##                                                                                            Std. Error
## (Intercept)                                                                                 2.571e-01
## existence_expectancy_at_birth                                                               1.249e-03
## gross_income_per_capita                                                                     6.561e-07
## income_index                                                                                6.458e-02
## expected_years_of_education_galactic_years                                                  3.494e-03
## mean_years_of_education_galactic_years                                                      3.392e-03
## intergalactic_development_index_idi                                                         7.614e-02
## education_index                                                                             6.463e-02
## intergalactic_development_index_idi_rank                                                    2.251e-04
## population_using_at_least_basic_drinking_water_services_percent                             5.581e-04
## population_using_at_least_basic_sanitation_services_percent                                 3.354e-04
## gross_capital_formation_percent_of_ggp                                                      1.014e-03
## population_total_millions                                                                   1.803e-05
## population_urban_percent                                                                    3.304e-04
## mortality_rate_under_five_per_1_000_live_births                                             2.612e-04
## mortality_rate_infant_per_1_000_live_births                                                 4.566e-04
## old_age_dependency_ratio_old_age_65_and_older_per_100_creatures_ages_15_64                  1.015e-03
## population_ages_15a_64_millions                                                             2.830e-05
## population_ages_65_and_older_millions                                                       2.179e-04
## life_expectancy_at_birth_male_galactic_years                                                1.256e-03
## life_expectancy_at_birth_female_galactic_years                                              1.248e-03
## population_under_age_5_millions                                                             1.738e-04
## young_age_0_14_dependency_ratio_per_100_creatures_ages_15_64                                4.522e-04
## adolescent_birth_rate_births_per_1_000_female_creatures_ages_15_19                          2.126e-04
## total_unemployment_rate_female_to_male_ratio                                                7.787e-03
## vulnerable_employment_percent_of_total_employment                                           3.713e-04
## unemployment_total_percent_of_labour_force                                                  1.464e-03
## employment_in_agriculture_percent_of_total_employment                                       4.528e-04
## labour_force_participation_rate_percent_ages_15_and_older                                   1.125e-03
## labour_force_participation_rate_percent_ages_15_and_older_female                            6.953e-04
## employment_in_services_percent_of_total_employment                                          5.543e-04
## labour_force_participation_rate_percent_ages_15_and_older_male                              9.736e-04
## employment_to_population_ratio_percent_ages_15_and_older                                    1.076e-03
## jungle_area_percent_of_total_land_area                                                      2.636e-04
## share_of_employment_in_nonagriculture_female_percent_of_total_employment_in_nonagriculture  7.779e-04
## youth_unemployment_rate_female_to_male_ratio                                                9.662e-03
## unemployment_youth_percent_ages_15a_24                                                      6.640e-04
## mortality_rate_female_grown_up_per_1_000_people                                             1.100e-04
## mortality_rate_male_grown_up_per_1_000_people                                               9.287e-05
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds              6.429e-04
## infants_lacking_immunization_combination_vaccine_percent_of_one_galactic_year_olds          9.840e-04
## gross_galactic_product_ggp_per_capita                                                       5.996e-07
## gross_galactic_product_ggp_total                                                            1.767e-06
## outer_galaxies_direct_investment_net_inflows_percent_of_ggp                                 4.081e-04
## exports_and_imports_percent_of_ggp                                                          1.241e-04
## share_of_seats_in_senate_percent_held_by_female                                             4.764e-04
## natural_resource_depletion                                                                  6.756e-04
## mean_years_of_education_female_galactic_years                                               3.655e-03
## expected_years_of_education_female_galactic_years                                           2.973e-03
## expected_years_of_education_male_galactic_years                                             3.801e-03
## maternal_mortality_ratio_deaths_per_100_000_live_births                                     3.264e-05
## renewable_energy_consumption_percent_of_total_final_energy_consumption                      2.847e-04
## estimated_gross_galactic_income_per_capita_male                                             5.165e-07
## estimated_gross_galactic_income_per_capita_female                                           8.902e-07
## rural_population_with_access_to_electricity_percent                                         2.875e-04
## domestic_credit_provided_by_financial_sector_percent_of_ggp                                 1.065e-04
## population_with_at_least_some_secondary_education_female_percent_ages_25_and_older          3.831e-04
## population_with_at_least_some_secondary_education_male_percent_ages_25_and_older            4.444e-04
## gross_fixed_capital_formation_percent_of_ggp                                                1.335e-03
## remittances_inflows_percent_of_ggp                                                          8.806e-04
## population_with_at_least_some_secondary_education_percent_ages_25_and_older                 4.354e-04
## intergalactic_inbound_tourists_thousands                                                    1.213e-07
## gross_enrolment_ratio_primary_percent_of_primary_under_age_population                       4.878e-04
## respiratory_disease_incidence_per_100_000_people                                            4.271e-05
## interstellar_phone_subscriptions_per_100_people                                             1.487e-04
## interstellar_data_net_users_total_percent_of_population                                     3.381e-04
## current_health_expenditure_percent_of_ggp                                                   2.507e-03
## intergalactic_development_index_idi_female                                                  7.258e-02
## intergalactic_development_index_idi_male                                                    9.130e-02
## gender_development_index_gdi                                                                1.199e-01
## intergalactic_development_index_idi_female_rank                                             2.495e-04
## intergalactic_development_index_idi_male_rank                                               2.782e-04
## adjusted_net_savings                                                                        5.387e-04
## creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total                 1.681e-03
## private_galaxy_capital_flows_percent_of_ggp                                                 1.363e-04
## gender_inequality_index_gii                                                                 5.966e-02
##                                                                                            t value
## (Intercept)                                                                                  2.549
## existence_expectancy_at_birth                                                                1.370
## gross_income_per_capita                                                                      0.864
## income_index                                                                                 0.378
## expected_years_of_education_galactic_years                                                  -0.461
## mean_years_of_education_galactic_years                                                      -0.413
## intergalactic_development_index_idi                                                         -0.950
## education_index                                                                              0.477
## intergalactic_development_index_idi_rank                                                    -0.408
## population_using_at_least_basic_drinking_water_services_percent                             -0.563
## population_using_at_least_basic_sanitation_services_percent                                  0.527
## gross_capital_formation_percent_of_ggp                                                       0.128
## population_total_millions                                                                   -1.315
## population_urban_percent                                                                     0.305
## mortality_rate_under_five_per_1_000_live_births                                             -2.192
## mortality_rate_infant_per_1_000_live_births                                                 -1.498
## old_age_dependency_ratio_old_age_65_and_older_per_100_creatures_ages_15_64                  -0.540
## population_ages_15a_64_millions                                                             -0.788
## population_ages_65_and_older_millions                                                        2.462
## life_expectancy_at_birth_male_galactic_years                                                 2.562
## life_expectancy_at_birth_female_galactic_years                                               2.541
## population_under_age_5_millions                                                             -0.030
## young_age_0_14_dependency_ratio_per_100_creatures_ages_15_64                                 1.113
## adolescent_birth_rate_births_per_1_000_female_creatures_ages_15_19                           1.398
## total_unemployment_rate_female_to_male_ratio                                                 0.912
## vulnerable_employment_percent_of_total_employment                                           -1.225
## unemployment_total_percent_of_labour_force                                                   1.538
## employment_in_agriculture_percent_of_total_employment                                       -0.414
## labour_force_participation_rate_percent_ages_15_and_older                                   -1.005
## labour_force_participation_rate_percent_ages_15_and_older_female                            -0.062
## employment_in_services_percent_of_total_employment                                          -2.103
## labour_force_participation_rate_percent_ages_15_and_older_male                              -0.240
## employment_to_population_ratio_percent_ages_15_and_older                                     1.384
## jungle_area_percent_of_total_land_area                                                      -0.167
## share_of_employment_in_nonagriculture_female_percent_of_total_employment_in_nonagriculture   0.156
## youth_unemployment_rate_female_to_male_ratio                                                -0.387
## unemployment_youth_percent_ages_15a_24                                                       0.443
## mortality_rate_female_grown_up_per_1_000_people                                              0.600
## mortality_rate_male_grown_up_per_1_000_people                                               -1.960
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds              -1.834
## infants_lacking_immunization_combination_vaccine_percent_of_one_galactic_year_olds          -0.863
## gross_galactic_product_ggp_per_capita                                                       -0.284
## gross_galactic_product_ggp_total                                                             0.496
## outer_galaxies_direct_investment_net_inflows_percent_of_ggp                                 -0.647
## exports_and_imports_percent_of_ggp                                                           0.189
## share_of_seats_in_senate_percent_held_by_female                                              0.856
## natural_resource_depletion                                                                  -1.293
## mean_years_of_education_female_galactic_years                                                1.525
## expected_years_of_education_female_galactic_years                                            2.063
## expected_years_of_education_male_galactic_years                                             -0.624
## maternal_mortality_ratio_deaths_per_100_000_live_births                                     -0.041
## renewable_energy_consumption_percent_of_total_final_energy_consumption                      -1.567
## estimated_gross_galactic_income_per_capita_male                                              0.896
## estimated_gross_galactic_income_per_capita_female                                           -0.582
## rural_population_with_access_to_electricity_percent                                         -0.822
## domestic_credit_provided_by_financial_sector_percent_of_ggp                                 -0.213
## population_with_at_least_some_secondary_education_female_percent_ages_25_and_older           0.539
## population_with_at_least_some_secondary_education_male_percent_ages_25_and_older            -1.826
## gross_fixed_capital_formation_percent_of_ggp                                                -0.418
## remittances_inflows_percent_of_ggp                                                          -2.432
## population_with_at_least_some_secondary_education_percent_ages_25_and_older                  1.408
## intergalactic_inbound_tourists_thousands                                                    -1.186
## gross_enrolment_ratio_primary_percent_of_primary_under_age_population                       -0.373
## respiratory_disease_incidence_per_100_000_people                                             0.157
## interstellar_phone_subscriptions_per_100_people                                              2.005
## interstellar_data_net_users_total_percent_of_population                                     -0.991
## current_health_expenditure_percent_of_ggp                                                    1.049
## intergalactic_development_index_idi_female                                                  -0.890
## intergalactic_development_index_idi_male                                                     0.443
## gender_development_index_gdi                                                                -1.266
## intergalactic_development_index_idi_female_rank                                             -0.740
## intergalactic_development_index_idi_male_rank                                                0.924
## adjusted_net_savings                                                                         0.702
## creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total                 -2.637
## private_galaxy_capital_flows_percent_of_ggp                                                 -0.443
## gender_inequality_index_gii                                                                  0.236
##                                                                                            Pr(>|t|)
## (Intercept)                                                                                 0.01180
## existence_expectancy_at_birth                                                               0.17276
## gross_income_per_capita                                                                     0.38875
## income_index                                                                                0.70586
## expected_years_of_education_galactic_years                                                  0.64512
## mean_years_of_education_galactic_years                                                      0.67991
## intergalactic_development_index_idi                                                         0.34351
## education_index                                                                             0.63403
## intergalactic_development_index_idi_rank                                                    0.68352
## population_using_at_least_basic_drinking_water_services_percent                             0.57408
## population_using_at_least_basic_sanitation_services_percent                                 0.59885
## gross_capital_formation_percent_of_ggp                                                      0.89850
## population_total_millions                                                                   0.19054
## population_urban_percent                                                                    0.76063
## mortality_rate_under_five_per_1_000_live_births                                             0.02988
## mortality_rate_infant_per_1_000_live_births                                                 0.13610
## old_age_dependency_ratio_old_age_65_and_older_per_100_creatures_ages_15_64                  0.59022
## population_ages_15a_64_millions                                                             0.43209
## population_ages_65_and_older_millions                                                       0.01490
## life_expectancy_at_birth_male_galactic_years                                                0.01136
## life_expectancy_at_birth_female_galactic_years                                              0.01206
## population_under_age_5_millions                                                             0.97626
## young_age_0_14_dependency_ratio_per_100_creatures_ages_15_64                                0.26742
## adolescent_birth_rate_births_per_1_000_female_creatures_ages_15_19                          0.16422
## total_unemployment_rate_female_to_male_ratio                                                0.36302
## vulnerable_employment_percent_of_total_employment                                           0.22259
## unemployment_total_percent_of_labour_force                                                  0.12612
## employment_in_agriculture_percent_of_total_employment                                       0.67939
## labour_force_participation_rate_percent_ages_15_and_older                                   0.31667
## labour_force_participation_rate_percent_ages_15_and_older_female                            0.95059
## employment_in_services_percent_of_total_employment                                          0.03707
## labour_force_participation_rate_percent_ages_15_and_older_male                              0.81075
## employment_to_population_ratio_percent_ages_15_and_older                                    0.16831
## jungle_area_percent_of_total_land_area                                                      0.86796
## share_of_employment_in_nonagriculture_female_percent_of_total_employment_in_nonagriculture  0.87640
## youth_unemployment_rate_female_to_male_ratio                                                0.69945
## unemployment_youth_percent_ages_15a_24                                                      0.65869
## mortality_rate_female_grown_up_per_1_000_people                                             0.54924
## mortality_rate_male_grown_up_per_1_000_people                                               0.05179
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds              0.06852
## infants_lacking_immunization_combination_vaccine_percent_of_one_galactic_year_olds          0.38946
## gross_galactic_product_ggp_per_capita                                                       0.77659
## gross_galactic_product_ggp_total                                                            0.62059
## outer_galaxies_direct_investment_net_inflows_percent_of_ggp                                 0.51885
## exports_and_imports_percent_of_ggp                                                          0.85059
## share_of_seats_in_senate_percent_held_by_female                                             0.39307
## natural_resource_depletion                                                                  0.19791
## mean_years_of_education_female_galactic_years                                               0.12923
## expected_years_of_education_female_galactic_years                                           0.04083
## expected_years_of_education_male_galactic_years                                             0.53332
## maternal_mortality_ratio_deaths_per_100_000_live_births                                     0.96756
## renewable_energy_consumption_percent_of_total_final_energy_consumption                      0.11913
## estimated_gross_galactic_income_per_capita_male                                             0.37158
## estimated_gross_galactic_income_per_capita_female                                           0.56116
## rural_population_with_access_to_electricity_percent                                         0.41243
## domestic_credit_provided_by_financial_sector_percent_of_ggp                                 0.83198
## population_with_at_least_some_secondary_education_female_percent_ages_25_and_older          0.59038
## population_with_at_least_some_secondary_education_male_percent_ages_25_and_older            0.06975
## gross_fixed_capital_formation_percent_of_ggp                                                0.67657
## remittances_inflows_percent_of_ggp                                                          0.01616
## population_with_at_least_some_secondary_education_percent_ages_25_and_older                 0.16103
## intergalactic_inbound_tourists_thousands                                                    0.23749
## gross_enrolment_ratio_primary_percent_of_primary_under_age_population                       0.70955
## respiratory_disease_incidence_per_100_000_people                                            0.87566
## interstellar_phone_subscriptions_per_100_people                                             0.04668
## interstellar_data_net_users_total_percent_of_population                                     0.32314
## current_health_expenditure_percent_of_ggp                                                   0.29571
## intergalactic_development_index_idi_female                                                  0.37460
## intergalactic_development_index_idi_male                                                    0.65865
## gender_development_index_gdi                                                                0.20741
## intergalactic_development_index_idi_female_rank                                             0.46054
## intergalactic_development_index_idi_male_rank                                               0.35696
## adjusted_net_savings                                                                        0.48383
## creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total                 0.00922
## private_galaxy_capital_flows_percent_of_ggp                                                 0.65853
## gender_inequality_index_gii                                                                 0.81376
##                                                                                              
## (Intercept)                                                                                * 
## existence_expectancy_at_birth                                                                
## gross_income_per_capita                                                                      
## income_index                                                                                 
## expected_years_of_education_galactic_years                                                   
## mean_years_of_education_galactic_years                                                       
## intergalactic_development_index_idi                                                          
## education_index                                                                              
## intergalactic_development_index_idi_rank                                                     
## population_using_at_least_basic_drinking_water_services_percent                              
## population_using_at_least_basic_sanitation_services_percent                                  
## gross_capital_formation_percent_of_ggp                                                       
## population_total_millions                                                                    
## population_urban_percent                                                                     
## mortality_rate_under_five_per_1_000_live_births                                            * 
## mortality_rate_infant_per_1_000_live_births                                                  
## old_age_dependency_ratio_old_age_65_and_older_per_100_creatures_ages_15_64                   
## population_ages_15a_64_millions                                                              
## population_ages_65_and_older_millions                                                      * 
## life_expectancy_at_birth_male_galactic_years                                               * 
## life_expectancy_at_birth_female_galactic_years                                             * 
## population_under_age_5_millions                                                              
## young_age_0_14_dependency_ratio_per_100_creatures_ages_15_64                                 
## adolescent_birth_rate_births_per_1_000_female_creatures_ages_15_19                           
## total_unemployment_rate_female_to_male_ratio                                                 
## vulnerable_employment_percent_of_total_employment                                            
## unemployment_total_percent_of_labour_force                                                   
## employment_in_agriculture_percent_of_total_employment                                        
## labour_force_participation_rate_percent_ages_15_and_older                                    
## labour_force_participation_rate_percent_ages_15_and_older_female                             
## employment_in_services_percent_of_total_employment                                         * 
## labour_force_participation_rate_percent_ages_15_and_older_male                               
## employment_to_population_ratio_percent_ages_15_and_older                                     
## jungle_area_percent_of_total_land_area                                                       
## share_of_employment_in_nonagriculture_female_percent_of_total_employment_in_nonagriculture   
## youth_unemployment_rate_female_to_male_ratio                                                 
## unemployment_youth_percent_ages_15a_24                                                       
## mortality_rate_female_grown_up_per_1_000_people                                              
## mortality_rate_male_grown_up_per_1_000_people                                              . 
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds             . 
## infants_lacking_immunization_combination_vaccine_percent_of_one_galactic_year_olds           
## gross_galactic_product_ggp_per_capita                                                        
## gross_galactic_product_ggp_total                                                             
## outer_galaxies_direct_investment_net_inflows_percent_of_ggp                                  
## exports_and_imports_percent_of_ggp                                                           
## share_of_seats_in_senate_percent_held_by_female                                              
## natural_resource_depletion                                                                   
## mean_years_of_education_female_galactic_years                                                
## expected_years_of_education_female_galactic_years                                          * 
## expected_years_of_education_male_galactic_years                                              
## maternal_mortality_ratio_deaths_per_100_000_live_births                                      
## renewable_energy_consumption_percent_of_total_final_energy_consumption                       
## estimated_gross_galactic_income_per_capita_male                                              
## estimated_gross_galactic_income_per_capita_female                                            
## rural_population_with_access_to_electricity_percent                                          
## domestic_credit_provided_by_financial_sector_percent_of_ggp                                  
## population_with_at_least_some_secondary_education_female_percent_ages_25_and_older           
## population_with_at_least_some_secondary_education_male_percent_ages_25_and_older           . 
## gross_fixed_capital_formation_percent_of_ggp                                                 
## remittances_inflows_percent_of_ggp                                                         * 
## population_with_at_least_some_secondary_education_percent_ages_25_and_older                  
## intergalactic_inbound_tourists_thousands                                                     
## gross_enrolment_ratio_primary_percent_of_primary_under_age_population                        
## respiratory_disease_incidence_per_100_000_people                                             
## interstellar_phone_subscriptions_per_100_people                                            * 
## interstellar_data_net_users_total_percent_of_population                                      
## current_health_expenditure_percent_of_ggp                                                    
## intergalactic_development_index_idi_female                                                   
## intergalactic_development_index_idi_male                                                     
## gender_development_index_gdi                                                                 
## intergalactic_development_index_idi_female_rank                                              
## intergalactic_development_index_idi_male_rank                                                
## adjusted_net_savings                                                                         
## creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total                **
## private_galaxy_capital_flows_percent_of_ggp                                                  
## gender_inequality_index_gii                                                                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.05509 on 154 degrees of freedom
##   (490 observations deleted due to missingness)
## Multiple R-squared:  0.9036, Adjusted R-squared:  0.8566 
## F-statistic: 19.24 on 75 and 154 DF,  p-value: < 2.2e-16
#WE HAVE FOUND ONLY 13 PREDICTORS ARE ACTUALLY SIGNIFICANT IN RELATION TO P VALUE

SIZING DOWN TO 13 VARIABLES

#M0DEL2
test_mod_2 <- lm( existence_expectancy_index~
                   existence_expectancy_at_birth+
                   mortality_rate_under_five_per_1_000_live_births+
                   population_ages_65_and_older_millions+
                   life_expectancy_at_birth_male_galactic_years+
                   life_expectancy_at_birth_female_galactic_years+
                   employment_in_services_percent_of_total_employment+
                   mortality_rate_male_grown_up_per_1_000_people+
                   infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds+
                   expected_years_of_education_female_galactic_years+
                   population_with_at_least_some_secondary_education_male_percent_ages_25_and_older+
                   remittances_inflows_percent_of_ggp+
                   interstellar_phone_subscriptions_per_100_people+
                   creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total
                  , data = Test_clean)
summary(test_mod_2)
## 
## Call:
## lm(formula = existence_expectancy_index ~ existence_expectancy_at_birth + 
##     mortality_rate_under_five_per_1_000_live_births + population_ages_65_and_older_millions + 
##     life_expectancy_at_birth_male_galactic_years + life_expectancy_at_birth_female_galactic_years + 
##     employment_in_services_percent_of_total_employment + mortality_rate_male_grown_up_per_1_000_people + 
##     infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds + 
##     expected_years_of_education_female_galactic_years + population_with_at_least_some_secondary_education_male_percent_ages_25_and_older + 
##     remittances_inflows_percent_of_ggp + interstellar_phone_subscriptions_per_100_people + 
##     creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total, 
##     data = Test_clean)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.135659 -0.036286 -0.002143  0.032631  0.203393 
## 
## Coefficients:
##                                                                                    Estimate
## (Intercept)                                                                       2.546e-01
## existence_expectancy_at_birth                                                     2.905e-03
## mortality_rate_under_five_per_1_000_live_births                                  -3.478e-04
## population_ages_65_and_older_millions                                             9.660e-05
## life_expectancy_at_birth_male_galactic_years                                      2.910e-03
## life_expectancy_at_birth_female_galactic_years                                    3.286e-03
## employment_in_services_percent_of_total_employment                               -4.571e-05
## mortality_rate_male_grown_up_per_1_000_people                                    -1.854e-04
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds   -7.428e-04
## expected_years_of_education_female_galactic_years                                 3.575e-03
## population_with_at_least_some_secondary_education_male_percent_ages_25_and_older -8.307e-05
## remittances_inflows_percent_of_ggp                                               -5.909e-04
## interstellar_phone_subscriptions_per_100_people                                   8.967e-05
## creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total      -1.408e-03
##                                                                                  Std. Error
## (Intercept)                                                                       9.665e-02
## existence_expectancy_at_birth                                                     8.608e-04
## mortality_rate_under_five_per_1_000_live_births                                   1.527e-04
## population_ages_65_and_older_millions                                             4.792e-05
## life_expectancy_at_birth_male_galactic_years                                      8.538e-04
## life_expectancy_at_birth_female_galactic_years                                    8.063e-04
## employment_in_services_percent_of_total_employment                                2.385e-04
## mortality_rate_male_grown_up_per_1_000_people                                     5.491e-05
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds    3.133e-04
## expected_years_of_education_female_galactic_years                                 1.592e-03
## population_with_at_least_some_secondary_education_male_percent_ages_25_and_older  1.464e-04
## remittances_inflows_percent_of_ggp                                                4.347e-04
## interstellar_phone_subscriptions_per_100_people                                   9.679e-05
## creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total       7.811e-04
##                                                                                  t value
## (Intercept)                                                                        2.635
## existence_expectancy_at_birth                                                      3.375
## mortality_rate_under_five_per_1_000_live_births                                   -2.277
## population_ages_65_and_older_millions                                              2.016
## life_expectancy_at_birth_male_galactic_years                                       3.409
## life_expectancy_at_birth_female_galactic_years                                     4.075
## employment_in_services_percent_of_total_employment                                -0.192
## mortality_rate_male_grown_up_per_1_000_people                                     -3.376
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds    -2.371
## expected_years_of_education_female_galactic_years                                  2.246
## population_with_at_least_some_secondary_education_male_percent_ages_25_and_older  -0.567
## remittances_inflows_percent_of_ggp                                                -1.359
## interstellar_phone_subscriptions_per_100_people                                    0.926
## creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total       -1.803
##                                                                                  Pr(>|t|)
## (Intercept)                                                                      0.008822
## existence_expectancy_at_birth                                                    0.000827
## mortality_rate_under_five_per_1_000_live_births                                  0.023449
## population_ages_65_and_older_millions                                            0.044629
## life_expectancy_at_birth_male_galactic_years                                     0.000734
## life_expectancy_at_birth_female_galactic_years                                   5.78e-05
## employment_in_services_percent_of_total_employment                               0.848146
## mortality_rate_male_grown_up_per_1_000_people                                    0.000823
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds   0.018330
## expected_years_of_education_female_galactic_years                                0.025395
## population_with_at_least_some_secondary_education_male_percent_ages_25_and_older 0.570897
## remittances_inflows_percent_of_ggp                                               0.174967
## interstellar_phone_subscriptions_per_100_people                                  0.354927
## creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total      0.072351
##                                                                                     
## (Intercept)                                                                      ** 
## existence_expectancy_at_birth                                                    ***
## mortality_rate_under_five_per_1_000_live_births                                  *  
## population_ages_65_and_older_millions                                            *  
## life_expectancy_at_birth_male_galactic_years                                     ***
## life_expectancy_at_birth_female_galactic_years                                   ***
## employment_in_services_percent_of_total_employment                                  
## mortality_rate_male_grown_up_per_1_000_people                                    ***
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds   *  
## expected_years_of_education_female_galactic_years                                *  
## population_with_at_least_some_secondary_education_male_percent_ages_25_and_older    
## remittances_inflows_percent_of_ggp                                                  
## interstellar_phone_subscriptions_per_100_people                                     
## creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total      .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.05463 on 328 degrees of freedom
##   (378 observations deleted due to missingness)
## Multiple R-squared:  0.8532, Adjusted R-squared:  0.8473 
## F-statistic: 146.6 on 13 and 328 DF,  p-value: < 2.2e-16

SIZING DOWN TO 9 VARIABLES

#M0DEL3
test_mod_3 <- lm( existence_expectancy_index~
                    existence_expectancy_at_birth+
                    mortality_rate_under_five_per_1_000_live_births+
                    population_ages_65_and_older_millions+
                    life_expectancy_at_birth_male_galactic_years+
                    life_expectancy_at_birth_female_galactic_years+
                    mortality_rate_male_grown_up_per_1_000_people+
                    infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds+
                    expected_years_of_education_female_galactic_years+
                    creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total
                  , data = Test_clean)
summary(test_mod_3)
## 
## Call:
## lm(formula = existence_expectancy_index ~ existence_expectancy_at_birth + 
##     mortality_rate_under_five_per_1_000_live_births + population_ages_65_and_older_millions + 
##     life_expectancy_at_birth_male_galactic_years + life_expectancy_at_birth_female_galactic_years + 
##     mortality_rate_male_grown_up_per_1_000_people + infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds + 
##     expected_years_of_education_female_galactic_years + creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total, 
##     data = Test_clean)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.150125 -0.035063 -0.001639  0.031314  0.193739 
## 
## Coefficients:
##                                                                                  Estimate
## (Intercept)                                                                     1.951e-01
## existence_expectancy_at_birth                                                   2.918e-03
## mortality_rate_under_five_per_1_000_live_births                                -3.127e-04
## population_ages_65_and_older_millions                                           1.011e-04
## life_expectancy_at_birth_male_galactic_years                                    3.159e-03
## life_expectancy_at_birth_female_galactic_years                                  3.400e-03
## mortality_rate_male_grown_up_per_1_000_people                                  -1.701e-04
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds -4.169e-04
## expected_years_of_education_female_galactic_years                               3.873e-03
## creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total    -1.104e-03
##                                                                                Std. Error
## (Intercept)                                                                     8.581e-02
## existence_expectancy_at_birth                                                   7.884e-04
## mortality_rate_under_five_per_1_000_live_births                                 1.380e-04
## population_ages_65_and_older_millions                                           4.662e-05
## life_expectancy_at_birth_male_galactic_years                                    7.946e-04
## life_expectancy_at_birth_female_galactic_years                                  7.426e-04
## mortality_rate_male_grown_up_per_1_000_people                                   4.807e-05
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds  2.482e-04
## expected_years_of_education_female_galactic_years                               1.269e-03
## creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total     7.311e-04
##                                                                                t value
## (Intercept)                                                                      2.274
## existence_expectancy_at_birth                                                    3.701
## mortality_rate_under_five_per_1_000_live_births                                 -2.266
## population_ages_65_and_older_millions                                            2.169
## life_expectancy_at_birth_male_galactic_years                                     3.976
## life_expectancy_at_birth_female_galactic_years                                   4.578
## mortality_rate_male_grown_up_per_1_000_people                                   -3.539
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds  -1.679
## expected_years_of_education_female_galactic_years                                3.051
## creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total     -1.510
##                                                                                Pr(>|t|)
## (Intercept)                                                                    0.023533
## existence_expectancy_at_birth                                                  0.000247
## mortality_rate_under_five_per_1_000_live_births                                0.023999
## population_ages_65_and_older_millions                                          0.030663
## life_expectancy_at_birth_male_galactic_years                                   8.39e-05
## life_expectancy_at_birth_female_galactic_years                                 6.37e-06
## mortality_rate_male_grown_up_per_1_000_people                                  0.000451
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds 0.093884
## expected_years_of_education_female_galactic_years                              0.002438
## creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total    0.131835
##                                                                                   
## (Intercept)                                                                    *  
## existence_expectancy_at_birth                                                  ***
## mortality_rate_under_five_per_1_000_live_births                                *  
## population_ages_65_and_older_millions                                          *  
## life_expectancy_at_birth_male_galactic_years                                   ***
## life_expectancy_at_birth_female_galactic_years                                 ***
## mortality_rate_male_grown_up_per_1_000_people                                  ***
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds .  
## expected_years_of_education_female_galactic_years                              ** 
## creature_immunodeficiency_disease_prevalence_adult_percent_ages_15_49_total       
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.05409 on 382 degrees of freedom
##   (328 observations deleted due to missingness)
## Multiple R-squared:  0.8681, Adjusted R-squared:  0.865 
## F-statistic: 279.4 on 9 and 382 DF,  p-value: < 2.2e-16

SIZING DOWN TO 8 VARIABLES

This is our final model since all predictors are significant

#MODEL 4
test_mod_4 <- lm( existence_expectancy_index~
                    existence_expectancy_at_birth+
                    mortality_rate_under_five_per_1_000_live_births+
                    population_ages_65_and_older_millions+
                    life_expectancy_at_birth_male_galactic_years+
                    life_expectancy_at_birth_female_galactic_years+
                    mortality_rate_male_grown_up_per_1_000_people+
                    infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds+
                    expected_years_of_education_female_galactic_years
                    ,data = Test_clean)
summary(test_mod_4)
## 
## Call:
## lm(formula = existence_expectancy_index ~ existence_expectancy_at_birth + 
##     mortality_rate_under_five_per_1_000_live_births + population_ages_65_and_older_millions + 
##     life_expectancy_at_birth_male_galactic_years + life_expectancy_at_birth_female_galactic_years + 
##     mortality_rate_male_grown_up_per_1_000_people + infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds + 
##     expected_years_of_education_female_galactic_years, data = Test_clean)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.151427 -0.036426  0.000176  0.031453  0.188855 
## 
## Coefficients:
##                                                                                  Estimate
## (Intercept)                                                                     1.760e-01
## existence_expectancy_at_birth                                                   2.957e-03
## mortality_rate_under_five_per_1_000_live_births                                -3.055e-04
## population_ages_65_and_older_millions                                           1.216e-04
## life_expectancy_at_birth_male_galactic_years                                    2.947e-03
## life_expectancy_at_birth_female_galactic_years                                  4.108e-03
## mortality_rate_male_grown_up_per_1_000_people                                  -1.862e-04
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds -3.830e-04
## expected_years_of_education_female_galactic_years                               2.002e-03
##                                                                                Std. Error
## (Intercept)                                                                     7.226e-02
## existence_expectancy_at_birth                                                   6.567e-04
## mortality_rate_under_five_per_1_000_live_births                                 1.194e-04
## population_ages_65_and_older_millions                                           4.620e-05
## life_expectancy_at_birth_male_galactic_years                                    7.029e-04
## life_expectancy_at_birth_female_galactic_years                                  6.364e-04
## mortality_rate_male_grown_up_per_1_000_people                                   3.999e-05
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds  2.145e-04
## expected_years_of_education_female_galactic_years                               1.077e-03
##                                                                                t value
## (Intercept)                                                                      2.436
## existence_expectancy_at_birth                                                    4.503
## mortality_rate_under_five_per_1_000_live_births                                 -2.559
## population_ages_65_and_older_millions                                            2.632
## life_expectancy_at_birth_male_galactic_years                                     4.193
## life_expectancy_at_birth_female_galactic_years                                   6.455
## mortality_rate_male_grown_up_per_1_000_people                                   -4.656
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds  -1.785
## expected_years_of_education_female_galactic_years                                1.859
##                                                                                Pr(>|t|)
## (Intercept)                                                                     0.01517
## existence_expectancy_at_birth                                                  8.28e-06
## mortality_rate_under_five_per_1_000_live_births                                 0.01079
## population_ages_65_and_older_millions                                           0.00873
## life_expectancy_at_birth_male_galactic_years                                   3.23e-05
## life_expectancy_at_birth_female_galactic_years                                 2.47e-10
## mortality_rate_male_grown_up_per_1_000_people                                  4.10e-06
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds  0.07480
## expected_years_of_education_female_galactic_years                               0.06365
##                                                                                   
## (Intercept)                                                                    *  
## existence_expectancy_at_birth                                                  ***
## mortality_rate_under_five_per_1_000_live_births                                *  
## population_ages_65_and_older_millions                                          ** 
## life_expectancy_at_birth_male_galactic_years                                   ***
## life_expectancy_at_birth_female_galactic_years                                 ***
## mortality_rate_male_grown_up_per_1_000_people                                  ***
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds .  
## expected_years_of_education_female_galactic_years                              .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.05518 on 523 degrees of freedom
##   (188 observations deleted due to missingness)
## Multiple R-squared:  0.8455, Adjusted R-squared:  0.8431 
## F-statistic: 357.8 on 8 and 523 DF,  p-value: < 2.2e-16

ASSUMPTIONS CHECK

Normality

#Checking for assumptions of normality

#Extracting residuals(error between a predicted value and the observed actual value)
#or Extracting residuals(a measure of how far away a point is vertically from the regression line)
Residuals<-residuals(test_mod_4)

#checking first assumption Normality/non constant variance
shapiro.test(Residuals)
## 
##  Shapiro-Wilk normality test
## 
## data:  Residuals
## W = 0.99343, p-value = 0.02028
#Shapiro-Wilk normality test interpretation
#Ho:The residuals are normally distributed vs
#Ha:The population is not normally distributed
#p-value = 0.02028 < 0.05  so we reject the null hypothesis and conclude that the residuals are not normally distributed.
##Will be confirmed by normal q-q plot 

Constant variance

#checking 2nd assumption  constant variance
library(lmtest)
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
bptest(test_mod_4)
## 
##  studentized Breusch-Pagan test
## 
## data:  test_mod_4
## BP = 4.9541, df = 8, p-value = 0.7625
#studentized Breusch-Pagan test interpretation
#Ho:the variance of the residuals is constant vs
#Ha:the variance of the residuals is not constant
#p-value = 0.7625 > 0.05  so we fail to reject the null hypothesis and conclude that the the variance of the residuals is constant.
#will be confirmed by residuals plot

independence of the residuals.

#checking 3rd assumption  independence of residuals.
library(car)
## Loading required package: carData
## 
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
## 
##     recode
## The following object is masked from 'package:purrr':
## 
##     some
dwtest(test_mod_4)
## 
##  Durbin-Watson test
## 
## data:  test_mod_4
## DW = 1.8967, p-value = 0.0942
## alternative hypothesis: true autocorrelation is greater than 0
#studentized Breusch-Pagan test interpretation
#Ho:the residuals are independent vs
#Ha:the residuals are not independent
#p-value = 0.0942 > 0.05  so we fail to reject the null hypothesis and conclude that the residuals are independent.

MULTICOLLINEARITY CHECK

Notes: Should be less than 10 but ideally 1 is desired

#check for the variance inflation factor(MULTICOLLINEARITY)
vif(test_mod_4)
##                                                  existence_expectancy_at_birth 
##                                                                       6.661663 
##                                mortality_rate_under_five_per_1_000_live_births 
##                                                                       3.813419 
##                                          population_ages_65_and_older_millions 
##                                                                       1.006369 
##                                   life_expectancy_at_birth_male_galactic_years 
##                                                                       6.959645 
##                                 life_expectancy_at_birth_female_galactic_years 
##                                                                       6.641748 
##                                  mortality_rate_male_grown_up_per_1_000_people 
##                                                                       3.887856 
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds 
##                                                                       1.592642 
##                              expected_years_of_education_female_galactic_years 
##                                                                       2.558323

All are below 10 which shows that there is no interedependence of variables in oour model

ANOVA (Analysis of Variance)

Notes: We’ll create an anova table

#ANALYSIS OF VARIANCE
anova(test_mod_4)
## Analysis of Variance Table
## 
## Response: existence_expectancy_index
##                                                                                 Df
## existence_expectancy_at_birth                                                    1
## mortality_rate_under_five_per_1_000_live_births                                  1
## population_ages_65_and_older_millions                                            1
## life_expectancy_at_birth_male_galactic_years                                     1
## life_expectancy_at_birth_female_galactic_years                                   1
## mortality_rate_male_grown_up_per_1_000_people                                    1
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds   1
## expected_years_of_education_female_galactic_years                                1
## Residuals                                                                      523
##                                                                                Sum Sq
## existence_expectancy_at_birth                                                  7.8630
## mortality_rate_under_five_per_1_000_live_births                                0.2441
## population_ages_65_and_older_millions                                          0.0269
## life_expectancy_at_birth_male_galactic_years                                   0.3409
## life_expectancy_at_birth_female_galactic_years                                 0.1621
## mortality_rate_male_grown_up_per_1_000_people                                  0.0541
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds 0.0126
## expected_years_of_education_female_galactic_years                              0.0105
## Residuals                                                                      1.5922
##                                                                                Mean Sq
## existence_expectancy_at_birth                                                   7.8630
## mortality_rate_under_five_per_1_000_live_births                                 0.2441
## population_ages_65_and_older_millions                                           0.0269
## life_expectancy_at_birth_male_galactic_years                                    0.3409
## life_expectancy_at_birth_female_galactic_years                                  0.1621
## mortality_rate_male_grown_up_per_1_000_people                                   0.0541
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds  0.0126
## expected_years_of_education_female_galactic_years                               0.0105
## Residuals                                                                       0.0030
##                                                                                  F value
## existence_expectancy_at_birth                                                  2582.7215
## mortality_rate_under_five_per_1_000_live_births                                  80.1878
## population_ages_65_and_older_millions                                             8.8205
## life_expectancy_at_birth_male_galactic_years                                    111.9899
## life_expectancy_at_birth_female_galactic_years                                   53.2452
## mortality_rate_male_grown_up_per_1_000_people                                    17.7700
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds    4.1250
## expected_years_of_education_female_galactic_years                                 3.4543
## Residuals                                                                               
##                                                                                   Pr(>F)
## existence_expectancy_at_birth                                                  < 2.2e-16
## mortality_rate_under_five_per_1_000_live_births                                < 2.2e-16
## population_ages_65_and_older_millions                                           0.003115
## life_expectancy_at_birth_male_galactic_years                                   < 2.2e-16
## life_expectancy_at_birth_female_galactic_years                                 1.100e-12
## mortality_rate_male_grown_up_per_1_000_people                                  2.937e-05
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds  0.042760
## expected_years_of_education_female_galactic_years                               0.063648
## Residuals                                                                               
##                                                                                   
## existence_expectancy_at_birth                                                  ***
## mortality_rate_under_five_per_1_000_live_births                                ***
## population_ages_65_and_older_millions                                          ** 
## life_expectancy_at_birth_male_galactic_years                                   ***
## life_expectancy_at_birth_female_galactic_years                                 ***
## mortality_rate_male_grown_up_per_1_000_people                                  ***
## infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds *  
## expected_years_of_education_female_galactic_years                              .  
## Residuals                                                                         
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

All p values are significant in relation to their respective thresholds…therefore our model is signifcant

SHARING VISUALIZATIONS

Notes: Model Plot contains 4 visuals

#FOR CONFIRMING OUR ASSUMPTIONS
plot(test_mod_4)

#FOR CCHEKING CORRELATION VIA SCATTERPLOTS
avPlots(test_mod_4,id=FALSE, pt.wts=TRUE)

REGRESSION FORMULA FOR PREDICTING WELL BEING INDEX

  • After downsizing our variables We were able to remain with only 8 significant predictors of galaxy well being index
    • existence_expectancy_at_birth
    • mortality_rate_under_five_per_1_000_live_births
    • population_ages_65_and_older_millions
    • life_expectancy_at_birth_male_galactic_years
    • life_expectancy_at_birth_female_galactic_years
    • mortality_rate_male_grown_up_per_1_000_people
    • infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds
    • expected_years_of_education_female_galactic_years
  • Our multiple regression formula is as follows; Y(Predicted Well-Being Index)=1.760e-01+2.957e-03(existence_expectancy_at_birth)-3.055e-04(mortality_rate_under_five_per_1_000_live_births)+1.216e-04(population_ages_65_and_older_millions)+2.947e-03(life_expectancy_at_birth_male_galactic_years)+4.108e-03(life_expectancy_at_birth_female_galactic_years)-1.862e-04(mortality_rate_male_grown_up_per_1_000_people)-3.830e-04(infants_lacking_immunization_red_hot_disease_percent_of_one_galactic_year_olds)+2.002e-03(expected_years_of_education_female_galactic_years)
  • A simple iterative explanation for positive predictors: e.g if all other predictors bar the existence expectancy at birth are kept constant, then the Predicted well being index will increase by a factor of 2.957e-03 per existence expectancy at birth. The converse is true for all negative predictors e.g mortality rate under five per 1000 live births