Introduction

This report explores the relationship between capital account openness and environmental degradation across different countries. Specifically, we test whether capital account openness, as measured by the Chinn-Ito Index, is associated with environmental degradation, with a particular focus on whether the relationship varies by level of economic development (measured by GDP per capita).

Hypotheses

  1. Hypothesis 1: There is a negative relationship between capital account openness and environmental degradation, meaning that greater openness to capital inflows leads to a reduction in pollution due to higher efficiency in production.
  2. Hypothesis 2: The relationship between capital account openness and environmental degradation depends on the country’s level of economic development, with wealthier countries showing a weaker association due to better technology and environmental regulations.

Data Collection

The data used in this analysis includes the following variables:

The data is sourced from various publicly available sources such as the World Bank, Our World in Data, and other reputable international organizations. The dataset takes the form of panel data across 100 countries, with observations for several years.

Data Preprocessing

# Install required libraries
install.packages("tidyverse")    # for data manipulation and visualization
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
install.packages("lmtest")       # for hypothesis testing in regression models
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
install.packages("sandwich")     # for robust standard errors
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
install.packages("readxl")       # for reading Excel files
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
# Load required libraries
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ 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(lmtest)
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## 
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
library(sandwich)
library(readxl)

# Load data 
data <- read_excel("Capital_Openness_Environmental_Impact.xlsx")

# View the first few rows of the data
head(data)
## # A tibble: 6 × 6
##   Country       GDP_per_capita Capital_Openness CO2_Emissions Energy_Consumption
##   <chr>                  <dbl>            <dbl>         <dbl>              <dbl>
## 1 Portugal              19034.          1.74             36.4              1.29 
## 2 Israel                43306.          0.685            28.2              0.499
## 3 Russia                42001.         -1.75             38.2              0.204
## 4 Turkey                49087.          1.57             43.6              1.35 
## 5 Czech Republ…         32813.          0.00379          48.8              0.648
## 6 Egypt                  3834.          1.15             45.4              1.43 
## # ℹ 1 more variable: Urbanization <dbl>
# Summary statistics of the data
summary(data)
##    Country          GDP_per_capita  Capital_Openness    CO2_Emissions    
##  Length:100         Min.   : 1162   Min.   :-1.991909   Min.   : 0.1856  
##  Class :character   1st Qu.:14331   1st Qu.:-0.934353   1st Qu.:15.3934  
##  Mode  :character   Median :26838   Median : 0.027447   Median :28.5655  
##                     Mean   :25568   Mean   :-0.002596   Mean   :27.3791  
##                     3rd Qu.:37090   3rd Qu.: 1.007853   3rd Qu.:41.3983  
##                     Max.   :49766   Max.   : 1.980530   Max.   :49.9180  
##  Energy_Consumption  Urbanization  
##  Min.   :0.1105     Min.   :30.10  
##  1st Qu.:0.5116     1st Qu.:45.11  
##  Median :0.8894     Median :62.14  
##  Mean   :0.8526     Mean   :60.78  
##  3rd Qu.:1.2023     3rd Qu.:76.59  
##  Max.   :1.4955     Max.   :89.58
# Scatter plot with a linear regression line
ggplot(data, aes(x = Capital_Openness, y = CO2_Emissions)) +
  geom_point(color = "blue") +
  geom_smooth(method = "lm", se = FALSE, color = "red") +
  labs(title = "Capital Openness vs CO2 Emissions", x = "Capital Openness", y = "CO2 Emissions (per capita)") +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

# Scatter plot with color representing GDP per capita
ggplot(data, aes(x = Capital_Openness, y = CO2_Emissions, color = GDP_per_capita)) +
  geom_point() +
  scale_color_viridis_c() +
  labs(title = "Capital Openness vs CO2 Emissions by GDP per Capita", x = "Capital Openness", y = "CO2 Emissions (per capita)", color = "GDP per Capita") +
  theme_minimal()

# Fit a base linear regression model
base_model <- lm(CO2_Emissions ~ Capital_Openness + GDP_per_capita + Energy_Consumption + Urbanization, data = data)
summary(base_model)
## 
## Call:
## lm(formula = CO2_Emissions ~ Capital_Openness + GDP_per_capita + 
##     Energy_Consumption + Urbanization, data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -28.056 -11.953   1.949  13.503  24.064 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         3.496e+01  6.892e+00   5.073 1.94e-06 ***
## Capital_Openness    1.857e+00  1.337e+00   1.389    0.168    
## GDP_per_capita     -1.123e-05  1.095e-04  -0.103    0.918    
## Energy_Consumption  2.365e-01  3.834e+00   0.062    0.951    
## Urbanization       -1.233e-01  8.504e-02  -1.450    0.150    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 15.02 on 95 degrees of freedom
## Multiple R-squared:  0.03983,    Adjusted R-squared:  -0.000593 
## F-statistic: 0.9853 on 4 and 95 DF,  p-value: 0.4194
# Fit a model with interaction between Capital Openness and GDP per capita
interaction_model <- lm(CO2_Emissions ~ Capital_Openness * GDP_per_capita + Energy_Consumption + Urbanization, data = data)
summary(interaction_model)
## 
## Call:
## lm(formula = CO2_Emissions ~ Capital_Openness * GDP_per_capita + 
##     Energy_Consumption + Urbanization, data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -27.838 -11.679   1.792  12.350  24.196 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      3.490e+01  6.918e+00   5.045 2.21e-06 ***
## Capital_Openness                 3.483e+00  3.155e+00   1.104    0.272    
## GDP_per_capita                   1.320e-06  1.121e-04   0.012    0.991    
## Energy_Consumption               1.498e-01  3.851e+00   0.039    0.969    
## Urbanization                    -1.285e-01  8.583e-02  -1.497    0.138    
## Capital_Openness:GDP_per_capita -5.751e-05  1.010e-04  -0.569    0.570    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 15.08 on 94 degrees of freedom
## Multiple R-squared:  0.04314,    Adjusted R-squared:  -0.007761 
## F-statistic: 0.8475 on 5 and 94 DF,  p-value: 0.5195
# Display base model results with robust standard errors
coeftest(base_model, vcov = vcovHC(base_model, type = "HC1"))
## 
## t test of coefficients:
## 
##                       Estimate  Std. Error t value  Pr(>|t|)    
## (Intercept)         3.4962e+01  6.8017e+00  5.1402 1.466e-06 ***
## Capital_Openness    1.8565e+00  1.3272e+00  1.3988    0.1651    
## GDP_per_capita     -1.1234e-05  1.1652e-04 -0.0964    0.9234    
## Energy_Consumption  2.3648e-01  3.9138e+00  0.0604    0.9519    
## Urbanization       -1.2327e-01  9.0371e-02 -1.3641    0.1758    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Display interaction model results with robust standard errors
coeftest(interaction_model, vcov = vcovHC(interaction_model, type = "HC1"))
## 
## t test of coefficients:
## 
##                                    Estimate  Std. Error t value  Pr(>|t|)    
## (Intercept)                      3.4896e+01  6.9578e+00  5.0153 2.491e-06 ***
## Capital_Openness                 3.4826e+00  3.3676e+00  1.0341    0.3037    
## GDP_per_capita                   1.3202e-06  1.1908e-04  0.0111    0.9912    
## Energy_Consumption               1.4976e-01  3.9836e+00  0.0376    0.9701    
## Urbanization                    -1.2847e-01  9.2467e-02 -1.3894    0.1680    
## Capital_Openness:GDP_per_capita -5.7513e-05  1.0682e-04 -0.5384    0.5916    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Predict CO2 emissions using the base model
data$predicted_co2_base <- predict(base_model, newdata = data)

# Scatter plot with predicted CO2 emissions
ggplot(data, aes(x = Capital_Openness, y = CO2_Emissions)) +
  geom_point(color = "blue") +
  geom_line(aes(x = Capital_Openness, y = predicted_co2_base), color = "red", size = 1) +
  labs(title = "Predicted CO2 Emissions (Base Model)", x = "Capital Openness", y = "CO2 Emissions (per capita)") +
  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.

# Predict CO2 emissions using the interaction model
data$predicted_co2_interaction <- predict(interaction_model, newdata = data)

# Scatter plot with predicted CO2 emissions from the interaction model
ggplot(data, aes(x = Capital_Openness, y = CO2_Emissions, color = GDP_per_capita)) +
  geom_point() +
  geom_line(aes(x = Capital_Openness, y = predicted_co2_interaction), color = "red", size = 1) +
  scale_color_viridis_c() +
  labs(title = "Predicted CO2 Emissions (Interaction Model)", x = "Capital Openness", y = "CO2 Emissions (per capita)", color = "GDP per Capita") +
  theme_minimal()