knitr::opts_chunk$set(warning = FALSE, message = FALSE)
library(tidyverse)
library(ggplot2)
library(countrycode)
library(ggmap)
library(ggthemes)
library(gganimate)
library(gifski)
library(readxl)
library(plotly)
library(lubridate)
mentalhealth <- read_csv('mental_health.csv', n_max = 6468)
world_map <- map_data("world")
Since the start of the pandemic, there has been a lot more focus on mental health. Across the world, depression and anxiety rates climbed 25% according to the World Health Organization. But, how depressed and anxious was the world before Covid-19? How do these rates vary across time and geography? Our data set, downloaded from Kaggle and scraped from the 2017 Global Burden of Disease Study will help us answer these questions. The data set includes annual prevalence rates of seven mental illnesses, such as bipolar disorder, depression and anxiety, across every country/region in the world. In addition, the data set includes suicide rates and a population variable. Rather than analyze the data for all seven mental illnesses, our group focuses on depression and anxiety rates because, as college students, we are most exposed to these mental illnesses. We break our visuals into four categories. First, we look at how global depression rates have changed over time. Then, we investigate the relationship between depression and suicide rates. We then compare global depression and anxiety rates over time before concluding with a more regional focus on anxiety rates.
# Data Cleaning
mentalhealthcountries <- mentalhealth %>%
na.omit(Code) # remove all non-countries
mentalhealth$continent <- countrycode(sourcevar = mentalhealth$Entity,
origin = 'country.name',
destination = 'continent') # add a continent variable for each country
# Differentiate between North and South America manually
NAmer <- c("Antigua and Barbuda", "Bahamas", "Barbados", "Belize", "Bermuda", "Canada", "Costa Rica", "Cuba", "Dominica",
"Dominican Republic", "El Salvador", "Greenland", "Grenada", "Guatemala", "Haiti", "Honduras", "Jamaica", "Mexico",
"Nicaragua", "Panama", "Puerto Rico", "Saint Lucia", "Saint Vincent and the Grenadines", "Trinidad and Tobago",
"United States", "United States Virgin Islands") # list of North American countries
SAmer <- c("Argentina", "Bolivia", "Brazil", "Chile", "Colombia", "Ecuador", "Guyana", "Paraguay", "Peru", "Suriname",
"Uruguay", "Venezuela") # list of South American countries
mentalhealth <- mentalhealth %>% # add continent names to N and S America
mutate(continent = if_else(Entity %in% NAmer, 'North America', continent)) %>%
mutate(continent = if_else(Entity %in% SAmer, 'South America', continent))
mentalhealthregions <- mentalhealth %>% # list of included regions in original dataset
filter(Entity %in% c("Andean Latin America", "Australasia", "Caribbean", "Central Asia", "Central Europe", "Central Latin America", "Central Sub-Saharan Africa", "East Asia", "Eastern Europe", "Eastern Sub-Saharan Africa", "Latin America and Caribbean", "North Africa and Middle East", "North America", "Oceania", "South Asia", "Southeast Asia", "Southeast Asia, East Asia, and Oceania", "Southern Latin America", "Southern Sub-Saharan Africa", "Sub-Saharan Africa", "Tropical Latin America", "Western Europe", "Western Sub-Saharan Africa"))
As mentioned above, depression is currently a global health crisis, but how has it changed over time pre-pandemic? Has the global population become more depressed? Are certain regions more affected than others? Figures 1 and 2 explore these questions.
Figure 1 shows the total depression rate for each country over time. We can see that there is not a lot of change. Greenland consistently has the highest depression rates, while Latin America has low depression rates compared to the rest of the world. Overall, depression rates increase over time, but only slightly. The categories are large, though, and can obscure smaller changes. Figure 2 shows changes in depression rates for each year between 1990-2017. Red indicates an increase in depression rates in a country, while green represents decreases in depression rates. While many countries stay fairly consistent, Brazil experiences a large increase in depression rates between 1997-2000 followed by a large decrease between 2006-2010. There is not a clear trend over time, prompting further investigation.
Our first graphic uses a map to compare depression rates over time. While this graphic type shows a larger scale, the second graphic makes it easier to see relationships for smaller countries. For example, the map clearly highlights the high depression rates in Greenland and the U.S., but obscures that relationship for small countries like Lesotho and Papua New Guinea. In addition, the second graphic helps answer a more specific question: What relationship, if any, is there between depression and suicide rates. Though many suicidal people experience depression, depression rates, as shown in Figure 2, are a poor predictor of a country’s suicide rate. This could be due to low depression diagnosis rates and/or cultural attitudes about depression and suicide. Surprisingly, eight of the ten countries with high depression rates have comparably low suicide rates. Again, this may reflect higher diagnostic rates and/or better access to mental health services. Researchers who want to identify the relationship between depression and suicide should look more closely at who and how diagnoses are being made.
# Nicole
cont_data <- mentalhealth %>% rename(Continent = continent) %>% filter(!is.na(Continent)) # Changing continent column to capital C
cont_colors <- c(Africa = "#01981E", Asia = "#C00502", `North America` = "#F46A00", `South America` = "#F1CA00", Oceania = "#00A5C4", Europe = "#AF00DD") #continent colors
hull_cont <- cont_data %>%
group_by(Continent, Year) %>%
slice(chull(`Anxiety disorders (%)`,`Depression (%)`)) # Set convex hulls for plot
# The original dataset contained two datasets stacked on top of each other, with prevalence data for each mental health disorder in the top 6469 rows, and population data in the rows below
mh_popn <- read_csv("mental_health.csv", skip = 6469) # skip to population data
mh_popn <- mh_popn %>% filter(`6468` <= 54275) %>% filter(Year >= 1990 & Year <= 2017) %>% select(Entity, Code, Year, Population) # select relevant data
cont_data <- cont_data %>% left_join(mh_popn) # join to continent data with mental health disorder prevalences
missing_pop <- cont_data %>% filter(is.na(Population)) %>% select(Entity, Code, Year) # get information about observations with missing populations
world_pop <- read_xls("API_SP.POP.TOTL_DS2_en_excel_v2_5358476.xls", sheet='Data', skip =3) # populations dataset
# manually select missing population years for each country and pivot longer for one column with the population and corresponding columns for each country (by country code) and the year
popn <- world_pop %>% select(`Country Code`, `1990`, `1991`, `1992`, `1993`, `1994`, `1995`, `1996`, `1997`, `1998`, `1999`, `2000`, `2001`, `2002`, `2003`, `2004`, `2005`, `2006`, `2007`, `2008`, `2009`, `2010`, `2011`, `2012`, `2013`, `2014`, `2015`, `2016`, `2017`) %>%
pivot_longer(cols = c(`1990`, `1991`, `1992`, `1993`, `1994`, `1995`, `1996`, `1997`, `1998`, `1999`, `2000`, `2001`, `2002`, `2003`, `2004`, `2005`, `2006`, `2007`, `2008`, `2009`, `2010`, `2011`, `2012`, `2013`, `2014`, `2015`, `2016`, `2017`), names_to = "Year", values_to = "Population") %>%
mutate(Year = as.double(Year)) %>%
select(`Country Code`, Year, Population)
# join missing population data from mental health dataset with new popn dataset to fill in missing values
pop <- missing_pop %>% left_join(popn, by = c("Code" = "Country Code", "Year" = "Year"))
cont_data <- cont_data %>% left_join(pop, by = c("Code" = "Code", "Year" = "Year", "Entity" = "Entity")) %>%
mutate(Population.x = if_else(is.na(Population.x), Population.y, Population.x)) %>%
rename(Population = Population.x) %>%
select(-Population.y)
# plots
# first make normal ggplot with frame set to slider variable
cont_plot <- ggplot(cont_data, aes(y = `Depression (%)`, x = `Anxiety disorders (%)`, color = Continent, frame = Year)) +
geom_polygon(aes(fill = Continent), guide = "none", data = hull_cont, alpha = 0.2) +
geom_point(aes(size = Population, text = paste("Country: ", Entity, "\nContinent: ", Continent, "\nDepression Rate: ", `Depression (%)`, "\nAnxiety Rate: ", `Anxiety disorders (%)`, "\nPopulation", Population, "\nYear", Year)), alpha = 0.6) +
scale_color_manual(values = cont_colors, guide = "none") +
scale_fill_manual(values = cont_colors, guide = "none") +
scale_size(guide = "none") +
guides(color = "none") +
theme_classic()
# convert ggplot to plotly to add slider
ggplotly(cont_plot, tooltip = "text") %>%
layout(title = list(text = paste0('Rate of Depression vs Anxiety Disorders Globally',
'<br>',
'<sup>',
'By continent & population size',
'</sup>')), margin = list(l=50, r=50, b=50, t=50, pad=4))
About half of people who experience depression also suffer from anxiety, and having an anxiety disorder increases the likelihood of being diagnosed with depression. Our previous analysis of depression rates across the world led us to investigate the global rates of anxiety and compare them with depression rates. Figure 4 shows a positive correlation between anxiety disorder and depression rates across continents, although the strength of this trend varies across different continents. For example, South American countries have lower rates of depression but higher rates of anxiety compared to other continents, whereas African countries tend to have higher depression rates but lower rates of anxiety. Asian, Oceanian, and North American countries generally have similar rates of anxiety and depression, but some exceptions exist, such as New Zealand, which has the highest overall rate of anxiety, and Greenland, which has the highest overall rate of depression. European countries have a wide range of rates for both anxiety and depression, with some countries having high rates and others having low rates. While these trends are evident at the continental level, further analysis of subregions and individual countries would provide a more comprehensive understanding of how these rates differ around the world. Differences in global rates of anxiety and depression may be due to factors such as variation in awareness, cultural acceptance of mental health issues, access to diagnosis, and differences in the quality and methods of reporting data.
So we have looked at how depression and anxiety rates have changed over time on a global scale, but how about when we look at specific countries in Central America? We were interested in investigating the changes in anxiety rates over time in Central America because the region, or more specifically Honduras, underwent a coup d’etat in 2009 causing a constitutional crisis whose repercussions still affect the country today. Surprisingly, the visualizations do not reflect our initial theory that anxiety rates would rise during this time period. Instead, Figure 5 shows a very steady average anxiety rate in the region, the only exception being Belize. Belize’s average anxiety rate is consistently higher than all other countries in Central America over time though only by about 1%. After this discovery we were interested in exploring whether this higher anxiety rate average was actually significant for Belize or if it was on par with other countries in Latin America so we looked at Belize and Mexico. Figure 6 shows that Belize’s average anxiety rate over time was higher than Mexico’s by about 1%. When we increase our scope, however, and look at Belize’s anxiety rates compared to every other region in Latin America, we see that Belize’s score is actually on par with other countries in the Caribbean region and lower by about 2% than countries in the southern and tropical regions of Latin America (Figure 7).
Our visuals highlight how global depression and anxiety prevalence rates have changed over time. While Figures 3 and 4 reveal counter-intuitive relationships between depression, anxiety and suicide rates, our conclusions warrant further research and data collection given the likelihood that prevalence rates may reflect cultural attitudes toward mental illness.
Honduras: Constitutional crisis and Coup D’état (2009). PHR. (2019, January 28). Retrieved May 2, 2023, from https://phr.org/honduras-constitutional-crisis-and-coup/
Salcedo, B. (2018, January 19). The comorbidity of anxiety and depression. Nami. https://www.nami.org/blogs/nami-blog/january-2018/the-comorbidity-of-anxiety-and-depression
World Health Organization. (2022, March 2). COVID-19 pandemic triggers 25% increase in prevalence of anxiety and depression worldwide. https://www.who.int/news/item/02-03-2022-covid-19-pandemic-triggers-25-increase-in-prevalence-of-anxiety-and-depression-worldwide