Final Project - Sustainable Finance

Evaluating the Impact of Green Financing on Carbon Emissions Reduction

Introduction:

Since the European Investment Bank (EIB) introduced the first climate awareness bond in 2007, the green bond market has seen remarkable growth. One major change that has taken place in recent years is the emergence of a deep green bond market. Green bonds, which are self-labeled fixed-income securities designed to raise funds solely for green projects, are viewed as instruments for both climate change mitigation and adaptation. The expansion of the green bonds market not only promotes the development of green finance and brings diversification benefits, but also has significant implications for the environmental impact of green bonds and their liquidity. Addressing climate change necessitates cutting carbon emissions, and a key component of this effort is the financing of carbon reduction measures. Therefore, a forward-looking analysis could focus on the effectiveness of such financing in actually reducing emissions.

A fundamental question is whether green bonds bring clear environmental benefits, specifically whether they contribute to a reduction in global greenhouse gas (GHG) emissions, including carbon dioxide (CO2). Assessing this remains a challenge for several reasons: granular information on the projects being financed or their impact is scant. Despite the scarcity of data, it’s possible for us to obtain some basic understanding by developing some simple models that assess the interplay between green debt issuance (in billions of USD) and carbon emission data (in millions of tons).

Dive into the Trend:

Figure 1.1 presents an interesting juxtaposition of two distinct trends related to environmental finance and emissions from 2007 to 2020 on a global scale. The bar graph indicates a general upward trend in green debt issuance, with a notable increase beginning around 2014. Particularly, the year 2020 stands out with a significantly higher amount of green debt issuance compared to previous years. The red line, which indicates the average percentage change in emissions, fluctuates over the years. Theoretically, it should move in the opposite direction to green debt issuance; however, the graph does not show a clear upward or downward trend, nor does it present an obvious correlation between the two trends. While green debt issuance has increased, especially in the latter half of the observed timeframe, the change in emissions does not demonstrate a consistent pattern in response. This inconsistency could imply that the impact of green debt on emissions is not immediate, or that other factors are influencing changes in emissions.

Figure 1.1

To further discover the nexus between the two indicators, Figure 1.2 introduces a metric that accounts for the influence of GDP growth by presenting a weighted green debt issuance. This adjustment is crucial because if the rate of green debt issuance does not exceed GDP growth, then the relative impact of green investments on the overall economy might be too weak to incur a noticeable change in emissions. Essentially, the green projects financed by the green debt may be too small to counterbalance emissions from the rest of the economic activities.

Presenting the amount of green debt issuance as a percentage of the total GDP of the country allows us to observe some level of correlation. This normalization allows for a more meaningful comparison, especially when considering the variability in economic sizes and growth rates among different countries. We now find an inverse relationship between the trend of the percentage change in emissions and the green debt proportion in 2016-2017. Though such a correlation does not necessarily indicate causation, the apparent inverse relationship could be an encouraging sign that potentially points toward the benefits associated with green bond issuance.

Figure 1.2

Comparative Analysis by Country:

Although the figures above suggest a certain degree of relationship between green debt and GHG reduction, a closer examination of each country is necessary to determine whether the magnitude of this relationship is underestimated. It is plausible that outliers exist—countries that have issued a small amount of green bonds but contribute disproportionately to GHG emissions, or vice versa. This could distort the overall picture if the emissions data are not weighted by the size of the green debt or the economic output of the issuing entities. Therefore, world maps are utilized to reflect the average carbon emissions, as well as average green debt issuance, from the year 2018 to 2022 at the macro level, with a color gradient ranging from yellow to dark purple, indicating rising levels of carbon emissions and green bond issuance, respectively.

From Figure 2.1, we notice that typically large industrialized nations or those with high fossil fuel consumption have the highest levels of GHG emissions. The US, India, and Russia are among the top countries with the highest levels of carbon emissions from 2018 to 2022. The United States, with its large and diverse industrial base, substantial transportation sector, and high per capita energy consumption, has historically been one of the largest emitters. India’s position as a top emitter is closely linked to its rapid industrialization, growing energy sector, and increasing urbanization, which have naturally resulted in significant carbon emissions. Meanwhile, the high emission rate in Russian is primarily due to its energy production sectors.

Figure 2.1

*Note that some of the countries are not shown on the map due to unreported data in OECD/IMF database

Being among the largest carbon emitters in the world, the countries show varying levels of commitment to green financing, as expressed through the issuance of green bonds. From Figure 2.2, we observe that India, as well as some European countries, do not exhibit strong engagement in sustainable finance, as reflected by their yellow coloring indicating a low level of green debt. In contrast, countries like the US and China are demonstrating a strong commitment to green financing. This result is intriguing, especially considering that Europe is often perceived to be proactive in environmental finance. The discrepancy could be the result of different data scales; if the scale is not adjusted for the size of the economy or the population of the countries, the absolute amounts might be significant but may appear small relative to the country’s GDP or total bond market.

In addition, the green bond market’s maturity can vary across different regions in Europe. Some European countries may have well-established green bond markets, and the relative issuance might reflect market saturation or a shift towards other forms of sustainable finance, while in others, the market could be nascent. Furthermore, since the economic context of each country differs, their focus on sustainability can also vary. It is worth noting that India, despite having a large economy, is still an emerging market with different financial and environmental challenges compared to European countries. The country’s focus might be on addressing immediate economic development needs, with green financing being a growing but still developing area. Overall, these snapshots may provide some indication of the geographical distribution of green financing levels, but a deeper analysis is indeed required to fully understand the nuances of green debt issuance in each country.

Figure 2.2

Regression Analysis:

Last but not least, a simple method is used to examine the percentage change in carbon emissions as a dependent variable, based on the percentage change in green debt issuance, taking into account GDP weighted by the producer price index. This approach yields linear regression results. As shown in the graph below, the distribution of data points is quite dense at the lower end of debt issuance, indicating that most of the green debt issuance corresponds to a small proportion of total domestic production, perhaps due to the relatively new and emerging nature of the market. The cluster of points centered around the zero line for percentage change in emissions suggests that, in many cases, the change in emissions is minimal. The second graph provided offers a more detailed scatter plot with the addition of color-coded best-fit lines corresponding to the effect of green debt issuance on carbon emissions for each year. The colored trend lines for individual years illustrate that the impact of green debt issuance on emission changes is not consistent over time and may be influenced by other factors not captured in this two-dimensional analysis. However, in both figures, there are indications that with higher debt issuance, the variability in emission changes increases; as the proportion of debt issuance rises, the spread of percentage change in emissions also seems to widen.

Figure 3.1

Figure 3.2

So far, however, green bond projects have not necessarily translated into significantly lower or falling carbon emissions at the country level. Thus, current labels for green bonds do not signal that issuers have lower or decreasing overall carbon emissions relative to overall production. However, this does not repudiate the usefulness of the instrument. Indeed, an inverse relationship between the trend of the percentage change in emissions and the green debt proportion is presented in our trend analysis and the linear regression model. Through this model, we can also identify factors that hinder a country from effectively adopting green financing instruments and reaping their benefits. In particular, the growth of the green bond market varies over time and depends on the expansion of the overall bond market and the economic health of the country. This is especially true in the context of emerging economies, where the priority often lies in addressing urgent developmental needs.

Conclusion:

Given the challenges the green bonds market is facing, we may consider tapering the market by allowing for greater standardization of the instruments to reduce the cost of issuing and to improve the reporting and tracking system. The goal would be to reduce the costs associated with issuing green bonds and to improve how we report and track their outcomes. If we integrate climate-focused financing into the broader financial market, rather than confining it to a niche area, it could have a more significant effect on reducing carbon emissions. This would happen as these financial tools become more widely available and used by a greater number of participants. Additionally, integrating green financing with broader economic policies and incentives could encourage a more holistic approach to reducing emissions. Projects financed by green bonds should be clearly linked to specific environmental outcomes, such as measurable reductions in carbon emissions. This alignment would make the impact of green bonds stronger. Moreover, engaging a diverse array of investors and educating the public on the potential of green bonds could stimulate further growth and acceptance of these instruments. As green financing matures and evolves, it has the potential to play a pivotal role in transitioning towards a low-carbon economy, provided it is part of a comprehensive strategy that includes robust environmental governance and enforcement mechanisms.

Coding:

library(readxl)
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.4
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.4.4     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.0
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(writexl)
library(dplyr)
library(countrycode)
library(here) # for using relative file paths, here() starts at /Users/ciel.wang/Desktop/JH/R/00_data_raw 
here() starts at /Users/ciel.wang/Desktop/JH/R
library(sf)
Linking to GEOS 3.10.2, GDAL 3.4.2, PROJ 8.2.1; sf_use_s2() is TRUE
world_map <- st_read("/Users/ciel.wang/Desktop/JH/R/00_data_raw/countries.geo.json")
Reading layer `countries.geo' from data source 
  `/Users/ciel.wang/Desktop/JH/R/00_data_raw/countries.geo.json' 
  using driver `GeoJSON'
Simple feature collection with 180 features and 2 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: -180 ymin: -85.60904 xmax: 180 ymax: 83.64513
Geodetic CRS:  WGS 84
#read the excel file
setwd("/Users/ciel.wang/Desktop/JH/R/00_data_raw")

#world map
world_map <- st_read("/Users/ciel.wang/Desktop/JH/R/00_data_raw/countries.geo.json")
Reading layer `countries.geo' from data source 
  `/Users/ciel.wang/Desktop/JH/R/00_data_raw/countries.geo.json' 
  using driver `GeoJSON'
Simple feature collection with 180 features and 2 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: -180 ymin: -85.60904 xmax: 180 ymax: 83.64513
Geodetic CRS:  WGS 84
#Carbon emission data
path_to_sheet <- here("00_data_raw", "Book3.xlsx")
emission <- read_xlsx("Book3.xlsx", 
                               sheet = 'emission_by_country'  )

#green financing data
green_debt <- read_xlsx("Book3.xlsx", 
                               sheet = 'green_debt'  )

#GDP data
ppp_gdp <- read_xlsx("Book3.xlsx", 
                     sheet = 'PPP_GDP'  )

Before cleaning and analyzing the data, we first standardized the country Country_Names and codes to make sure that they are matched in both data frames:

#design a function to standardize country Country_Name and code 
country_regex_to_iso3c <- function(country_string) {
  country_string |>
    countrycode::countrycode(origin = "country.name", destination = "iso3c", origin_regex = TRUE)
}

iso3c_to_country_name <- function(country_string) {
  country_string |>
    countrycode::countrycode(origin = "iso3c", destination = "country.name")
} 

Next, pivot longer each data sets and select the relevant columns:

emission_long <- emission |> 
  pivot_longer(
    cols= starts_with('Y_'),
    names_to = 'year',
    values_to = 'emission'
  ) |>
  rename(ISO3=Country_code_A3) |>
  mutate(year=parse_number(year)) |>
    select('ISO3','Country_Name', 'year','emission')
emission_long
# A tibble: 11,819 × 4
   ISO3  Country_Name  year emission
   <chr> <chr>        <dbl>    <dbl>
 1 ABW   Aruba         1970     45.2
 2 ABW   Aruba         1971     50.1
 3 ABW   Aruba         1972     60.9
 4 ABW   Aruba         1973     65.8
 5 ABW   Aruba         1974     65.1
 6 ABW   Aruba         1975     79.1
 7 ABW   Aruba         1976     78.2
 8 ABW   Aruba         1977     88.9
 9 ABW   Aruba         1978     93.7
10 ABW   Aruba         1979     97.7
# ℹ 11,809 more rows
green_debt_long <- green_debt |> 
  pivot_longer(
    cols= starts_with('F'),
    names_to = 'year',
    values_to = 'debt_issuance',
    values_drop_na = TRUE
  ) |>
  mutate(year=parse_number(year)) |>
  select("ISO3",Country_Name, year, debt_issuance)
green_debt_long
# A tibble: 863 × 4
   ISO3  Country_Name  year debt_issuance
   <chr> <chr>        <dbl>         <dbl>
 1 ARG   Argentina     2017        0.974 
 2 ARG   Argentina     2020        0.0500
 3 ARG   Argentina     2021        0.916 
 4 ARG   Argentina     2022        0.207 
 5 AUS   Australia     2014        0.526 
 6 AUS   Australia     2015        0.413 
 7 AUS   Australia     2016        0.531 
 8 AUS   Australia     2017        2.53  
 9 AUS   Australia     2018        2.22  
10 AUS   Australia     2019        1.98  
# ℹ 853 more rows
PPP_GDP_long <- ppp_gdp |> 
  pivot_longer(
    cols= !c("Country_Name", "Country Code", "Indicator Name", "Indicator Code"),
    names_to = 'year',
    values_to = 'PPP_GDP',
    values_drop_na = TRUE
  ) |>
  rename(ISO3="Country Code") |>
  mutate(year = as.double(year)) |>
  select("ISO3", "Country_Name", year, PPP_GDP)
PPP_GDP_long
# A tibble: 7,730 × 4
   ISO3  Country_Name  year     PPP_GDP
   <chr> <chr>        <dbl>       <dbl>
 1 ABW   Aruba         1990 1363676996.
 2 ABW   Aruba         1991 1522053333.
 3 ABW   Aruba         1992 1648312495.
 4 ABW   Aruba         1993 1810691879.
 5 ABW   Aruba         1994 2001077313.
 6 ABW   Aruba         1995 2095077029.
 7 ABW   Aruba         1996 2158735270.
 8 ABW   Aruba         1997 2350707816.
 9 ABW   Aruba         1998 2424518584.
10 ABW   Aruba         1999 2489125252.
# ℹ 7,720 more rows

Then we can try to standardize country variables so that the two data frames can be merged:

#### standardzied country names and codes
emission_long |>
  mutate(ISO3 = country_regex_to_iso3c(Country_Name))
Warning: There was 1 warning in `mutate()`.
ℹ In argument: `ISO3 = country_regex_to_iso3c(Country_Name)`.
Caused by warning:
! Some values were not matched unambiguously: Int. Aviation, Int. Shipping, Netherlands Antilles, Serbia and Montenegro, Virgin Islands_USA
# A tibble: 11,819 × 4
   ISO3  Country_Name  year emission
   <chr> <chr>        <dbl>    <dbl>
 1 ABW   Aruba         1970     45.2
 2 ABW   Aruba         1971     50.1
 3 ABW   Aruba         1972     60.9
 4 ABW   Aruba         1973     65.8
 5 ABW   Aruba         1974     65.1
 6 ABW   Aruba         1975     79.1
 7 ABW   Aruba         1976     78.2
 8 ABW   Aruba         1977     88.9
 9 ABW   Aruba         1978     93.7
10 ABW   Aruba         1979     97.7
# ℹ 11,809 more rows
green_debt_long |>
  mutate(ISO3 = country_regex_to_iso3c(Country_Name))
Warning: There was 1 warning in `mutate()`.
ℹ In argument: `ISO3 = country_regex_to_iso3c(Country_Name)`.
Caused by warning:
! Some values were not matched unambiguously: World
# A tibble: 863 × 4
   ISO3  Country_Name  year debt_issuance
   <chr> <chr>        <dbl>         <dbl>
 1 ARG   Argentina     2017        0.974 
 2 ARG   Argentina     2020        0.0500
 3 ARG   Argentina     2021        0.916 
 4 ARG   Argentina     2022        0.207 
 5 AUS   Australia     2014        0.526 
 6 AUS   Australia     2015        0.413 
 7 AUS   Australia     2016        0.531 
 8 AUS   Australia     2017        2.53  
 9 AUS   Australia     2018        2.22  
10 AUS   Australia     2019        1.98  
# ℹ 853 more rows
PPP_GDP_long |>
  filter(
    Country_Name != "Africa Eastern and Southern",
    Country_Name != "Africa Western and Central",
    Country_Name != "Arab World",
    Country_Name != "Caribbean small states",
    Country_Name != "Central Europe and the Baltics",
    Country_Name != "Early-demographic dividend",
    Country_Name != "East Asia & Pacific",
    Country_Name != "East Asia & Pacific (excluding high income)",
    Country_Name != "East Asia & Pacific (IDA & IBRD countries)",
    Country_Name != "Euro area",
    Country_Name != "Europe & Central Asia",
    Country_Name != "Europe & Central Asia (excluding high income)",
    Country_Name != "Europe & Central Asia (IDA & IBRD countries)",
    Country_Name != "European Union",
    Country_Name != "Fragile and conflict affected situations",
    Country_Name != "Heavily indebted poor countries (HIPC)",
    Country_Name != "High income",
    Country_Name != "IBRD only",
    Country_Name != "IDA & IBRD total",
    Country_Name != "IDA blend",
    Country_Name != "IDA only",
    Country_Name != "IDA total",
    Country_Name != "Kosovo",
    Country_Name != "Late-demographic dividend",
    Country_Name != "Latin America & Caribbean",
    Country_Name != "Latin America & Caribbean (excluding high income)",
    Country_Name != "Latin America & the Caribbean (IDA & IBRD countries)",
    Country_Name != "Least developed countries: UN classification",
    Country_Name != "Low & middle income",
    Country_Name != "Low income",
    Country_Name != "Lower middle income",
    Country_Name != "Middle East & North Africa",
    Country_Name != "Middle East & North Africa (excluding high income)",
    Country_Name != "Middle East & North Africa (IDA & IBRD countries)",
    Country_Name != "Middle income",
    Country_Name != "North America",
    Country_Name != "OECD members",
    Country_Name != "Other small states",
    Country_Name != "Pacific island small states",
    Country_Name != "Post-demographic dividend",
    Country_Name != "Pre-demographic dividend",
    Country_Name != "Small states",
    Country_Name != "South Asia",
    Country_Name != "South Asia (IDA & IBRD)",
    Country_Name != "Sub-Saharan Africa",
    Country_Name != "Sub-Saharan Africa (excluding high income)",
    Country_Name != "Sub-Saharan Africa (IDA & IBRD countries)",
    Country_Name != "Upper middle income",
    Country_Name != "World"
  )|>
  mutate(ISO3 = country_regex_to_iso3c(Country_Name))
# A tibble: 6,151 × 4
   ISO3  Country_Name  year     PPP_GDP
   <chr> <chr>        <dbl>       <dbl>
 1 ABW   Aruba         1990 1363676996.
 2 ABW   Aruba         1991 1522053333.
 3 ABW   Aruba         1992 1648312495.
 4 ABW   Aruba         1993 1810691879.
 5 ABW   Aruba         1994 2001077313.
 6 ABW   Aruba         1995 2095077029.
 7 ABW   Aruba         1996 2158735270.
 8 ABW   Aruba         1997 2350707816.
 9 ABW   Aruba         1998 2424518584.
10 ABW   Aruba         1999 2489125252.
# ℹ 6,141 more rows

Join the data frames by country and year and calculate the financed emission based on the sovereign debt metric:

debt_emission <- left_join( green_debt_long, emission_long,  
                            by = c("ISO3" = "ISO3", "year" = "year", "Country_Name" =
                                     "Country_Name")) |>
  left_join(PPP_GDP_long, 
            by = c("ISO3" = "ISO3", "year" = "year", "Country_Name" =
                                     "Country_Name")) |>
  group_by(ISO3, Country_Name) |>
  mutate(
    previous_year_emission = lag(emission),
    percentage_change_emission = (emission - previous_year_emission)/ previous_year_emission * 100
  ) |>
   ungroup() |>
  select("ISO3", "Country_Name", "year", "debt_issuance","emission",
        "percentage_change_emission","PPP_GDP") 

debt_emission
# A tibble: 863 × 7
   ISO3  Country_Name  year debt_issuance emission percentage_change_emission
   <chr> <chr>        <dbl>         <dbl>    <dbl>                      <dbl>
 1 ARG   Argentina     2017        0.974   379169.                    NA     
 2 ARG   Argentina     2020        0.0500  359026.                    -5.31  
 3 ARG   Argentina     2021        0.916   378420.                     5.40  
 4 ARG   Argentina     2022        0.207   382992.                     1.21  
 5 AUS   Australia     2014        0.526   585442.                    NA     
 6 AUS   Australia     2015        0.413   593561.                     1.39  
 7 AUS   Australia     2016        0.531   594024.                     0.0780
 8 AUS   Australia     2017        2.53    601065.                     1.19  
 9 AUS   Australia     2018        2.22    597774.                    -0.548 
10 AUS   Australia     2019        1.98    596032.                    -0.291 
# ℹ 853 more rows
# ℹ 1 more variable: PPP_GDP <dbl>

Now we want to have a graph that shows the trend of green debt issuance and carbon emission change

average_change_emission <- debt_emission %>%
  group_by(year) %>%
  summarize(average_percentage_change_emission = mean(percentage_change_emission, na.rm = TRUE)) %>%
  filter(!is.na(average_percentage_change_emission))
# First, let's determine the range for the secondary axis based on the range of percentage change in emissions
emission_range <- range(debt_emission$percentage_change_emission, na.rm = TRUE)
debt_range <- range(debt_emission$debt_issuance, na.rm = TRUE)

# Calculate the ratio between the two ranges
ratio1 <- (emission_range[2] - emission_range[1]) / (debt_range[2] - debt_range[1])
# Create the combined plot
combined_plot <- ggplot() +
  geom_bar(data = debt_emission, aes(x = year, y = debt_issuance, fill = "Green Debt Issuance"),
           stat = "identity", width = 0.7) +
  geom_line(data = average_change_emission, aes(x = year, y = average_percentage_change_emission / ratio1, color = "Avg. % Change Emissions"),
            linewidth = 1) +
  scale_y_continuous(
    name = "Green Debt Issuance (in millions USD)",
    sec.axis = sec_axis(~ . * ratio1, name = "Avg. % Change Emissions")
  ) +
  scale_x_continuous(name = "Year", limits = c(2007, 2020), breaks = 2007:2020) +
  labs(title = "Trend of Green Debt Issuance and Change in Emissions from Year to Year",
       fill = "", # Legend title for the fill aesthetic
       color = "") + # Legend title for the color aesthetic
  scale_fill_manual(values = c("Green Debt Issuance" = "skyblue"), labels = c("Green Debt Issuance (in millions USD)")) +
  scale_color_manual(values = c("Avg. % Change Emissions" = "red"), labels = c("Avg. % Change Emissions")) +
  theme_minimal() +
  theme(legend.position = "bottom") # Adjust the position of the legend as needed

# Print the plot
print(combined_plot)
Warning: Removed 468 rows containing missing values (`position_stack()`).
Warning: Removed 75 rows containing missing values (`geom_bar()`).
Warning: Removed 9 rows containing missing values (`geom_line()`).

despite the fact that green debt increases, percentage change in emission doesn’t reflect a clean decreasing trend

reason could be the increasing rate of green debt doesn’t exceed the growth of GDP, or maybe there are some outlier countries that issue little green bonds but release a lot of GHG

we weighted green debt issuance in terms of PPP_GDP

# First, create a new column that represents the proportion of debt issuance to PPP_GDP.
debt_emission <- debt_emission %>%
  mutate(debt_issuance_proportion = 1000*debt_issuance / PPP_GDP,
         previous_year_porportion = lag(debt_issuance_proportion),
         percentage_change_propotion = (debt_issuance_proportion - previous_year_porportion)/ previous_year_porportion * 100
         )
# Then, calculate the ratio for the secondary axis.
debt_proportion_range <- range(debt_emission$debt_issuance_proportion, na.rm = TRUE)
emission_change_range <- range(average_change_emission$average_percentage_change_emission, na.rm = TRUE)


# Ratio for aligning the primary and secondary y-axes
ratio2 <- (emission_change_range[2] - emission_change_range[1]) / (debt_proportion_range[2] - debt_proportion_range[1])
# Create the combined plot
combined_plot2 <- ggplot() +
  geom_bar(data = debt_emission, aes(x = year, y = debt_issuance_proportion, fill = "Avg Green Debt Issuance Proportion"),
           stat = "identity", width = 0.7) +
  geom_line(data = average_change_emission, aes(x = year, y = average_percentage_change_emission / ratio2, color = "Avg. % Change Emissions"),
            size = 1) +
  scale_y_continuous(
    name = "Avg Green Debt Issuance as Proportion of PPP_GDP",
    sec.axis = sec_axis(~ . * ratio2, name = "Avg. % Change Emissions")
  ) +
  scale_x_continuous(name = "Year", limits = c(2007, 2020), breaks = 2007:2020) +
  labs(title = "Trend of Green Debt Issuance Proportion and Change in Emissions from Year to Year",
       fill = "", # Legend title for the fill aesthetic
       color = "") + # Legend title for the color aesthetic
  scale_fill_manual(values = c("Avg Green Debt Issuance Proportion" = "skyblue"), labels = c("Avg Green Debt Issuance as Proportion of PPP_GDP")) +
  scale_color_manual(values = c("Avg. % Change Emissions" = "red"), labels = c("Avg. % Change Emissions")) +
  theme_minimal() +
  theme(legend.position = "bottom")
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.
# Print the plot
print(combined_plot2)
Warning: Removed 532 rows containing missing values (`position_stack()`).
Warning: Removed 61 rows containing missing values (`geom_bar()`).
Warning: Removed 9 rows containing missing values (`geom_line()`).

names(world_map)
[1] "id"       "name"     "geometry"
world_map1 <- world_map |>
  rename(
    ISO3=id,
    Country_Name=name
  )
  
names(world_map1)
[1] "ISO3"         "Country_Name" "geometry"    

next we create another df that shows the average carbon emission by country during the past 5 years (2018-2022):

average_emissions_by_country <- debt_emission %>%
  filter(year >= 2018, year <= 2022) %>%
  filter(!is.na(emission)) %>% # Step 1: Remove rows where carbon emission is NA
  group_by(ISO3, Country_Name) %>%    # Step 2: Group by ISO3 and Country_Name
  summarise(                           # Step 3: Calculate the average, excluding NAs
    average_carbon_emission = mean(emission, na.rm = TRUE)
  ) %>%
  ungroup()
`summarise()` has grouped output by 'ISO3'. You can override using the
`.groups` argument.
# View the resulting data frame
print(average_emissions_by_country)
# A tibble: 54 × 3
   ISO3  Country_Name         average_carbon_emission
   <chr> <chr>                                  <dbl>
 1 ARE   United Arab Emirates                 280462.
 2 ARG   Argentina                            373479.
 3 AUS   Australia                            579935.
 4 AUT   Austria                               80042.
 5 BEL   Belgium                              119423.
 6 BGD   Bangladesh                           276797.
 7 BMU   Bermuda                                 355.
 8 BRA   Brazil                              1297548.
 9 CAN   Canada                               753533.
10 CHE   Switzerland                           46327.
# ℹ 44 more rows
world_emission_map <- merge(world_map1, average_emissions_by_country, by = "ISO3")

world_emission_map$average_carbon_emission <- as.numeric(world_emission_map$average_carbon_emission)

range(world_emission_map$average_carbon_emission, na.rm = TRUE)
[1]     355.4524 5999450.2778

plot the graph of world map with green debt issuance level

ggplot(data = world_emission_map) +
  geom_sf(aes(fill = average_carbon_emission), color = "white", size = 0.1) +
  scale_fill_viridis_c(option = "C", direction = -1, name = "Average Carbon\nEmission") +
  labs(
    title = "Average Carbon Emission by Country",
    subtitle = "Visualized using data from world_debt_map"
  ) +
  theme_minimal() +
  theme(legend.position = "bottom")

*some of the country is missing on the map as their emission data are not collected by OECD.

next we create another df that shows the average green emission by country during the past 5 years (2018-2022):

average_debt_by_country <- debt_emission %>%
  filter(year >= 2018, year <= 2022) %>%
  filter(!is.na(debt_issuance)) %>% 
  group_by(ISO3, Country_Name) %>%    
  summarise(                          
    average_debt_issuance = mean(debt_issuance, na.rm = TRUE)
  ) %>%
  ungroup()
`summarise()` has grouped output by 'ISO3'. You can override using the
`.groups` argument.
# View the resulting data frame
print(average_debt_by_country)
# A tibble: 76 × 3
   ISO3  Country_Name         average_debt_issuance
   <chr> <chr>                                <dbl>
 1 ARE   United Arab Emirates                1.10  
 2 ARG   Argentina                           0.391 
 3 AUS   Australia                           3.22  
 4 AUT   Austria                             3.32  
 5 BEL   Belgium                             6.61  
 6 BGD   Bangladesh                          0.387 
 7 BLR   Belarus, Rep. of                    0.0667
 8 BMU   Bermuda                             1.58  
 9 BRA   Brazil                              0.657 
10 CAN   Canada                              9.19  
# ℹ 66 more rows
world_debt_map <- merge(world_map1, average_debt_by_country, by = "ISO3")

world_debt_map$average_debt_issuance <- as.numeric(world_debt_map$average_debt_issuance)

range(world_debt_map$average_debt_issuance, na.rm = TRUE)
[1]  0.0038124 53.1446720
ggplot(data = world_debt_map) +
  geom_sf(aes(fill = average_debt_issuance), color = "white", size = 0.1) +
  scale_fill_viridis_c(option = "C", direction = -1, name = "Average Green Bond Issuance") +
  labs(
    title = "Average Green Bond Issuance 2018-2022",
    subtitle = "Visualized using data from world_debt_map"
  ) +
  theme_minimal() +
  theme(legend.position = "bottom")

Some of the country is issuing relatively low level of green bond, so that they drag down the average level of carbon reduction.(ex. middle east, Europian countries)

Debt Issuance vs. Percentage change in Emission Scatter Plot for All Countries

ggplot(data = debt_emission,
       aes(x = percentage_change_propotion, y = percentage_change_emission)) +
  geom_point() +  # Plot the data points
  geom_smooth(method = "lm",   # Add a linear regression line
              color = "blue",   # You can choose the color of the line
              se = FALSE) +    # 'se' controls the display of the confidence interval around the line
  labs(title = "% change in Green Debt Proportion vs. % change in emission with Best Fit Line",
       x = "% change of Green debt Issuance as proportion of GDP",
       y = "% change in emission") +
  theme_minimal() +
  coord_cartesian(xlim = c(0, 60000))
`geom_smooth()` using formula = 'y ~ x'
Warning: Removed 558 rows containing non-finite values (`stat_smooth()`).
Warning: Removed 557 rows containing missing values (`geom_point()`).

Emission Levels for Top 5 Countries with the Highest Emissions from 2019 to 2022

top_countries_2019 <- debt_emission %>%
  filter(year == 2019) %>%
  arrange(desc(emission)) %>%
  slice(1:5)

ggplot(data = top_countries_2019,
       aes(x = reorder(Country_Name, emission), y = emission)) +
  geom_bar(stat = "identity") +
  labs(title = "Top 5 Countries by Emission Levels in 2019",
       x = "Country",
       y = "Emission Levels") +
  theme_minimal() +
  coord_flip() # Flips the axes for easier reading

top_countries_2020 <- debt_emission %>%
  filter(year == 2020) %>%
  arrange(desc(emission)) %>%
  slice(1:5)

ggplot(data = top_countries_2020,
       aes(x = reorder(Country_Name, emission), y = emission)) +
  geom_bar(stat = "identity") +
  labs(title = "Top 5 Countries by Emission Levels in 2020",
       x = "Country",
       y = "Emission Levels") +
  theme_minimal() +
  coord_flip() # Flips the axes for easier reading

top_countries_2021 <- debt_emission %>%
  filter(year == 2021) %>%
  arrange(desc(emission)) %>%
  slice(1:5)

ggplot(data = top_countries_2021,
       aes(x = reorder(Country_Name, emission), y = emission)) +
  geom_bar(stat = "identity") +
  labs(title = "Top 5 Countries by Emission Levels in 2021",
       x = "Country",
       y = "Emission Levels") +
  theme_minimal() +
  coord_flip() # Flips the axes for easier reading

top_countries_2022 <- debt_emission %>%
  filter(year == 2022) %>%
  arrange(desc(emission)) %>%
  slice(1:5)

ggplot(data = top_countries_2022,
       aes(x = reorder(Country_Name, emission), y = emission)) +
  geom_bar(stat = "identity") +
  labs(title = "Top 5 Countries by Emission Levels in 2022",
       x = "Country",
       y = "Emission Levels") +
  theme_minimal() +
  coord_flip() # Flips the axes for easier reading