Analyzing the Impact of the 2008 Financial Crisis on GDP Across Top 10 Nations
Impact of the 2008 Financial Crisis on GDP Trends (2005–2010)
This analysis examines how the 2008 financial crisis affected GDP across the top 10 global economies (United States, Canada, United Kingdom, France, Germany, Italy, Japan, China, India, and Brazil) compared to the pre-crisis period (2005–2007) and recovery in 2009.
The dataset contains GDP data (rgdpna), country names (country), and year (year). The analysis focuses on the years 2005–2010 and the top 10 economies.
# Load required libraries
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.4.2
##
## 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
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.4.2
# Upload the dataset
# Step 1: Upload the dataset
library(readxl)
dataset <- read_excel("C:/Users/VANSH JAIN/Downloads/pwt1001.xlsx",
sheet = "Data")
View(dataset)
# Ensure the `year` column is numeric
dataset$year <- as.numeric(dataset$year)
# Filter for top 10 countries and years 2005–2010
top_countries <- c("United States", "Canada", "United Kingdom", "France",
"Germany", "Italy", "Japan", "China", "India", "Brazil")
dataset_filtered <- dataset %>%
filter(country %in% top_countries & year >= 2005 & year <= 2010)
dataset_filtered
## # A tibble: 60 × 52
## countrycode country currency_unit year rgdpe rgdpo pop emp avh hc
## <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 BRA Brazil Brazilian Re… 2005 1.79e6 1.80e6 186. 78.4 1783. 2.26
## 2 BRA Brazil Brazilian Re… 2006 1.95e6 1.97e6 188. 80.9 1779. 2.30
## 3 BRA Brazil Brazilian Re… 2007 2.17e6 2.19e6 190. 81.4 1774. 2.34
## 4 BRA Brazil Brazilian Re… 2008 2.41e6 2.44e6 192. 82.8 1771. 2.38
## 5 BRA Brazil Brazilian Re… 2009 2.52e6 2.53e6 194. 83.2 1765. 2.43
## 6 BRA Brazil Brazilian Re… 2010 2.92e6 2.94e6 196. 86.4 1761. 2.47
## 7 CAN Canada Canadian Dol… 2005 1.44e6 1.51e6 32.2 16.3 1744. 3.58
## 8 CAN Canada Canadian Dol… 2006 1.46e6 1.52e6 32.5 16.6 1744. 3.59
## 9 CAN Canada Canadian Dol… 2007 1.48e6 1.56e6 32.9 17.0 1743. 3.61
## 10 CAN Canada Canadian Dol… 2008 1.50e6 1.62e6 33.3 17.3 1740. 3.62
## # ℹ 50 more rows
## # ℹ 42 more variables: ccon <dbl>, cda <dbl>, cgdpe <dbl>, cgdpo <dbl>,
## # cn <dbl>, ck <dbl>, ctfp <dbl>, cwtfp <dbl>, rgdpna <dbl>, rconna <dbl>,
## # rdana <dbl>, rnna <dbl>, rkna <dbl>, rtfpna <dbl>, rwtfpna <dbl>,
## # labsh <dbl>, irr <dbl>, delta <dbl>, xr <dbl>, pl_con <dbl>, pl_da <dbl>,
## # pl_gdpo <dbl>, i_cig <chr>, i_xm <chr>, i_xr <chr>, i_outlier <chr>,
## # i_irr <chr>, cor_exp <dbl>, statcap <dbl>, csh_c <dbl>, csh_i <dbl>, …
# Calculate annual percentage change in GDP
dataset_filtered <- dataset_filtered %>%
group_by(country) %>%
arrange(year) %>%
mutate(gdp_change = (rgdpna - lag(rgdpna)) / lag(rgdpna) * 100)
dataset
## # A tibble: 12,810 × 52
## countrycode country currency_unit year rgdpe rgdpo pop emp avh hc
## <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 ABW Aruba Aruban Guilder 1950 NA NA NA NA NA NA
## 2 ABW Aruba Aruban Guilder 1951 NA NA NA NA NA NA
## 3 ABW Aruba Aruban Guilder 1952 NA NA NA NA NA NA
## 4 ABW Aruba Aruban Guilder 1953 NA NA NA NA NA NA
## 5 ABW Aruba Aruban Guilder 1954 NA NA NA NA NA NA
## 6 ABW Aruba Aruban Guilder 1955 NA NA NA NA NA NA
## 7 ABW Aruba Aruban Guilder 1956 NA NA NA NA NA NA
## 8 ABW Aruba Aruban Guilder 1957 NA NA NA NA NA NA
## 9 ABW Aruba Aruban Guilder 1958 NA NA NA NA NA NA
## 10 ABW Aruba Aruban Guilder 1959 NA NA NA NA NA NA
## # ℹ 12,800 more rows
## # ℹ 42 more variables: ccon <dbl>, cda <dbl>, cgdpe <dbl>, cgdpo <dbl>,
## # cn <dbl>, ck <dbl>, ctfp <dbl>, cwtfp <dbl>, rgdpna <dbl>, rconna <dbl>,
## # rdana <dbl>, rnna <dbl>, rkna <dbl>, rtfpna <dbl>, rwtfpna <dbl>,
## # labsh <dbl>, irr <dbl>, delta <dbl>, xr <dbl>, pl_con <dbl>, pl_da <dbl>,
## # pl_gdpo <dbl>, i_cig <chr>, i_xm <chr>, i_xr <chr>, i_outlier <chr>,
## # i_irr <chr>, cor_exp <dbl>, statcap <dbl>, csh_c <dbl>, csh_i <dbl>, …
#Objective: Summarize GDP changes for the pre-crisis period (2005–2007), during the crisis (2008), and recovery year (2009).
# Summarize GDP changes
summary_table <- dataset_filtered %>%
group_by(country) %>%
summarize(
avg_gdp_change_pre_crisis = mean(gdp_change[year < 2008], na.rm = TRUE),
gdp_change_2008 = gdp_change[year == 2008],
gdp_change_2009 = gdp_change[year == 2009]
) %>%
arrange(gdp_change_2008)
# View summarized table
print(summary_table)
## # A tibble: 10 × 4
## country avg_gdp_change_pre_crisis gdp_change_2008 gdp_change_2009
## <chr> <dbl> <dbl> <dbl>
## 1 Japan 1.54 -1.09 -5.42
## 2 Italy 1.64 -0.962 -5.28
## 3 United Kingdom 2.53 -0.279 -4.11
## 4 United States 2.37 -0.137 -2.54
## 5 France 2.44 0.255 -2.87
## 6 Germany 3.40 0.960 -5.69
## 7 Canada 2.35 1.00 -2.93
## 8 India 7.86 3.09 7.86
## 9 Brazil 5.02 5.09 -0.126
## 10 China 10.3 5.83 8.28
Visualize the GDP trends and highlight the impact of the financial crisis in 2008.
# Line chart: GDP changes over time
ggplot(dataset_filtered, aes(x = year, y = gdp_change, color = country, group = country)) +
geom_line(size = 1) +
geom_point(size = 2) +
labs(
title = "GDP Change During and After the 2008 Financial Crisis (2005–2010, Top 10 Nations)",
x = "Year",
y = "GDP Change (%)",
color = "Country"
) +
theme_minimal()
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
# Bar chart: GDP change in 2008
ggplot(summary_table, aes(x = reorder(country, gdp_change_2008), y = gdp_change_2008, fill = country)) +
geom_bar(stat = "identity") +
coord_flip() +
labs(
title = "GDP Change in 2008 Across Top 10 Nations",
x = "Country",
y = "GDP Change (%)",
fill = "Country"
) +
theme_minimal()
Pre-Crisis Period (2005–2007): Most countries experienced moderate GDP growth. Emerging economies like China and India showed higher growth rates. Crisis Impact (2008): Advanced economies such as the United States and Germany faced significant GDP declines, while emerging markets like India and China demonstrated resilience. Recovery Trends (2009): Recovery was uneven, with some countries showing strong rebounds (e.g., India) and others recovering more slowly (e.g., Italy).
This analysis highlights the vulnerabilities of advanced economies to global financial crises and the relative resilience of emerging markets. Policymakers can use these insights to strengthen economic stability and prepare for future shocks.