In this project, we analyzed the relationship among country’s development level and people’s life quality.
The common macroeconomic theory indicated that people will benefit from country’s continuous development, and it will in turn increast the development speed of the country.
In this project, we choose five leading developing or newly industrialized countries, BRICS (Brazil, Russia, India, China, and South Africa), and performed empirical analysis to evaluate whether people’s quality of life actually improved in thorough measurement metrics.
Through analysis, we conclude that:
All BRICS countries have enjoyed continuous growth, but 2008 global crisis made this growth much slower, and for some countries, the growth nearly stopped.
People’s life quality improved a lot with the growth of each country. Hence it is consistent with our testing hypothesis that people will benefit from country’s development for having better welfare and more convenient life.
Even after 2008 global financial crisis, the growth was adversely affected, however, the improvement of people’s life in each countries didn’t stop.
For some BRICS countries, although they are still categoried as developing countries, people’s life quality improved a lot during these 14 years in terms of several welfare indicators, such as the electricity access.
However, there is still room for further improvement compared with other developed countries. For instance, only around half of the population has access to Internet for four out of five BRICS countries. It may be due to the large population base of those countries, however, it is still an indicator that continuous improvement is needed to improve people’s life quality.
library(WDI)
## Warning: package 'WDI' was built under R version 4.1.2
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.1.1
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
wdi_data = WDI(indicator = c('inf_mort' = "SP.DYN.IMRT.IN",
'gdpPercap'="NY.GDP.PCAP.KD",
'yrs_schooling'='BAR.SCHL.15UP'), # interest rate spread
start = 1960, end = 2020,
extra=TRUE) %>%
as_tibble()
head(wdi_data,2)
## # A tibble: 2 x 13
## iso2c country year inf_mort gdpPercap yrs_schooling iso3c region capital
## <chr> <chr> <int> <dbl> <dbl> <dbl> <chr> <chr> <chr>
## 1 "" Global Part~ 1970 NA NA NA <NA> <NA> <NA>
## 2 "" Global Part~ 1971 NA NA NA <NA> <NA> <NA>
## # ... with 4 more variables: longitude <chr>, latitude <chr>, income <chr>,
## # lending <chr>
summary(wdi_data)
## iso2c country year inf_mort
## Length:16532 Length:16532 Min. :1960 Min. : 1.50
## Class :character Class :character 1st Qu.:1975 1st Qu.: 15.00
## Mode :character Mode :character Median :1990 Median : 36.90
## Mean :1990 Mean : 50.27
## 3rd Qu.:2005 3rd Qu.: 73.80
## Max. :2020 Max. :279.70
## NA's :4587
## gdpPercap yrs_schooling iso3c region
## Min. : 124.3 Min. : 0.060 Length:16532 Length:16532
## 1st Qu.: 1270.4 1st Qu.: 3.905 Class :character Class :character
## Median : 3487.7 Median : 6.455 Mode :character Mode :character
## Mean : 10623.6 Mean : 6.374
## 3rd Qu.: 11729.6 3rd Qu.: 8.802
## Max. :183244.6 Max. :13.180
## NA's :4447 NA's :15236
## capital longitude latitude income
## Length:16532 Length:16532 Length:16532 Length:16532
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## lending
## Length:16532
## Class :character
## Mode :character
##
##
##
##
str(wdi_data)
## tibble [16,532 x 13] (S3: tbl_df/tbl/data.frame)
## $ iso2c : chr [1:16532] "" "" "" "" ...
## $ country : chr [1:16532] "Global Partnership for Education" "Global Partnership for Education" "Global Partnership for Education" "Global Partnership for Education" ...
## $ year : int [1:16532] 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 ...
## $ inf_mort : num [1:16532] NA NA NA NA NA NA NA NA NA NA ...
## ..- attr(*, "label")= chr "Mortality rate, infant (per 1,000 live births)"
## $ gdpPercap : num [1:16532] NA NA NA NA NA NA NA NA NA NA ...
## ..- attr(*, "label")= chr "GDP per capita (constant 2015 US$)"
## $ yrs_schooling: num [1:16532] NA NA NA NA NA NA NA NA NA NA ...
## ..- attr(*, "label")= chr "Barro-Lee: Average years of total schooling, age 15+, total"
## $ iso3c : chr [1:16532] NA NA NA NA ...
## $ region : chr [1:16532] NA NA NA NA ...
## $ capital : chr [1:16532] NA NA NA NA ...
## $ longitude : chr [1:16532] NA NA NA NA ...
## $ latitude : chr [1:16532] NA NA NA NA ...
## $ income : chr [1:16532] NA NA NA NA ...
## $ lending : chr [1:16532] NA NA NA NA ...
library(dplyr)
apply(wdi_data, 2, function(x) sum(is.na(x)))
## iso2c country year inf_mort gdpPercap
## 0 0 0 4587 4447
## yrs_schooling iso3c region capital longitude
## 15236 611 611 611 611
## latitude income lending
## 611 611 611
wdi_data1<-wdi_data%>%
mutate(iso3c=as.character(iso3c),
country=as.character(country),
year=as.numeric(year),
inf_mort=as.numeric(inf_mort),
gdpPerCap=as.numeric(gdpPercap),
yrs_schooling=as.numeric(yrs_schooling),
iso3c=as.character(iso3c),
region=as.factor(region),
capital=as.character(capital),
longitude=as.numeric(longitude),
latitude=as.numeric(latitude),
income=as.factor(income),
lending=as.factor(lending)
)
apply(wdi_data1, 2, function(x) sum(is.na(x))*100.0/length(x))
## iso2c country year inf_mort gdpPercap
## 0.000000 0.000000 0.000000 27.746189 26.899347
## yrs_schooling iso3c region capital longitude
## 92.160658 3.695863 3.695863 3.695863 22.513912
## latitude income lending gdpPerCap
## 22.513912 3.695863 3.695863 26.899347
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.1.2
library(ggpubr)
## Warning: package 'ggpubr' was built under R version 4.1.2
wi3 <- wdi_data1 %>%
group_by(region,year) %>%
summarize(infant_mortality_rate = mean(inf_mort, na.rm = T),
gdpPercap = mean(gdpPercap, na.rm = T),
yrs_schooling = mean(yrs_schooling, na.rm = T))%>%
arrange(desc(infant_mortality_rate))
## `summarise()` has grouped output by 'region'. You can override using the `.groups` argument.
library(zoo)
## Warning: package 'zoo' was built under R version 4.1.2
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
wi3<-na.locf(wi3, option = "locf", na.remaining = "rev")
library(ggplot2)
k2 <- ggplot(wi3, aes(x=year, y=yrs_schooling))+geom_line()+facet_grid(.~region)+theme_minimal() +
theme( axis.text.x = element_text(angle=90),axis.title.y = element_text(size=7, face="bold"),legend.position = "none",strip.text.x = element_blank())+labs(y="Years of Schooling",x="Year")
k3 <- ggplot(wi3, aes(x=year, y=gdpPercap))+geom_line()+facet_grid(.~region)+theme_minimal() +
theme( axis.text.x = element_text(angle=90),axis.title.y = element_text(size=7, face="bold"),legend.position = "none",strip.text.x = element_blank())+labs(y="gdpPercap",x="Year")
k1 <- ggplot(wi3, aes(x=year, y=infant_mortality_rate))+geom_line()+facet_grid(.~region)+theme_minimal()+
theme(plot.title = element_text(face = "bold",hjust = 0.5),axis.title.y = element_text(size=7, face="bold"),strip.text.x = element_text(size = 5,face="bold"),axis.title.x = element_blank(), axis.text.x = element_blank(),legend.position = "none")+
labs(title = "Health Indicators Patterns in 6 Regions")
library(ggpubr)
figure <- ggarrange(k1, k3, k2,ncol = 1, nrow = 3)
figure
wi4 <- select(wdi_data1, c("region","gdpPerCap","inf_mort","year","longitude","latitude"))
wi5 <- wi4 %>%
filter(year==2019)
wi5<-na.omit(wi5)
library(leaflet)
## Warning: package 'leaflet' was built under R version 4.1.2
pal <- colorNumeric(palette = "Reds", domain = c(10:1000), reverse = FALSE)
leaflet(wi5) %>%
addProviderTiles(provider = "CartoDB.Positron") %>%
addCircleMarkers(weight=1,radius=~sqrt(gdpPerCap)/1000,popup = ~region,
color=~pal(inf_mort))%>%
addLegend(title = "IMR", pal = pal, values = c(1:100),
position = "bottomright") %>%
setView(lng = wi5$longitude[40], lat = wi5$latitude[40], zoom = 1.2)
## Warning in pal(c(r[1], cuts, r[2])): Some values were outside the color scale
## and will be treated as NA
## Assuming "longitude" and "latitude" are longitude and latitude, respectively
## Warning in pal(inf_mort): Some values were outside the color scale and will be
## treated as NA
## Warning in pal(inf_mort): Some values were outside the color scale and will be
## treated as NA
wi6 <- wi4 %>%
filter(year==1960)
wi6<-na.omit(wi6)
library(leaflet)
pal <- colorNumeric(palette = "Reds", domain = c(10:500), reverse = FALSE)
leaflet(wi6) %>%
addProviderTiles(provider = "CartoDB.Positron") %>%
addCircleMarkers(weight=1,radius=~(gdpPerCap)/1000,popup = ~region,
color=~pal(inf_mort))%>%
addLegend(title = "IMR", pal = pal, values = c(1:100),
position = "bottomright") %>%
setView(lng = wi6$longitude[40], lat = wi6$latitude[40], zoom = 1.2)
## Warning in pal(c(r[1], cuts, r[2])): Some values were outside the color scale
## and will be treated as NA
## Assuming "longitude" and "latitude" are longitude and latitude, respectively