Taxes, Health, GDP: Understanding the Connection
1. Introduction
1.1 Overview and Motivations
Health has become a major concern in the past years, with lots of new resources and information available nowadays. More than ever, we are confronted everyday with choices to be made whether buying drinks or buying food for lunch. Furthermore, the variety of this type of product has exploded and has been growing for many years and this is not going to stop in a society that pushes consumption and opulence. We have a rough idea of what is “healthy” and what is “unhealthy”, but can we see patterns across countries?
As far as our personal motivations behind this research, is our shared interest in health from various aspects such as sports performance or just having a healthy lifestyle to better our lives. This merged with our current curriculum in HEC makes our team motivated to find economic links to health in various sectors.
Past papers have been written linking an individual’s health to his personal wealth, and the possible correlation these two have onto each other:
https://www.sciencedirect.com/science/article/pii/S0167629603000596 https://core.ac.uk/download/pdf/158607349.pdf
With this project we want to focus on the efforts carried by governments, the policies countries have and the impact these have on the individual. One would think that the more prosperous a country, the healthier than said country would be. This however does not seem to be the case, the United States serves as an example of this contradiction: obesity rates just like their GDP are higher than ever. We want to know what policies have an effect on the wellbeing of the individuals as well as understanding the aftermath of such political measures.
2. Research questions
1. How do taxes on sweet beverages impact the overall health of a country? Is it effective?
2. How do tobacco taxes affect the health of a country? Is taxation on tobacco prolific in correcting consumer behavior?
3. How do financial inequalities compare to health across countries? What are the social and economic consequences?
3. Data Wrangling
3.1 How did we do our data
To have our base data, we had to go on different website to create one with all the information that we wanted. The main websites where we find what we wanted are :
- “Our World in Data” : https://ourworldindata.org
- The “World Health Organization” : https://www.who.int/data
- “The World Bank” : https://data.worldbank.org/
- The “World Health Organization: FCTC”https://untobaccocontrol.org/
3.2 Our World in Data
3.2.1 Number of deaths by risk factor
In the raw dataset, we can find a lot of different risk factors, such as consumption of alcohol, unsafe water, air pollution, and so on around the world (by country) and by year. What we wanted from this data was the country, the year and only the death tolls caused by high blood pressure or by obesity. These risks have been selected to see how malnutrition has an impact on death numbers in different countries. We used brackets to select only the columns that we’re interested in and rename them with the “colnames” function to name them more clearly.
| Country | Period | Total_Death_HB_Pressure | Total_Death_Obesity |
|---|---|---|---|
| Afghanistan | 1990 | 25633 | 9518 |
| Afghanistan | 1991 | 25872 | 9489 |
| Afghanistan | 1992 | 26309 | 9528 |
| Afghanistan | 1993 | 26961 | 9611 |
| Afghanistan | 1994 | 27658 | 9675 |
| Afghanistan | 1995 | 28090 | 9608 |
Code
# 2. Clean the data of the number of deaths by risk factor (df_Number_of_deaths_by_risk_factor)
# 2.1 Keep only the necessary columns
df_Number_of_deaths_by_risk_factor <- df_Number_of_deaths_by_risk_factor[, c(1, 3, 4, 20)]
# 2.2 Rename the columns
colnames(df_Number_of_deaths_by_risk_factor)[c(1, 2, 3, 4)] <- c("Country", "Period", "Total_Death_HB_Pressure", "Total_Death_Obesity")
#2.3 Round the 2 ast column value as integer
df_Number_of_deaths_by_risk_factor <- df_Number_of_deaths_by_risk_factor %>%
mutate(across(c(Total_Death_HB_Pressure, Total_Death_Obesity), round))3.2.2 Life Expectancy
We wanted to have information on life expectancy around the world. In the row dataset, female and male are separated, we wanted to have only one column representing the whole population. We had to use the mutate function to select the male and female column per year and divided them by 2. Finally, we removed the unnecessary columns to keep only the country, the period and the life expectancy.
| Country | Period | Life_Expectancy |
|---|---|---|
| Afghanistan | 1950 | 27.75 |
| Afghanistan | 1951 | 28.00 |
| Afghanistan | 1952 | 28.45 |
| Afghanistan | 1953 | 28.95 |
| Afghanistan | 1954 | 29.25 |
| Afghanistan | 1955 | 29.95 |
Code
#3. Clean the data of the Life expectancy (df_Life_Expectancy_Final)
#3.1 Keep only the necessary columns
df_Life_Expectancy_Final <- df_Life_Expectancy_Final[,c(1,3,4,5)]
#3.2 Suppress the sex distinction
colnames(df_Life_Expectancy_Final)[3] <- "Male_LifeExpectancy"
colnames(df_Life_Expectancy_Final)[4] <- "Female_LifeExpectancy"
df_Life_Expectancy_Final <- df_Life_Expectancy_Final %>%
mutate(final_value = (df_Life_Expectancy_Final$Male_LifeExpectancy + df_Life_Expectancy_Final$Female_LifeExpectancy) / 2)
df_Life_Expectancy_Final <- df_Life_Expectancy_Final[,c(1,2,5)]
#3.3 Rename the columns
colnames(df_Life_Expectancy_Final)[1] <- "Country"
colnames(df_Life_Expectancy_Final)[2] <- "Period"
colnames(df_Life_Expectancy_Final)[3] <- "Life_Expectancy"3.2.3 Death rate from diabetes, malnutrition and liver disease
We wanted to have a rate encompassing several diseases linked with a poor diet and bad eating habits. All these datasets were structured the same way, but on different pages of the website. To tidy the data, we used the same logic for the four different datasets. We remove the unnecessary column which is the country code (for example, Switzerland is CHE) and we rename the columns to have all the information we need with the same syntax.
| Country | Period | Death_Diabetes |
|---|---|---|
| Afghanistan | 1990 | 30.93 |
| Afghanistan | 1991 | 30.37 |
| Afghanistan | 1992 | 29.84 |
| Afghanistan | 1993 | 29.65 |
| Afghanistan | 1994 | 29.62 |
| Afghanistan | 1995 | 29.45 |
| Country | Period | Death_Malnutrition |
|---|---|---|
| Afghanistan | 1990 | 11.04 |
| Afghanistan | 1991 | 9.93 |
| Afghanistan | 1992 | 9.34 |
| Afghanistan | 1993 | 9.75 |
| Afghanistan | 1994 | 10.13 |
| Afghanistan | 1995 | 9.92 |
| Country | Period | Death_Liver_disease |
|---|---|---|
| Afghanistan | 1990 | 2673 |
| Afghanistan | 1991 | 2728 |
| Afghanistan | 1992 | 2830 |
| Afghanistan | 1993 | 2943 |
| Afghanistan | 1994 | 3027 |
| Afghanistan | 1995 | 3076 |
Code
#5. Clean the data of the diabetes (df_Death_rate_from_diabetes)
#5.1 Keep only the necessary columns
df_Death_rate_from_diabetes <- df_Death_rate_from_diabetes[,c(1,3,4)]
#5.2 Rename the columns
colnames(df_Death_rate_from_diabetes)[c(1,2,3)] <- c("Country", "Period", "Death_Diabetes")
#6. Clean the data of the Malnutrition death rate (df_Malnutrition_death_rate)
#6.1 Keep only the necessary columns
df_Malnutrition_death_rate <- df_Malnutrition_death_rate[,c(1,3,4)]
#6.2 Rename the columns
colnames(df_Malnutrition_death_rate)[c(1,2,3)] <- c("Country", "Period", "Death_Malnutrition")
#7. Clean the data of the Liver disease death rate (df_Liver_Disease_death_rate)
#7.1 Keep only the necessary columns
df_Liver_Disease_death_rate <- df_Liver_Disease_death_rate[,c(1,3,4)]
#7.2 Rename the columns
colnames(df_Liver_Disease_death_rate)[c(1,2,3)] <- c("Country", "Period", "Death_Liver_disease")3.2.5 Rate of the infantile mortality
The infantile mortality can be linked to the health of a country’s population, it’s what we funded in this article. This article is trying to link various health factor(for example nutrition) to the child mortality. As before, we selected the columns of interest and rename them.
| Country | Period | Infantile_Mortality |
|---|---|---|
| Afghanistan | 1957 | 37.59054 |
| Afghanistan | 1958 | 36.96284 |
| Afghanistan | 1959 | 36.34375 |
| Afghanistan | 1960 | 35.73006 |
| Afghanistan | 1961 | 35.16583 |
| Afghanistan | 1962 | 34.58399 |
Code
#9. Clean the data of the Death rate from digestive diseases (df_Death_rate_from_digestive_diseases)
#9.1 Keep only the necessary columns
df_Death_rate_from_digestive_diseases <- df_Death_rate_from_digestive_diseases[,c(1,3,4)]
#9.2 Rename the columns
colnames(df_Death_rate_from_digestive_diseases)[c(1,2,3)] <- c("Country", "Period", "Death_Digestive_Diseases")3.2.6 Tobacco consumption
For our second research question we needed the data concerning the consumption of tobacco by country and its evolution by year. The raw dataset was pretty clean, we only had to remove the column containing the country, normalise the code and rename our different column.
| Country | Period | Tobacco_Consumption |
|---|---|---|
| Afghanistan | 2000 | 36.9 |
| Afghanistan | 2005 | 32.7 |
| Afghanistan | 2010 | 29.1 |
| Afghanistan | 2015 | 26.0 |
| Afghanistan | 2018 | 23.8 |
| Afghanistan | 2019 | 23.8 |
3.2.7 Death rate due to tobacco
We also needed to know tobacco’s death toll in the world. This dataset was also pretty clean, we computed the same operation as before, removing one column and renaming it to match our needs.
| Country | Period | Percentage_Death_From_Smoking |
|---|---|---|
| Afghanistan | 1990 | 4.018696 |
| Afghanistan | 1991 | 4.070636 |
| Afghanistan | 1992 | 4.180628 |
| Afghanistan | 1993 | 4.213862 |
| Afghanistan | 1994 | 4.160192 |
| Afghanistan | 1995 | 4.232945 |
Code
#1 Cleaning the data of the death rate from smoking by country
# 1.1 Keep only necessary columns
df_Death_From_Smoking_By_Country <- df_Death_From_Smoking_By_Country[,-c(2)]
# 1.2 Rename the columns
colnames(df_Death_From_Smoking_By_Country)[c(1,2,3)] <- c("Country", "Period", "Percentage_Death_From_Smoking")3.2.8 Taxes on tobacco
Our question relies mainly on the tax’s potential effect on our different factors. So we also needed the data regarding tax on tobacco products. In the end we have a column containing the tax force by country. A number going from 1 to 5 which indicates the importance of this tax. 1 is less than 10% tax, 2 is between 10 to 25%. 3 is from 26 to 50%,4 is from 51 to 75%,and 5 is for taxes above 75%. The raw dataset were also pretty clean, we only computed simple operations to transform them as we wanted.
| Country | Period | Percentage_Death_From_Smoking |
|---|---|---|
| Afghanistan | 1990 | 4.018696 |
| Afghanistan | 1991 | 4.070636 |
| Afghanistan | 1992 | 4.180628 |
| Afghanistan | 1993 | 4.213862 |
| Afghanistan | 1994 | 4.160192 |
| Afghanistan | 1995 | 4.232945 |
3.2.9 Banning advertising on tobacco
To add a control variable and another dimension to our analysis we choose to include the data about the banning of tobacco advertisements. The raw dataset was a bit more disorganised, we had to change all our column names, proceed to a pivot longer to have our year as row attributed in a new column period. Finally, we removed all the lacking values.
| Country | Period | Advertising_Banned |
|---|---|---|
| Afghanistan | 2020 | No |
| Afghanistan | 2018 | Yes |
| Afghanistan | 2016 | Yes |
| Algeria | 2020 | Yes |
| Algeria | 2018 | Yes |
| Algeria | 2016 | Yes |
Code
#4 Cleaning the banning advertising on tobacco by country
#4.1 Renaming the columns
colnames(df_Banning_Advertising_On_Tobacco)[1] <- "Country"
colnames(df_Banning_Advertising_On_Tobacco)[2] <- "2020"
colnames(df_Banning_Advertising_On_Tobacco)[3] <- "2018"
colnames(df_Banning_Advertising_On_Tobacco)[4] <- "2016"
#4.2 Pivot longer to have our year by row in a new column Period
df_Banning_Advertising_On_Tobacco <- pivot_longer(df_Banning_Advertising_On_Tobacco, cols = starts_with("20"), names_to = "Period", values_to = "Advertising_Banned")
#4.3 Removing value with no interest for us
df_Banning_Advertising_On_Tobacco <- df_Banning_Advertising_On_Tobacco %>%
filter(df_Banning_Advertising_On_Tobacco$Advertising_Banned != "Answer not provided" & df_Banning_Advertising_On_Tobacco$Advertising_Banned != "Report not provided" )3.2.10 Gini Coefficient
For our third research question, we needed an indicator representing the inequalities within a population. We choose the Gini index as it encompasses inequality through a variety of environments (income, wealth and consumption) which allows us to understand and analyse our data more thoroughly. The raw dataset was quiet messy.We first needed to remove unuseful rows. We started by deleting the first 3 rows and used the fourth as the headline for our columns. We also dropped unnecessary columns. We renamed our main columns, using the function gather to pivot our date as rows. Finally we had to remove potential missing values and transform our values for the Gini coefficient as numeric ones.
| Country | Period | Gini_Index |
|---|---|---|
| United States | 1963 | 37.6 |
| United States | 1964 | 38.1 |
| United States | 1965 | 37.5 |
| United States | 1966 | 37.8 |
| United States | 1967 | 36.9 |
| United Kingdom | 1968 | 26.8 |
Code
#1 Cleaning the Gini Index dataframe
#1.1 Suppress unnecessary rows
df_Gini_Index <- df_Gini_Index[-c(1, 2), ]
#1.2 Use the thrid line as headline
colnames(df_Gini_Index) <- as.character(unlist(df_Gini_Index[1,]))
#1.3 Delete the row use now use as colnames
df_Gini_Index <- df_Gini_Index[-1, ]
#1.4 Keep the necessary column
df_Gini_Index <- df_Gini_Index[,-c(2:4)]
#1.5 Rename the column country
colnames(df_Gini_Index)[1] <- "Country"
#1.5 Use the gather function to pivot the data as long to remove the year as column
df_Gini_Index <- gather(df_Gini_Index, key = "Period", value = "Gini_Index", -Country)
# 1.6 Delete all the lines that have no value
df_Gini_Index <- df_Gini_Index %>% filter(df_Gini_Index$Gini_Index != "")
#1.7 Transfrom the value as numeric ones
df_Gini_Index$Gini_Index <- as.numeric(gsub(",", ".", df_Gini_Index$Gini_Index))3.3 World Health Organization
3.3.1 Taxes about sweetened beverages
For our first research question, we needed the data of countries which have implemented or not taxes on sweetened beverages. We found a raw dataset set which indicates whether a country has implemented taxes or not. We have data for 3 different years : 2017, 2019 and 2021. But we also added the additional year of 2013 as the first implementation of taxes on sweetened beverages started in 2014. The year 2013 adds value to our regression as no country has yet implemented any kind of tax. We also had to filter our data to remove missing values, such as “No response” or “Don’t know”. We also change our value of taxes from “Yes” and “No” to boolean values such as 1 for “Yes” and 0 for other values (that is all “No”). Our work was not finished, we wanted to use the package map to display interactive maps, and match our country name to the country name of the package map. This is because our data didn’t use the normalised names.
| Country | Period | Country Period | Tax_Sweetened_beverages |
|---|---|---|---|
| Algeria | 2021 | Algeria.2021 | 0 |
| Andorra | 2021 | Andorra.2021 | 0 |
| Angola | 2021 | Angola.2021 | 0 |
| Antigua and Barbuda | 2021 | Antigua and Barbuda.2021 | 0 |
| Armenia | 2021 | Armenia.2021 | 0 |
| Australia | 2021 | Australia.2021 | 0 |
Code
#1. Clean the data of the tax on sweetened beverages (df_Tax_Sweetened_Beverages)
#1.1 Keep only the necessary columns
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages[,c(8,10,30)]
#1.2 Keep only the necessary rows, Filtering the data that contain the value "Don't know" or "No response"
df_intermediate <- filter(df_Tax_Sweetened_Beverages,df_Tax_Sweetened_Beverages$Value =="Don't know"| df_Tax_Sweetened_Beverages$Value =="No response")
df_Tax_Sweetened_Beverages <- anti_join(df_Tax_Sweetened_Beverages, df_intermediate, by = "Location")
#1.3 Add the values for the year 2013
#1.3.1 Create a vector that contain each country present in the data
unique_vect <- unique(df_Tax_Sweetened_Beverages$Location)
#1.3.2 Loop to add the tax on sweetened beverage for each country
for (i in unique_vect) {
nouvelle_ligne <- data.frame(
Location = i,
Period = 2013,
Value = "No")
df_Tax_Sweetened_Beverages <- rbind(df_Tax_Sweetened_Beverages, nouvelle_ligne)
}
#1.4 Rename the columns
colnames(df_Tax_Sweetened_Beverages)[c(1,2,3)] <- c("Country", "Period", "Tax_Sweetened_beverages")
#1.5 Put boolean variables (if there's a tax -> 1 , if not -> 0)
df_Tax_Sweetened_Beverages$Tax_Sweetened_beverages <- ifelse(df_Tax_Sweetened_Beverages$Tax_Sweetened_beverages == "Yes", 1, 0)
#1.6 New variable with the country and the period (Primary Key)
df_Tax_Sweetened_Beverages[4] <- paste(df_Tax_Sweetened_Beverages$Country, df_Tax_Sweetened_Beverages$Period, sep = ".")
colnames(df_Tax_Sweetened_Beverages)[4] <- "Country.Period"
#1.7 Change the order of the columns
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages[, c("Country", "Period", "Country.Period", "Tax_Sweetened_beverages")]
#1.8 Change the country name to match the package map name's country
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages %>%
mutate(Country = ifelse(Country == "Russian Federation", "Russia", Country))
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages %>%
mutate(Country = ifelse(Country == "Bolivia (Plurinational State of)", "Bolivia", Country))
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages %>%
mutate(Country = ifelse(Country == "Venezuela (Bolivarian Republic of)", "Venezuela", Country))
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages %>%
mutate(Country = ifelse(Country == "United Republic of Tanzania", "Tanzania", Country))
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages %>%
mutate(Country = ifelse(Country == "United States of America", "USA", Country))
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages %>%
mutate(Country = ifelse(Country == "United Kingdom of Great Britain and Northern Ireland", "UK:Great Britain", Country))
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages %>%
mutate(Country = ifelse(Country == "Türkiye", "Turkey", Country))
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages %>%
mutate(Country = ifelse(Country == "Democratic People's Republic of Korea", "North Korea", Country))
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages %>%
mutate(Country = ifelse(Country == "Republic of Korea", "South Korea", Country))
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages %>%
mutate(Country = ifelse(Country == "Côte d’Ivoire", "Ivory Coast", Country))
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages %>%
mutate(Country = ifelse(Country == "Viet Nam", "Vietnam", Country))
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages %>%
mutate(Country = ifelse(Country == "Iran (Islamic Republic of)", "Iran", Country))
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages %>%
mutate(Country = ifelse(Country == "Czechia", "Czech Republic", Country))
df_Tax_Sweetened_Beverages <- df_Tax_Sweetened_Beverages %>%
mutate(Country = ifelse(Country == "Republic of Moldova", "Moldova", Country))3.3.2 Probability of dying from a Non-Communicable disease (NCD)
Non-communicable disease are for example the respiratory one or cardiovascular one. We wanted to know the probability of dying of a NCD depending on your country. The raw dataset that we found separated the female, the male and calculate also both sexes, we only wanted both sexes so we had to remove the two other one by using the [] brackets.
| Country | Period | Prob_Dying_NCD | |
|---|---|---|---|
| 1 | Chile | 2019 | 10.04 |
| 5 | New Zealand | 2019 | 10.26 |
| 6 | United Kingdom of Great Britain and Northern Ireland | 2019 | 10.30 |
| 8 | Netherlands | 2019 | 10.35 |
| 10 | Austria | 2019 | 10.37 |
| 14 | Malta | 2019 | 10.53 |
Code
#4. Clean the data of the probability of dying from a Non-Communicable disease [NCD] (df_Proba_Of_Dying_From_NCD)
#4.1 Keep only the necessary columns
df_Proba_Of_Dying_From_NCD <- df_Proba_Of_Dying_From_NCD[,c(8,10,13,24)]
#4.2 Keep only the necessary rows (both sexes,to remove the sex distinction)
df_Proba_Of_Dying_From_NCD <- df_Proba_Of_Dying_From_NCD[df_Proba_Of_Dying_From_NCD$Dim1 == "Both sexes",]
df_Proba_Of_Dying_From_NCD <- df_Proba_Of_Dying_From_NCD[,c(1,2,4)]
#4.3 Rename the columns
colnames(df_Proba_Of_Dying_From_NCD)[c(1,2,3)] <- c("Country", "Period", "Prob_Dying_NCD")3.4 The World Bank
3.4.1 Population
This dataset shows us the population evolution of a country from the 1960’s until today. We had to change the separation marks between the variables with the command ” sep= “;” ” as RStudio couldn’t read it. We put all the years in the same column and all the population in another one with “pivot_longer”. The year, for some reason, had an X in front of them, so we had to remove it with the command “gather”. We also had to convert the population to a numeric value. Finally we also removed the possible missing values.
| Country | Period | Population |
|---|---|---|
| Afghanistan | 2013 | 31541209 |
| Africa Eastern and Southern | 2013 | 567892149 |
| Africa Western and Central | 2013 | 387204553 |
| Albania | 2013 | 2895092 |
| Algeria | 2013 | 38000626 |
| American Samoa | 2013 | 52995 |
Code
#11. Clean the data of Population by country and by year (df_PopByYear)
#11.1 Keep only the necessary columns
df_PopByYear <- df_PopByYear[, -c(2,3,4)]
#11.2 Pivotting the data to get the year as row value in a column named Period
#11.2.1 Use the gather function to pivot the data as long
df_PopByYear <- gather(df_PopByYear, key = "Period", value = "Population", -Country.Name)
#11.2.2 Removing the undesired character in the year
df_PopByYear$Period <- gsub("[^0-9]", "", df_PopByYear$Period)
df_PopByYear$Period <- substr(df_PopByYear$Period, 5, nchar(df_PopByYear$Period))
#11.2.3 Removing potential missing value
df_PopByYear <- subset(df_PopByYear, !is.na(population))
#11.2.4 Convert the population as numeric number
df_PopByYear$Population <- as.numeric(df_PopByYear$Population)
#11.2.3 Rename the name of the column Country.Name to Country
colnames(df_PopByYear)[1] <- "Country"3.4.2 GDP, Health expenditure
The GDP and health expenditure are datasets which respectively show the GDP of a country and its expenditure from 1960 until now. To clean them, we followed the same techniques as Population 3.4.1. We had to add a step as the numbers were in string instead of numeric. The command “as.numeric” helped us with that.
| Country | Period | GDP_by_head | |
|---|---|---|---|
| 2 | Africa Eastern and Southern | 1960 | 162 |
| 3 | Afghanistan | 1960 | 62 |
| 4 | Africa Western and Central | 1960 | 107 |
| 14 | Australia | 1960 | 1811 |
| 15 | Austria | 1960 | 935 |
| 17 | Burundi | 1960 | 71 |
Code
#13. Clean the data GDP by country by year(df_GDP)
#13.1 Keep only the necessary columns
df_GDP <- df_GDP[,-c(2:4)]
#13.2 Rename the column country
colnames(df_GDP)[1] <- "Country"
#13.3 Use the gather function to pivot the data as long to remove the year as column
df_GDP <- gather(df_GDP, key = "Period", value = "GDP_by_head", -Country)
#13.4 Put the value of GDB by head as numeric ones
df_GDP$GDP_by_head <- as.numeric(gsub(",", ".", df_GDP$GDP_by_head))
#13.5 Removing potential missing value
df_GDP <- df_GDP[!is.na(df_GDP$GDP_by_head), ]
#12.6 Use the gsub function to remove the X before the year in the column period
df_GDP$Period <- gsub("X", "", df_GDP$Period)| Country | Period | Health_Expense | |
|---|---|---|---|
| 10642 | Africa Eastern and Southern | 2000 | 5.666276 |
| 10644 | Africa Western and Central | 2000 | 3.753682 |
| 10645 | Angola | 2000 | 1.908599 |
| 10646 | Albania | 2000 | 5.944186 |
| 10647 | Andorra | 2000 | 5.952103 |
| 10648 | Arab World | 2000 | 4.013979 |
Code
#12. Clean the data from Health expense by country and by year (df_Health_Expense_By_Country)
#12.1 Keep only the necessary columns
df_Health_Expense_By_Country <- df_Health_Expense_By_Country[,-c(2:57)]
df_Health_Expense_By_Country <- df_Health_Expense_By_Country[,c(1,2,6,8)]
#12.2 Rename the column country
colnames(df_Health_Expense_By_Country)[1] <- "Country"
#12.3 Use the gather function to pivot the data as long to remove the year as column
df_Health_Expense_By_Country <- gather(df_Health_Expense_By_Country, key = "Period", value = "Health_Expense", -Country)
#12.3 Use the gsub function to remove the X before the year in the column period
df_Health_Expense_By_Country$Period <- gsub("X", "", df_Health_Expense_By_Country$Period)
#12.4 Put the value of Health expense as numeric ones
df_Health_Expense_By_Country$Health_Expense <- as.numeric(gsub(",", ".", df_Health_Expense_By_Country$Health_Expense))
#12.5 Removing potential missing value
df_Health_Expense_By_Country <- subset(df_Health_Expense_By_Country, !is.na(Health_Expense))3.5 Final dataset
Finally we selected every dataset we needed and merged them all together to have our final base dataset. Since we named every column the same way, the command merge did what we wanted. Some final changes have been made like modifying the values of the death due to obesity and high blood pressure in rates instead of absolute value. Also, we removed the NA values that were present. These values came from the fact that GDP or Health expenditure data wasn’t collected every year in some countries. We also needed to calculate 2 new variables, as all of our death rate is in ‰ we transformed the absolute value of death number for High blood Pressure and obesity to rate value ‰.
Code
#####################################
## Merging the dataframes together ##
#####################################
df_merge <- merge(x=df_Tax_Sweetened_Beverages,y=df_Number_of_deaths_by_risk_factor,by=c("Country","Period"))
df_merge <- merge(x=df_merge,y=df_Life_Expectancy_Final,by=c("Country","Period"))
df_merge <- merge(x=df_merge,y=df_Proba_Of_Dying_From_NCD,by=c("Country","Period"))
df_merge <- merge(x=df_merge,y=df_Death_rate_from_diabetes,by=c("Country","Period"))
df_merge <- merge(x=df_merge,y=df_Malnutrition_death_rate,by=c("Country","Period"))
df_merge <- merge(x=df_merge,y=df_Liver_Disease_death_rate,by=c("Country","Period"))
df_merge <- merge(x=df_merge,y=df_Share_of_population_with_cancer,by=c("Country","Period"))
df_merge <- merge(x=df_merge,y=df_Death_rate_from_digestive_diseases,by=c("Country","Period"))
df_merge <- merge(x=df_merge,y=df_Child_Mortality_Rate,by=c("Country","Period"))
df_merge <- merge(x=df_merge,y=df_PopByYear,by=c("Country","Period"))
df_merge <- merge(x=df_merge,y=df_GDP,by=c("Country","Period"))
df_merge <- merge(x=df_merge,y=df_Health_Expense_By_Country,by=c("Country","Period"))
#1. Modify columns to have a rate rather than an absolute value for high blood pressure death and obesity death
df_merge <- df_merge %>%
mutate(
Death_Obesity = (Total_Death_Obesity/as.numeric(Population)*100000),
Death_HBP = (Total_Death_HB_Pressure/as.numeric(Population)*100000)
) %>%
select(-Total_Death_Obesity, -Total_Death_HB_Pressure)4. Exploratory Data Analysis
4.1 Exploratory Data Analysis for health data
4.1.1 Countries classify by GDP
Firstly, we collected data to create four separate classes based on GDP. The data stems from the World Bank and is compared through three different years to evaluate the evolution of the different countries. We ranked the four classes by quartile such as Q1 is the 25% of countries with the lowest GDP per capita. We used GDP per capita as this is a better metric to measure wealth across countries as this measures the baskets of goods one person can buy in a country compared to another one. (1) We first downloaded the CSV dataset and uploaded it on R. (2) After checking for missing values, we cleaned up the dataset to leave the countries that had values. (3) Using the function we ordered the countries in four distinct parts: Low income, Medium low income, Medium high income, High income.
Code
# Graph of the Class distribution
# Define the color palette
palette_bleus <- colorRampPalette(c("#E0F3F8", "#99C2D5", "#66A2D5", "#2C7BB6"))(4)
# Create the bar plot with adjusted colors, thicker bars, and more space
Class_Repartition <- ggplot(df_2019, aes(x = Classe, fill = Classe)) +
geom_bar(color = "black", size = 0.5, width = 0.7) + # Adjust width for thicker bars
scale_fill_manual(
values = palette_bleus,
breaks = unique(df_2019$Classe),
labels = unique(df_2019$Classe),
name = "Class" # Set the legend title
) +
labs(
title = "Distribution of country by Class for the year 2019",
x = "Class", # Set the x-axis label
y = "Number of countries"
) +
theme_minimal()4.1.2 Our data on an interactive map
We also desired to design an interactive map to visualise different data per country. Here we can see the Countries which have implemented taxes for 2017 in green and the ones which have not in red. We can also access the data of population, GDP and category of each country by clicking on it.
Code
# Data transforming
df_Tax_Sweetened_Beverages_Map <- df_merge
df_Tax_Sweetened_Beverages_Map$Tax_Sweetened_beverages <- ifelse(df_merge$Tax_Sweetened_beverages == "1", "Taxes", "No Taxes")
Tax_on_sweetened_beverages <- filter(df_Tax_Sweetened_Beverages_Map, Period == "2017") %>% arrange()
# Get data from our package
world <- ne_countries(returnclass = "sf")
#Rename the column for the merge
colnames(world)[10] <- "Country"
# Join our data
world_data <- merge(x=world,y=Tax_on_sweetened_beverages,by="Country")
# Set a color palette
color_pal <- colorFactor(c("red", "green"), domain = c("Taxes", "No Taxes"))
# Create the interactive map
inter_graph <- leaflet(world_data) %>%
addProviderTiles(providers$OpenStreetMap.Mapnik) %>%
addPolygons(color = ~color_pal(world_data$Tax_Sweetened_beverages),
weight = 1,
popup = ~paste("Country: ", name, "<br>", "Tax: ", world_data$Tax_Sweetened_beverages, "<br>", "Population: ", world_data$Population, "<br>","GDP: ", world_data$GDP, "<br>","Classe: ", world_data$Classe, "<br>"),
highlightOptions = highlightOptions(color = "black", weight = 2, bringToFront = TRUE)) %>%
addLegend("bottomright", pal = color_pal, values = unique(world_data$Tax_Sweetened_beverages),
title = "Legend", opacity = 1, labels = unique(world_data$Tax_Sweetened_beverages)) %>%
setView(lng = -39.443407, lat = 35.649315, zoom = 2.4)4.1.3 Health ranking of countries
Next, we had to find elements to indicate health. When trying to find a good health indicator we could not find a relevant health indicator for all countries across our time periods. This is why we chose different indicators to judge the health level of a country. We choose these: Life expectancy at birth, People who contracted cancer, Death rates from malnutrition, Death rates from digestive diseases, Death rate from obesity and Child mortality.
We first evaluated the overall trends in the world regarding these different diseases and death causes.
We can clearly see the impact of COVID as health expenses exploded
What can we conclude from these graphs: Some data seems logical and is not cause of concern, for example the overall life expectancy keeps increasing even though there is a slight dip in 2020, possibly because of COVID. As people get older and the population larger the number of people with cancer keeps increasing even though at a slight decreasing tendency. Child mortality and deaths from malnutrition decreases as countries become more developed. However, two graphs are worth analysing further. First, the death of digestive diseases which has increased since 2013 at a dangerous rate. This might be due to an increase in highly processed food, fast foods and sweet beverages at the international level. Second is the obesity death rate which had a very clear drop and stabilisation as of 2005. This might be due to an increasing awareness of food consumption and increased medical attention to the issue.
4.1.4 Evolution of taxation of sweet beverages
The next graph describes the evolution of taxation of sweet beverages across countries.
The taxation started as of 2013, indicating a recent awareness of this issue. As of today, the evolution of countries that put taxes in place to regulate sweet beverages is constant with a slight increase in 2017. This allows us to legitimise this paper as to corroborate the effectiveness of such taxation in regards to health.
4.2 Exploratory Data Analysis for Tobacco data
4.2.1 Evolution of tobacco consumption
We first looked at the evolution of tobacco consumption over time. We can see a drop from 2000 to 2020 of nearly 10% with a slight plateau in 2018.
4.2.2 Evolution of deaths due to tobacco consumption
We compare the number of deaths due to tobacco consumption and the evolution of tobacco consumption over time.
4.2.3 Evolution of number of country that banned advertising
We compare the number of deaths due to tobacco consumption and the evolution of tobacco consumption over time.
4.2.4 Exploring our data with an interactive map
On this interactive map we can observe the evolution of the tax percentage on tobacco products around the world as well as compare the evolution of prices over time.
By analyzing parts of the world, we can note that Europe taxes tobacco the heaviest (>75%). America follows with on average 50%-75% taxes. Asia has on average low taxes on tobacco (25%-50%). The continent which taxes tobacco products the least is Africa.
4.3 Exploratory Data Analysis about inequalities
What are the social and economic consequences? When talking about income inequalities, we often refer to the Gini or Theil index as a measure of wealth distribution across the country.
4.3.1 Gini index over the time
We find interesting to show how wide our data is in terms of time width.. develop
4.3.2 Interactive map
We also find interesting to display our data on an interactive map so we can explore our data intuitively and also seeing how much country we can find in our data.. develop
4.3.3 Gini index by class
We also wanted to approch our data with our past class design, so we ploted our different class with the gini coefficient to see if we were having something to go deeper with
4.3.3 Gini index by class
We also wanted to approch our data with our past class design, so we ploted our different class with the gini coefficient to see if we were having something to go deeper with… develop
4.3.4 Gini index regarding life expectancy
We also mixed the gini coefficient regarding the life expectancy to know if we were having something to dig here.
5. Analysis
In order to simplify our analysis, we had the idea to combine all our health data to create one robust indicator of health by country based on our informations. To get started, we needed to normalize our data, we started by sorting our interest columns in our main data frame and then computing the normalization. Then, we had to add weight on this indicator,as we can imagine the life expectancy of a country is probably more describing the health of the population than the Death rate form high blood pressure issue. We based our weight on some study ….. than allow us to estimate how our data was representative of the good health of a Country’s population.
A voir si possible,sinon ça dégage
5.1 Anylsis of taxes on sweetened beverages
5.1.1 Influence of a country’s GDP on life expectancy
For us it was interesting to see how can potentially impact the GDP on life expectancy Develop..
As we can see, there is clearly a difference ….
5.1.2 Link between GDP and Health expense
For us it was interesting to see how can potentially impact the GDP on the average of health expense Develop..
As we can see, there is clearly a difference, the more country has an high revenue the more the have large health expense….
5.1.3 Influence of a country’s GDP from dying of a NCD
We chose to look at NCDs (non-communicable diseases) as this eliminates outliers where a epidemie would have taken place. We looked at the death rates from NCDs per quartile as described in 2.1.1. We used a box plot for each country to center the observations and eliminate any outlier that could falsely alter the results.
We see a perfect correlation between GDP and deaths by NCDs. Furthermore, we can observe that the two low income groups have a higher spread in the box plot. This indicates that low income countries are more affected by different metrics as just financial means. We will explore some possible reasons later on in this paper.
5.1.4 Taxation per income level
Next we looked at the evolution of taxation between 2017 and 2019 across different income levels. This will allow us to evaluate whether the income level has an influence across time.
In 2017 both low income and high income had a similar number of countries taxing sweet beverages. As of 2019 the differences flatten with similar levels except for low income which is lower. High income had the highest jump, indicating that there was a need for this tax to be put in place in countries of high income.
5.1.5 PCA Analysis
Compléter l’analyse PCA
5.1.6 Correlation Matrix
The correlation matrix permits us to find correlation between our different variables. The color scale allows us to find the intensity of correlation or negative correlation.
First, we can confirm important theories. Correlation between Life expectancy and Infantile death rate, malnutrition death rate, deaths from NCDs are - ≥ 0.8. However the correlation is much lower between Life expectancy and Diabetes death rate where correlation is -0.4 which indicates that having diabetes is not strongly linked to a lower life expectancy. We can confirm the importance of high GDP per capita for a country’s life expectancy and deaths by NCDs. The correlation between GDP per head and Probability of dying of an NCD is -0.6. The correlation between GDP per head and Life expectancy is 0.7. This results explains that GDP per capita is responsible for a high life expectancy and a lower probability of dying of an NCD. Looking at known correlation between types of deaths we can understand some mechanics of roles of different variables. The correlation between Infantile death rate and Deaths from malnutrition is 0.7. The correlation between GDP per head and infantile death rate is -0.6. With these results we can observe that infantile death is positively correlated to the death rate of malnutrition which is negatively correlated to GDP per capita. This allows us to say that a country with a higher GDP per capita will have fewer deaths by malnutrition and thus implicating a lower infancy death rate. Finally we observe the link between obesity and deaths due to high blood pressure which is one consequence from obesity. The correlation between death rate of obesity and death rate from high blood pressure is 0.9 which confirms known consequences of obesity.
5.1.7 Predictive modeling
We built a predictive model to estimate whether a country taxes sweet beverages by regressing linearly on different health variables. We split our dataset in two, the first slice tests the predictability of the model and the second tests its robustness.
Développer….
| Coefficient | Std.Error | Significance | |
|---|---|---|---|
| (Intercept) | -1.2211558 | 4.4930832 | |
| Life_Expectancy | 0.0283840 | 0.0600069 | |
| Prob_Dying_NCD | -0.0694532 | 0.0407631 | |
| Death_Diabetes | -0.0069675 | 0.0087481 | |
| Death_Malnutrition | -0.0128537 | 0.0389472 | |
| Percentage_Cancer | -0.1009544 | 0.0761472 | |
| Death_Digestive_Diseases | 0.0195329 | 0.0149583 | |
| Health_Expense | -0.0676127 | 0.0815441 | |
| Death_Obesity | 0.0276016 | 0.0109494 | * |
| Death_HBP | -0.0145828 | 0.0059231 | * |
| ClasseMedium-low Income | 0.4601166 | 0.5992096 | |
| ClasseMedium Income | -0.5336966 | 0.6951920 | |
| ClasseHigh Income | -0.7970685 | 0.8786606 |
| Réalité | Positif | Négatif |
|---|---|---|
| Positif | 4 | 24 |
| Négatif | 6 | 87 |
5.2 Anylsis of taxes effect on Tobacco consumption
5.2.1 Tobacco consumption compared to GDP per capita
We will now take a look at the consumption of tobacco compared to GDP per capita over three time years which are 2015, 2018 and 2020.
The two variables Tobacco consumption and GDP per capita are slightly positively correlated. However, in the data we find two outliers that might be flashing these results. Monaco and Luxembourg are two very small countries that seem to be outliers. As their population is small compared to the global population we will omit their results in order to find a clearer correlation in the world population.
When we omit Luxembourg and Monaco we find the following results:
The results do not change significantly. The correlation between the two still correlates only slightly positively. This indicates that the habit of tobacco consumption is not a function of purchasing power. We can suggest that tobacco consumption is caused by cultural and social differences between countries and not from income differences.
5.2.2 Taxation of tobacco as a function of GDP
We now look at the correlation between taxation of tobacco and GDP per head.
There is a positive correlation between these two variables in 2014 and 2018. There are no major changes between these two dates. This allows us to state that the higher the GDP per capita in a country, the higher the taxes on tobacco products.
5.2.3 Deaths from tobacco consumption to GDP Across 2014, 2018 and 2020
There is a positive correlation between Deaths from tobacco and GDP by head.
5.2.4 Correlation matrix between our variable about tobacco and health data
We decided to analyse the correlation between our variables
5.2.5 Compare mortality based on the advertising banning
We found interesting to see if there is difference on country/contient on mortality compared to the banishment of advertising
5.2.6 Compare mortality based on the taxation level
add text
then we wanted to see if there were difference in time..developp
what we can conclude ….
5.3.2 Correlation matrix - with Gini coefficient
6. Discussion
6.1 Conclusion
6.2 Limitations
6.2.1 Availability and quality of Data
Securing access to comprehensive and relevant datasets proved to be a significant hurdle. Despite meticulous planning and defined project scopes, locating datasets that encompassed all necessary variables was a formidable challenge. The intricacies stemmed from data silos, disparate sources, and proprietary constraints, limiting the accessibility to a consolidated and holistic dataset.
In a landscape where the data ecosystem is often fragmented, the endeavor to aggregate, clean, and align datasets from diverse origins demanded extensive effort. Navigating through data repositories, APIs, and collaboration with data providers became imperative to bridge gaps in the availability of essential information.
Even when datasets were procured, ensuring their quality emerged as an intricate task. The inherent variability in data formats, missing values, outliers, and inconsistencies posed formidable obstacles. Robust data cleaning processes became indispensable to enhance the reliability and accuracy of subsequent analyses.
Quality assessment tools, anomaly detection algorithms, and domain-specific knowledge were leveraged to identify and rectify discrepancies within the datasets. This phase involved iterative cycles of validation, cleaning, and refinement to align the data with the requisite standards for robust analytical modeling.
6.2.2 No data on sweetened beverages consumption
The quest for information on sugary beverage consumption posed intricate hurdles, primarily stemming from the unavailability of dedicated datasets or repositories addressing this specific domain. The scarcity of centralized databases capturing detailed and up-to-date information on the consumption patterns of sugary drinks presented a substantial impediment to the research endeavor.
6.2.3 Challenges in Establishing Causality Amidst Multifactorial Dynamics
The complexities arose from the daunting task of discerning the most pertinent variables from a multitude of potential influencers, a task exacerbated by the intricate nature of the subject matter. This narrative elucidates the difficulties faced in making informed choices among a plethora of factors, a conundrum that significantly hindered the establishment of robust causal relationships.
The enormity of our analytical landscape demanded meticulous consideration of numerous factors, each purportedly wielding an influence on the phenomena under investigation. From the outset, the challenge lay in the judicious selection of variables that held substantive relevance to the research question. Despite an exhaustive review of diverse studies and an extensive exploration of the existing literature, the conundrum persisted, rendering the task of isolating salient factors a formidable endeavor.
The intricacy of the multifactorial landscape was further compounded by the dynamic nature of the data, requiring a nuanced understanding of temporal trends and contextual fluctuations. The plethora of potential confounders, moderators, and mediators introduced layers of complexity that made it arduous to disentangle the true drivers of the observed phenomena.
While literature reviews and empirical studies provided invaluable insights into the relationships among various factors, the inherent limitations of observational studies and the challenges of establishing causality in complex systems became apparent. The interplay of numerous covariates and the potential for confounding variables presented hurdles in establishing a causal link between our variables of interest.
Navigating this intricate terrain required a delicate balance between theoretical understanding, statistical rigor, and domain expertise. Despite employing sophisticated statistical techniques and leveraging advanced modeling approaches, the elusive quest for clear causal pathways persisted. Sensitivity analyses and robustness checks were conducted diligently, yet the underlying complexity of the system thwarted endeavors to isolate causal effects definitively.
- Impossible de generalisé l’analyse
- Conclusion abusives
6.3 Proposition for future work
- Possibilité d’utilisé des données sur la santé dentaire pour voir si une reduction de la conso des boissons sucrée a une incidence
Reference List (“GDP per capita (current US\() | Data”) Work Cited “GDP per capita (current US\)) | Data.” World Bank Data, https://data.worldbank.org/indicator/NY.GDP.PCAP.CD. Accessed 15 November 2023.
```{r child = c(‘intro.qmd’, ‘data.qmd’, ‘eda.qmd’, ‘analysis.qmd’, ‘concl.qmd’)}