packages <- c("tidyverse", "srvyr", "broom","gt", "modelsummary",
"gapminder", "fst", "ggridges", "readxl", "readr","here", "sjPlot", "knitr", "car")
new_packages <- packages[!(packages %in% installed.packages()[,"Package"])]
if(length(new_packages)) install.packages(new_packages)
lapply(packages, library, character.only = TRUE)
## ── 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.4
## ── 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
##
## Adjuntando el paquete: 'srvyr'
##
##
## The following object is masked from 'package:stats':
##
## filter
##
##
## here() starts at C:/Users/luisr/OneDrive/Documentos
##
## Cargando paquete requerido: carData
##
##
## Adjuntando el paquete: 'car'
##
##
## The following object is masked from 'package:dplyr':
##
## recode
##
##
## The following object is masked from 'package:purrr':
##
## some
## [[1]]
## [1] "lubridate" "forcats" "stringr" "dplyr" "purrr" "readr"
## [7] "tidyr" "tibble" "ggplot2" "tidyverse" "stats" "graphics"
## [13] "grDevices" "utils" "datasets" "methods" "base"
##
## [[2]]
## [1] "srvyr" "lubridate" "forcats" "stringr" "dplyr" "purrr"
## [7] "readr" "tidyr" "tibble" "ggplot2" "tidyverse" "stats"
## [13] "graphics" "grDevices" "utils" "datasets" "methods" "base"
##
## [[3]]
## [1] "broom" "srvyr" "lubridate" "forcats" "stringr" "dplyr"
## [7] "purrr" "readr" "tidyr" "tibble" "ggplot2" "tidyverse"
## [13] "stats" "graphics" "grDevices" "utils" "datasets" "methods"
## [19] "base"
##
## [[4]]
## [1] "gt" "broom" "srvyr" "lubridate" "forcats" "stringr"
## [7] "dplyr" "purrr" "readr" "tidyr" "tibble" "ggplot2"
## [13] "tidyverse" "stats" "graphics" "grDevices" "utils" "datasets"
## [19] "methods" "base"
##
## [[5]]
## [1] "modelsummary" "gt" "broom" "srvyr" "lubridate"
## [6] "forcats" "stringr" "dplyr" "purrr" "readr"
## [11] "tidyr" "tibble" "ggplot2" "tidyverse" "stats"
## [16] "graphics" "grDevices" "utils" "datasets" "methods"
## [21] "base"
##
## [[6]]
## [1] "gapminder" "modelsummary" "gt" "broom" "srvyr"
## [6] "lubridate" "forcats" "stringr" "dplyr" "purrr"
## [11] "readr" "tidyr" "tibble" "ggplot2" "tidyverse"
## [16] "stats" "graphics" "grDevices" "utils" "datasets"
## [21] "methods" "base"
##
## [[7]]
## [1] "fst" "gapminder" "modelsummary" "gt" "broom"
## [6] "srvyr" "lubridate" "forcats" "stringr" "dplyr"
## [11] "purrr" "readr" "tidyr" "tibble" "ggplot2"
## [16] "tidyverse" "stats" "graphics" "grDevices" "utils"
## [21] "datasets" "methods" "base"
##
## [[8]]
## [1] "ggridges" "fst" "gapminder" "modelsummary" "gt"
## [6] "broom" "srvyr" "lubridate" "forcats" "stringr"
## [11] "dplyr" "purrr" "readr" "tidyr" "tibble"
## [16] "ggplot2" "tidyverse" "stats" "graphics" "grDevices"
## [21] "utils" "datasets" "methods" "base"
##
## [[9]]
## [1] "readxl" "ggridges" "fst" "gapminder" "modelsummary"
## [6] "gt" "broom" "srvyr" "lubridate" "forcats"
## [11] "stringr" "dplyr" "purrr" "readr" "tidyr"
## [16] "tibble" "ggplot2" "tidyverse" "stats" "graphics"
## [21] "grDevices" "utils" "datasets" "methods" "base"
##
## [[10]]
## [1] "readxl" "ggridges" "fst" "gapminder" "modelsummary"
## [6] "gt" "broom" "srvyr" "lubridate" "forcats"
## [11] "stringr" "dplyr" "purrr" "readr" "tidyr"
## [16] "tibble" "ggplot2" "tidyverse" "stats" "graphics"
## [21] "grDevices" "utils" "datasets" "methods" "base"
##
## [[11]]
## [1] "here" "readxl" "ggridges" "fst" "gapminder"
## [6] "modelsummary" "gt" "broom" "srvyr" "lubridate"
## [11] "forcats" "stringr" "dplyr" "purrr" "readr"
## [16] "tidyr" "tibble" "ggplot2" "tidyverse" "stats"
## [21] "graphics" "grDevices" "utils" "datasets" "methods"
## [26] "base"
##
## [[12]]
## [1] "sjPlot" "here" "readxl" "ggridges" "fst"
## [6] "gapminder" "modelsummary" "gt" "broom" "srvyr"
## [11] "lubridate" "forcats" "stringr" "dplyr" "purrr"
## [16] "readr" "tidyr" "tibble" "ggplot2" "tidyverse"
## [21] "stats" "graphics" "grDevices" "utils" "datasets"
## [26] "methods" "base"
##
## [[13]]
## [1] "knitr" "sjPlot" "here" "readxl" "ggridges"
## [6] "fst" "gapminder" "modelsummary" "gt" "broom"
## [11] "srvyr" "lubridate" "forcats" "stringr" "dplyr"
## [16] "purrr" "readr" "tidyr" "tibble" "ggplot2"
## [21] "tidyverse" "stats" "graphics" "grDevices" "utils"
## [26] "datasets" "methods" "base"
##
## [[14]]
## [1] "car" "carData" "knitr" "sjPlot" "here"
## [6] "readxl" "ggridges" "fst" "gapminder" "modelsummary"
## [11] "gt" "broom" "srvyr" "lubridate" "forcats"
## [16] "stringr" "dplyr" "purrr" "readr" "tidyr"
## [21] "tibble" "ggplot2" "tidyverse" "stats" "graphics"
## [26] "grDevices" "utils" "datasets" "methods" "base"
GHG_emissions <- read.csv("C:/Users/luisr/Downloads/owid-co2-data.csv")
glimpse(GHG_emissions)
## Rows: 50,191
## Columns: 79
## $ country <chr> "Afghanistan", "Afghanistan"…
## $ year <int> 1750, 1751, 1752, 1753, 1754…
## $ iso_code <chr> "AFG", "AFG", "AFG", "AFG", …
## $ population <dbl> 2802560, NA, NA, NA, NA, NA,…
## $ gdp <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ cement_co2 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ cement_co2_per_capita <dbl> 0, NA, NA, NA, NA, NA, NA, N…
## $ co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ co2_growth_abs <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ co2_growth_prct <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ co2_including_luc <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ co2_including_luc_growth_abs <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ co2_including_luc_growth_prct <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ co2_including_luc_per_capita <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ co2_including_luc_per_gdp <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ co2_including_luc_per_unit_energy <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ co2_per_capita <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ co2_per_gdp <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ co2_per_unit_energy <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ coal_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ coal_co2_per_capita <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ consumption_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ consumption_co2_per_capita <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ consumption_co2_per_gdp <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ cumulative_cement_co2 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ cumulative_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ cumulative_co2_including_luc <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ cumulative_coal_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ cumulative_flaring_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ cumulative_gas_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ cumulative_luc_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ cumulative_oil_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ cumulative_other_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ energy_per_gdp <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ flaring_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ flaring_co2_per_capita <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ gas_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ gas_co2_per_capita <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ ghg_excluding_lucf_per_capita <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ ghg_per_capita <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ land_use_change_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ land_use_change_co2_per_capita <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ methane <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ methane_per_capita <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ nitrous_oxide <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ nitrous_oxide_per_capita <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ oil_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ oil_co2_per_capita <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ other_co2_per_capita <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ other_industry_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ primary_energy_consumption <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_cement_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_co2_including_luc <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_coal_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_cumulative_cement_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_cumulative_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_cumulative_co2_including_luc <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_cumulative_coal_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_cumulative_flaring_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_cumulative_gas_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_cumulative_luc_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_cumulative_oil_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_cumulative_other_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_flaring_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_gas_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_luc_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_oil_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_global_other_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ share_of_temperature_change_from_ghg <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ temperature_change_from_ch4 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ temperature_change_from_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ temperature_change_from_ghg <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ temperature_change_from_n2o <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ total_ghg <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ total_ghg_excluding_lucf <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ trade_co2 <dbl> NA, NA, NA, NA, NA, NA, NA, …
## $ trade_co2_share <dbl> NA, NA, NA, NA, NA, NA, NA, …
co2_gdp_per_capita_countries <- GHG_emissions %>%
filter(year >= 1990 & year <= 2020) %>%
filter(!is.na(co2_per_capita), !is.na(gdp), !is.na(population))%>%
filter(country %in% c("Germany", "Poland", "France","Ireland")) %>%
group_by(country) %>%
mutate(
GDP_per_capita = gdp / population
) %>%
select(year, country, co2_per_capita, GDP_per_capita)
print(co2_gdp_per_capita_countries)
## # A tibble: 124 × 4
## # Groups: country [4]
## year country co2_per_capita GDP_per_capita
## <int> <chr> <dbl> <dbl>
## 1 1990 France 6.91 28710.
## 2 1991 France 7.30 28881.
## 3 1992 France 7.08 29214.
## 4 1993 France 6.71 28927.
## 5 1994 France 6.56 29519.
## 6 1995 France 6.63 30050.
## 7 1996 France 6.89 30384.
## 8 1997 France 6.74 31013.
## 9 1998 France 7.03 32019.
## 10 1999 France 6.97 33001.
## # ℹ 114 more rows
policy_stringency <- read_csv("C:/Users/luisr/Downloads/policy_stringency.csv")
## Rows: 155 Columns: 22
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (16): STRUCTURE, STRUCTURE_ID, STRUCTURE_NAME, ACTION, REF_AREA, Referen...
## dbl (4): TIME_PERIOD, OBS_VALUE, UNIT_MULT, DECIMALS
## lgl (2): Time period, Observation value
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
glimpse(policy_stringency)
## Rows: 155
## Columns: 22
## $ STRUCTURE <chr> "DATAFLOW", "DATAFLOW", "DATAFLOW", "DATAFL…
## $ STRUCTURE_ID <chr> "OECD.ECO.MAD:DSD_EPS@DF_EPS(1.0)", "OECD.E…
## $ STRUCTURE_NAME <chr> "OECD Environmental Policy Stringency Index…
## $ ACTION <chr> "I", "I", "I", "I", "I", "I", "I", "I", "I"…
## $ REF_AREA <chr> "POL", "IRL", "IRL", "IRL", "IRL", "IRL", "…
## $ `Reference area` <chr> "Poland", "Ireland", "Ireland", "Ireland", …
## $ FREQ <chr> "A", "A", "A", "A", "A", "A", "A", "A", "A"…
## $ `Frequency of observation` <chr> "Annual", "Annual", "Annual", "Annual", "An…
## $ MEASURE <chr> "POL_STRINGENCY", "POL_STRINGENCY", "POL_ST…
## $ Measure <chr> "Policy stringency", "Policy stringency", "…
## $ CLIM_POL <chr> "EPS", "EPS", "EPS", "EPS", "EPS", "EPS", "…
## $ `Climate policies` <chr> "All environmental policies (EPS index)", "…
## $ TIME_PERIOD <dbl> 2002, 1998, 1997, 1996, 1995, 1994, 1993, 1…
## $ `Time period` <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
## $ OBS_VALUE <dbl> 1.2777778, 0.9444444, 0.8888889, 0.8888889,…
## $ `Observation value` <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
## $ UNIT_MULT <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ `Unit multiplier` <chr> "Units", "Units", "Units", "Units", "Units"…
## $ UNIT_MEASURE <chr> "0_TO_6", "0_TO_6", "0_TO_6", "0_TO_6", "0_…
## $ `Unit of measure` <chr> "0-6 scale", "0-6 scale", "0-6 scale", "0-6…
## $ DECIMALS <dbl> 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2…
## $ Decimals <chr> "Two", "Two", "Two", "Two", "Two", "Two", "…
policy_stringency_value <- policy_stringency %>%
filter(TIME_PERIOD >= 1990 & TIME_PERIOD <= 2020) %>%
filter(!is.na(OBS_VALUE), !is.na(TIME_PERIOD),
`Reference area` %in% c("Poland", "Germany", "Ireland", "France")) %>%
arrange(TIME_PERIOD) %>%
select(year = TIME_PERIOD,
country = `Reference area`,
stringency_value = OBS_VALUE)
print(policy_stringency_value)
## # A tibble: 124 × 3
## year country stringency_value
## <dbl> <chr> <dbl>
## 1 1990 Ireland 0.528
## 2 1990 Poland 0.583
## 3 1990 France 1.44
## 4 1990 Germany 1.44
## 5 1991 Ireland 0.472
## 6 1991 Poland 0.528
## 7 1991 France 1.33
## 8 1991 Germany 1.69
## 9 1992 Ireland 0.528
## 10 1992 Poland 0.583
## # ℹ 114 more rows
energy_data <- read_csv("C:/Users/luisr/Downloads/owid-energy-data.csv")
## Rows: 21812 Columns: 130
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): country, iso_code
## dbl (128): year, population, gdp, biofuel_cons_change_pct, biofuel_cons_chan...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
glimpse(energy_data)
## Rows: 21,812
## Columns: 130
## $ country <chr> "ASEAN (Ember)", "ASEAN (…
## $ year <dbl> 2000, 2001, 2002, 2003, 2…
## $ iso_code <chr> NA, NA, NA, NA, NA, NA, N…
## $ population <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gdp <dbl> NA, NA, NA, NA, NA, NA, N…
## $ biofuel_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ biofuel_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ biofuel_cons_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ biofuel_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ biofuel_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ biofuel_electricity <dbl> 5.87, 6.46, 6.62, 7.45, 8…
## $ biofuel_share_elec <dbl> 1.550, 1.596, 1.528, 1.62…
## $ biofuel_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ carbon_intensity_elec <dbl> 569.557, 567.642, 570.212…
## $ coal_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_cons_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_electricity <dbl> 76.03, 86.26, 93.43, 102.…
## $ coal_prod_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_prod_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_prod_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_production <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_share_elec <dbl> 20.081, 21.307, 21.568, 2…
## $ coal_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ electricity_demand <dbl> 378.61, 404.85, 433.19, 4…
## $ electricity_demand_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ electricity_generation <dbl> 378.61, 404.85, 433.19, 4…
## $ electricity_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ energy_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ energy_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ energy_per_gdp <dbl> NA, NA, NA, NA, NA, NA, N…
## $ fossil_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ fossil_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ fossil_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ fossil_electricity <dbl> 305.36, 327.66, 356.67, 3…
## $ fossil_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ fossil_fuel_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ fossil_share_elec <dbl> 80.653, 80.934, 82.336, 8…
## $ fossil_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_electricity <dbl> 164.26, 190.41, 208.92, 2…
## $ gas_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_prod_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_prod_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_prod_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_production <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_share_elec <dbl> 43.385, 47.032, 48.228, 4…
## $ gas_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ greenhouse_gas_emissions <dbl> 215.64, 229.81, 247.01, 2…
## $ hydro_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ hydro_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ hydro_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ hydro_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ hydro_electricity <dbl> 50.45, 54.33, 53.29, 53.2…
## $ hydro_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ hydro_share_elec <dbl> 13.325, 13.420, 12.302, 1…
## $ hydro_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ low_carbon_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ low_carbon_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ low_carbon_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ low_carbon_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ low_carbon_electricity <dbl> 73.25, 77.19, 76.52, 76.4…
## $ low_carbon_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ low_carbon_share_elec <dbl> 19.347, 19.066, 17.664, 1…
## $ low_carbon_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ net_elec_imports <dbl> NA, NA, NA, NA, NA, NA, N…
## $ net_elec_imports_share_demand <dbl> NA, NA, NA, NA, NA, NA, N…
## $ nuclear_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ nuclear_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ nuclear_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ nuclear_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ nuclear_electricity <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ nuclear_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ nuclear_share_elec <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ nuclear_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_electricity <dbl> 65.07, 50.99, 54.32, 53.3…
## $ oil_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_prod_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_prod_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_prod_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_production <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_share_elec <dbl> 17.187, 12.595, 12.540, 1…
## $ oil_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ other_renewable_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ other_renewable_electricity <dbl> 22.80, 22.86, 23.23, 23.1…
## $ other_renewable_exc_biofuel_electricity <dbl> 16.93, 16.40, 16.61, 15.7…
## $ other_renewables_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ other_renewables_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ other_renewables_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ other_renewables_elec_per_capita_exc_biofuel <dbl> NA, NA, NA, NA, NA, NA, N…
## $ other_renewables_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ other_renewables_share_elec <dbl> 6.022, 5.647, 5.363, 5.06…
## $ other_renewables_share_elec_exc_biofuel <dbl> 4.472, 4.051, 3.834, 3.43…
## $ other_renewables_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ per_capita_electricity <dbl> NA, NA, NA, NA, NA, NA, N…
## $ primary_energy_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ renewables_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ renewables_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ renewables_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ renewables_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ renewables_electricity <dbl> 73.25, 77.19, 76.52, 76.4…
## $ renewables_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ renewables_share_elec <dbl> 19.347, 19.066, 17.664, 1…
## $ renewables_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ solar_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ solar_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ solar_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ solar_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ solar_electricity <dbl> 0.00, 0.00, 0.00, 0.00, 0…
## $ solar_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ solar_share_elec <dbl> 0.000, 0.000, 0.000, 0.00…
## $ solar_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ wind_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ wind_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ wind_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ wind_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ wind_electricity <dbl> 0.00, 0.00, 0.00, 0.00, 0…
## $ wind_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ wind_share_elec <dbl> 0.000, 0.000, 0.000, 0.00…
## $ wind_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
energy_mix <- energy_data %>%
filter(year >= 1990 & year <= 2020) %>%
filter(!is.na(renewables_energy_per_capita))%>%
filter(country %in% c("Germany", "France", "Poland", "Ireland")) %>%
select(year, country, renewables_energy_per_capita) %>%
group_by(country)
print(energy_mix)
## # A tibble: 124 × 3
## # Groups: country [4]
## year country renewables_energy_per_capita
## <dbl> <chr> <dbl>
## 1 1990 France 2932.
## 2 1991 France 3125.
## 3 1992 France 3707.
## 4 1993 France 3480.
## 5 1994 France 4211.
## 6 1995 France 3926.
## 7 1996 France 3569.
## 8 1997 France 3467.
## 9 1998 France 3359.
## 10 1999 France 3885.
## # ℹ 114 more rows
co2_gdp_energy_joint <- left_join(co2_gdp_per_capita_countries, energy_mix)
## Joining with `by = join_by(year, country)`
variables_of_interest_joint <- left_join(co2_gdp_energy_joint, policy_stringency_value)
## Joining with `by = join_by(year, country)`
variables_of_interest_joint
## # A tibble: 124 × 6
## # Groups: country [4]
## year country co2_per_capita GDP_per_capita renewables_energy_per_capita
## <dbl> <chr> <dbl> <dbl> <dbl>
## 1 1990 France 6.91 28710. 2932.
## 2 1991 France 7.30 28881. 3125.
## 3 1992 France 7.08 29214. 3707.
## 4 1993 France 6.71 28927. 3480.
## 5 1994 France 6.56 29519. 4211.
## 6 1995 France 6.63 30050. 3926.
## 7 1996 France 6.89 30384. 3569.
## 8 1997 France 6.74 31013. 3467.
## 9 1998 France 7.03 32019. 3359.
## 10 1999 France 6.97 33001. 3885.
## # ℹ 114 more rows
## # ℹ 1 more variable: stringency_value <dbl>
final_sample_size <- variables_of_interest_joint %>%
filter(year >= 1990 & year <= 2020) %>%
filter(country %in% c("Germany", "France", "Poland", "Ireland")) %>%
filter(
!is.na(co2_per_capita),
!is.na(GDP_per_capita),
!is.na(stringency_value)
) %>%
nrow()
cat("Final sample size (country-year observations):", final_sample_size)
## Final sample size (country-year observations): 124
Tables
co2_per_capita_data <- variables_of_interest_joint %>%
filter(year >= 1990 & year <= 2020) %>%
filter(!is.na(co2_per_capita ))%>%
filter(country %in% c("Germany", "France", "Poland", "Ireland")) %>%
group_by(country) %>%
summarise(
Years = paste0(min(year, na.rm = TRUE), "-", max(year, na.rm = TRUE)),
co2_per_capita_mean = mean(co2_per_capita , na.rm = TRUE),
co2_per_capita_median = median(co2_per_capita , na.rm = TRUE),
co2_per_capita_range = paste(round(min(co2_per_capita , na.rm = TRUE), 2), "-", round(max(co2_per_capita , na.rm = TRUE), 2)),
.groups = "drop"
)
print(co2_per_capita_data)
## # A tibble: 4 × 5
## country Years co2_per_capita_mean co2_per_capita_median co2_per_capita_range
## <chr> <chr> <dbl> <dbl> <chr>
## 1 France 1990-2… 6.18 6.56 4.26 - 7.3
## 2 Germany 1990-2… 10.6 10.7 7.75 - 13.23
## 3 Ireland 1990-2… 9.74 9.53 7.05 - 12.32
## 4 Poland 1990-2… 8.77 8.67 7.92 - 9.9
co2_per_capita_table <- co2_per_capita_data %>%
gt() %>%
cols_label(
country = "Country",
Years = "Year Range",
co2_per_capita_mean = "Mean",
co2_per_capita_median = "Median",
co2_per_capita_range = "CO2 per Capita Range"
) %>%
fmt_number(columns = c(co2_per_capita_mean, co2_per_capita_median, co2_per_capita_range), decimals = 2) %>%
tab_header(
title = md("**Descriptive Statistics for CO2 per Capita**"),
subtitle = md("Measured in Tonnes per person")
) %>%
tab_source_note(
source_note = md(paste("Sample size:", final_sample_size, "country-year observations"))
) %>%
tab_style(
style = cell_text(weight = "bold"),
locations = cells_column_labels()
)
co2_per_capita_table
| Descriptive Statistics for CO2 per Capita |
| Measured in Tonnes per person |
| Country |
Year Range |
Mean |
Median |
CO2 per Capita Range |
| France |
1990-2020 |
6.18 |
6.57 |
4.26 - 7.3 |
| Germany |
1990-2020 |
10.62 |
10.68 |
7.75 - 13.23 |
| Ireland |
1990-2020 |
9.74 |
9.53 |
7.05 - 12.32 |
| Poland |
1990-2020 |
8.77 |
8.67 |
7.92 - 9.9 |
| Sample size: 124 country-year observations |
gdp_per_capita_data <- variables_of_interest_joint %>%
filter(year >= 1990 & year <= 2020) %>%
filter(!is.na(GDP_per_capita ))%>%
filter(country %in% c("Germany", "France", "Poland", "Ireland")) %>%
group_by(country) %>%
summarise(
Years = paste0(min(year, na.rm = TRUE), "-", max(year, na.rm = TRUE)),
gdp_per_capita_mean = mean(GDP_per_capita, na.rm = TRUE),
gdp_per_capita_median = median(GDP_per_capita, na.rm = TRUE),
gdp_per_capita_range = paste(round(min(GDP_per_capita, na.rm = TRUE), 2), "-", round(max(GDP_per_capita , na.rm = TRUE), 2)),
.groups = "drop"
)
print(gdp_per_capita_data)
## # A tibble: 4 × 5
## country Years gdp_per_capita_mean gdp_per_capita_median gdp_per_capita_range
## <chr> <chr> <dbl> <dbl> <chr>
## 1 France 1990-2… 34867. 36329. 28710.31 - 40232.4
## 2 Germany 1990-2… 36607. 35900. 25286.65 - 46510.66
## 3 Ireland 1990-2… 41672. 47362. 18806.83 - 59694.79
## 4 Poland 1990-2… 16970. 15632. 7634.77 - 29331.74
gdp_per_capita_table <- gdp_per_capita_data %>%
gt() %>%
cols_label(
country = "Country",
Years = "Year Range",
gdp_per_capita_mean = "Mean",
gdp_per_capita_median = "Median",
gdp_per_capita_range = "GDP per Capita Range"
) %>%
fmt_number(columns = c(gdp_per_capita_mean, gdp_per_capita_median), decimals = 2) %>%
tab_header(
title = md("**Descriptive Statistics for GDP per Capita**"),
subtitle = md("Measured in Dollars per person")
) %>%
tab_source_note(
source_note = md(paste("This data is adjusted for inflation and differences in the cost of living between countries.
\nSample size:", final_sample_size, "country-year observations"))
) %>%
tab_style(
style = cell_text(weight = "bold"),
locations = cells_column_labels()
)
gdp_per_capita_table
| Descriptive Statistics for GDP per Capita |
| Measured in Dollars per person |
| Country |
Year Range |
Mean |
Median |
GDP per Capita Range |
| France |
1990-2020 |
34,866.93 |
36,329.24 |
28710.31 - 40232.4 |
| Germany |
1990-2020 |
36,607.22 |
35,899.80 |
25286.65 - 46510.66 |
| Ireland |
1990-2020 |
41,671.55 |
47,361.97 |
18806.83 - 59694.79 |
| Poland |
1990-2020 |
16,969.84 |
15,631.96 |
7634.77 - 29331.74 |
| This data is adjusted for inflation and differences in the cost of living between countries.
Sample size: 124 country-year observations |
renewables_data <- energy_data %>%
filter(year >= 1990 & year <= 2020) %>%
filter(!is.na(renewables_energy_per_capita))%>%
filter(country %in% c("Germany", "France", "Poland", "Ireland")) %>%
group_by(country) %>%
summarise(
Years = paste0(min(year, na.rm = TRUE), "-", max(year, na.rm = TRUE)),
renewables_mean = mean(renewables_energy_per_capita, na.rm = TRUE),
renewables_median = median(renewables_energy_per_capita, na.rm = TRUE),
renewables_range = paste(round(min(renewables_energy_per_capita, na.rm = TRUE), 2), "-", round(max(renewables_energy_per_capita, na.rm = TRUE), 2)),
.groups = "drop"
)
print(renewables_data)
## # A tibble: 4 × 5
## country Years renewables_mean renewables_median renewables_range
## <chr> <chr> <dbl> <dbl> <chr>
## 1 France 1990-2020 3846. 3707. 2795.18 - 5571.42
## 2 Germany 1990-2020 3435. 2541. 651.49 - 8730.23
## 3 Ireland 1990-2020 2405. 1314. 591.34 - 7660.49
## 4 Poland 1990-2020 781. 313. 114.69 - 2360.37
renewables_energy_table <- renewables_data %>%
gt() %>%
cols_label(
country = "Country",
Years = "Year Range",
renewables_mean = "Mean",
renewables_median = "Median",
renewables_range = "Fossil Fuel Energy Range"
) %>%
fmt_number(columns = c(renewables_mean, renewables_median), decimals = 2) %>%
tab_header(
title = md("**Descriptive Statistics for Energy consumption from Renewable sources**"),
subtitle = md("Measured in kilowatt-hours per person")
) %>%
tab_source_note(
source_note = md(paste("Sample size:", final_sample_size, "country-year observations"))
) %>%
tab_style(
style = cell_text(weight = "bold"),
locations = cells_column_labels()
)
renewables_energy_table
| Descriptive Statistics for Energy consumption from Renewable sources |
| Measured in kilowatt-hours per person |
| Country |
Year Range |
Mean |
Median |
Fossil Fuel Energy Range |
| France |
1990-2020 |
3,845.85 |
3,706.96 |
2795.18 - 5571.42 |
| Germany |
1990-2020 |
3,435.38 |
2,541.42 |
651.49 - 8730.23 |
| Ireland |
1990-2020 |
2,404.56 |
1,314.38 |
591.34 - 7660.49 |
| Poland |
1990-2020 |
780.95 |
312.64 |
114.69 - 2360.37 |
| Sample size: 124 country-year observations |
policy_stringency_data <- variables_of_interest_joint %>%
summarise(
Years = paste0(min(year, na.rm = TRUE), "-", max(year, na.rm = TRUE)),
stringency_mean = mean(stringency_value, na.rm = TRUE),
stringency_median = median(stringency_value, na.rm = TRUE),
stringency_range = paste(round(min(stringency_value, na.rm = TRUE), 2), "-", round(max(stringency_value, na.rm = TRUE), 2)),
.groups = "drop"
)
print(policy_stringency_data)
## # A tibble: 4 × 5
## country Years stringency_mean stringency_median stringency_range
## <chr> <chr> <dbl> <dbl> <chr>
## 1 France 1990-2020 2.80 2.86 1.33 - 4.89
## 2 Germany 1990-2020 2.48 2.78 1.44 - 3.47
## 3 Ireland 1990-2020 1.80 2.08 0.47 - 3
## 4 Poland 1990-2020 1.88 2.08 0.53 - 3.47
policy_stringency_table <- policy_stringency_data %>%
gt() %>%
cols_label(
country = "Country",
Years = "Year Range",
stringency_mean = "Mean",
stringency_median = "Median",
stringency_range = "policy stringency Range"
) %>%
fmt_number(columns = c(stringency_mean, stringency_median), decimals = 2) %>%
tab_header(
title = md("**Descriptive Statistics for Environmental Policy Stringency**"),
subtitle = md("All environmental policy stringency measured on a 0-6 scale.")
) %>%
tab_source_note(
source_note = md(paste("Sample size:", final_sample_size, "country-year observations"))
) %>%
tab_style(
style = cell_text(weight = "bold"),
locations = cells_column_labels()
)
policy_stringency_table
| Descriptive Statistics for Environmental Policy Stringency |
| All environmental policy stringency measured on a 0-6 scale. |
| Country |
Year Range |
Mean |
Median |
policy stringency Range |
| France |
1990-2020 |
2.80 |
2.86 |
1.33 - 4.89 |
| Germany |
1990-2020 |
2.48 |
2.78 |
1.44 - 3.47 |
| Ireland |
1990-2020 |
1.80 |
2.08 |
0.47 - 3 |
| Poland |
1990-2020 |
1.88 |
2.08 |
0.53 - 3.47 |
| Sample size: 124 country-year observations |
Graph
co2_policy_stringency_clean <- variables_of_interest_joint %>%
filter(year >= 1990 & year <= 2022) %>%
filter(!is.na(co2_per_capita), !is.na(stringency_value))%>%
filter(country %in% c("Germany", "Poland", "France", "Finland", "Ireland")) %>%
select(year, country, co2_per_capita, stringency_value) %>%
group_by(country)
print(co2_policy_stringency_clean)
## # A tibble: 124 × 4
## # Groups: country [4]
## year country co2_per_capita stringency_value
## <dbl> <chr> <dbl> <dbl>
## 1 1990 France 6.91 1.44
## 2 1991 France 7.30 1.33
## 3 1992 France 7.08 1.33
## 4 1993 France 6.71 1.33
## 5 1994 France 6.56 1.39
## 6 1995 France 6.63 1.39
## 7 1996 France 6.89 1.47
## 8 1997 France 6.74 1.47
## 9 1998 France 7.03 1.47
## 10 1999 France 6.97 1.64
## # ℹ 114 more rows
co2_policy_long <- co2_policy_stringency_clean %>%
select(
"CO2 per Capita" = co2_per_capita,
"Policy Stringency" = stringency_value,
year,
country
) %>%
pivot_longer(
cols = c("CO2 per Capita", "Policy Stringency"),
names_to = "metric",
values_to = "value"
)
ggplot(
co2_policy_long,
aes(
x = year,
y = value,
color = country
)
) +
geom_line(linewidth = 1.2) +
scale_color_brewer(palette = "Set1") +
facet_wrap(~metric,
ncol = 1,
scales = "free_y",
strip.position = "top") +
scale_x_continuous(
breaks = seq(1990, 2020, by = 5),
limits = c(1990, 2020)
) +
theme(
strip.text = element_text(size = 12, face = "bold"),
strip.placement = "outside",
strip.background = element_blank(),
panel.background = element_blank(),
panel.grid = element_blank(),
axis.line = element_line(),
plot.title = element_text(face = "bold", size = 14, hjust = 0.5),
plot.subtitle = element_text(size = 12, hjust = 0.5),
legend.position = "right",
axis.title.y = element_text(size = 10.5, hjust = 0.3),
legend.title = element_text(face = "bold", size = 12),
plot.caption = element_text(face = "italic", hjust = 0)
) +
labs(
title = "Comparison between CO2 emissions and environmental policy stringency",
subtitle = "in OECD countries (1990-2020)",
x = "Year",
y = "All environmental policy Tonnes per person",
color = "Country",
caption = paste("Emissions of carbon dioxide (CO2), excluding land-use change, measured in tonnes per person. \nAll environmental policy stringency measured on a 0-6 scale. \n0 means no policy in place, and higher numbers mean stricter policies, with 6 being the most stringent.")
)

Regression Models
model_data <- variables_of_interest_joint %>%
filter(
year >= 1990 & year <= 2020,
country %in% c("Germany", "France", "Poland", "Ireland"),
!is.na(co2_per_capita),
!is.na(stringency_value),
!is.na(GDP_per_capita),
!is.na(renewables_energy_per_capita)
) %>%
mutate(
renewables_energy_per_capita_scaled = renewables_energy_per_capita / 1000,
GDP_per_capita_scaled = GDP_per_capita / 1000
)
print(model_data)
## # A tibble: 124 × 8
## # Groups: country [4]
## year country co2_per_capita GDP_per_capita renewables_energy_per_capita
## <dbl> <chr> <dbl> <dbl> <dbl>
## 1 1990 France 6.91 28710. 2932.
## 2 1991 France 7.30 28881. 3125.
## 3 1992 France 7.08 29214. 3707.
## 4 1993 France 6.71 28927. 3480.
## 5 1994 France 6.56 29519. 4211.
## 6 1995 France 6.63 30050. 3926.
## 7 1996 France 6.89 30384. 3569.
## 8 1997 France 6.74 31013. 3467.
## 9 1998 France 7.03 32019. 3359.
## 10 1999 France 6.97 33001. 3885.
## # ℹ 114 more rows
## # ℹ 3 more variables: stringency_value <dbl>,
## # renewables_energy_per_capita_scaled <dbl>, GDP_per_capita_scaled <dbl>
model1 <- lm(co2_per_capita ~ stringency_value, data = model_data)
summary(model1)
##
## Call:
## lm(formula = co2_per_capita ~ stringency_value, data = model_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.0162 -1.5308 -0.1083 1.7354 3.7010
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 10.8118 0.3626 29.820 < 2e-16 ***
## stringency_value -0.8860 0.1461 -6.064 1.53e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.736 on 122 degrees of freedom
## Multiple R-squared: 0.2316, Adjusted R-squared: 0.2253
## F-statistic: 36.77 on 1 and 122 DF, p-value: 1.533e-08
tab_model(model1, auto.label=TRUE)
|
|
co2_per_capita
|
|
Predictors
|
Estimates
|
CI
|
p
|
|
(Intercept)
|
10.81
|
10.09 – 11.53
|
<0.001
|
|
stringency value
|
-0.89
|
-1.18 – -0.60
|
<0.001
|
|
Observations
|
124
|
|
R2 / R2 adjusted
|
0.232 / 0.225
|
model2 <- lm(co2_per_capita ~ stringency_value + GDP_per_capita_scaled, data = model_data)
summary(model2)
##
## Call:
## lm(formula = co2_per_capita ~ stringency_value + GDP_per_capita_scaled,
## data = model_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.1346 -1.4684 0.1223 1.3465 3.7953
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9.98433 0.43726 22.834 < 2e-16 ***
## stringency_value -1.18865 0.17053 -6.970 1.79e-10 ***
## GDP_per_capita_scaled 0.04628 0.01466 3.156 0.00202 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.675 on 121 degrees of freedom
## Multiple R-squared: 0.29, Adjusted R-squared: 0.2783
## F-statistic: 24.72 on 2 and 121 DF, p-value: 9.988e-10
tab_model(model2, auto.label=TRUE)
|
|
co2_per_capita
|
|
Predictors
|
Estimates
|
CI
|
p
|
|
(Intercept)
|
9.98
|
9.12 – 10.85
|
<0.001
|
|
stringency value
|
-1.19
|
-1.53 – -0.85
|
<0.001
|
|
GDP per capita scaled
|
0.05
|
0.02 – 0.08
|
0.002
|
|
Observations
|
124
|
|
R2 / R2 adjusted
|
0.290 / 0.278
|
model3 <- lm(co2_per_capita ~ stringency_value + GDP_per_capita_scaled + renewables_energy_per_capita_scaled, data = model_data)
summary(model3)
##
## Call:
## lm(formula = co2_per_capita ~ stringency_value + GDP_per_capita_scaled +
## renewables_energy_per_capita_scaled, data = model_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.147 -1.274 0.075 0.732 3.380
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 8.88735 0.43028 20.655 < 2e-16 ***
## stringency_value -0.75906 0.16795 -4.520 1.46e-05 ***
## GDP_per_capita_scaled 0.09813 0.01572 6.241 6.78e-09 ***
## renewables_energy_per_capita_scaled -0.59314 0.10137 -5.851 4.33e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.484 on 120 degrees of freedom
## Multiple R-squared: 0.4476, Adjusted R-squared: 0.4338
## F-statistic: 32.42 on 3 and 120 DF, p-value: 2.031e-15
tab_model(model3, auto.label=TRUE)
|
|
co2_per_capita
|
|
Predictors
|
Estimates
|
CI
|
p
|
|
(Intercept)
|
8.89
|
8.04 – 9.74
|
<0.001
|
|
stringency value
|
-0.76
|
-1.09 – -0.43
|
<0.001
|
|
GDP per capita scaled
|
0.10
|
0.07 – 0.13
|
<0.001
|
renewables energy per capita scaled
|
-0.59
|
-0.79 – -0.39
|
<0.001
|
|
Observations
|
124
|
|
R2 / R2 adjusted
|
0.448 / 0.434
|
library(sjPlot)
tab_model(model1, model2, model3,
title = "Table 5. Regression Estimates for Models 1, 2, and 3")
Table 5. Regression Estimates for Models 1, 2, and 3
|
|
co2_per_capita
|
co2_per_capita
|
co2_per_capita
|
|
Predictors
|
Estimates
|
CI
|
p
|
Estimates
|
CI
|
p
|
Estimates
|
CI
|
p
|
|
(Intercept)
|
10.81
|
10.09 – 11.53
|
<0.001
|
9.98
|
9.12 – 10.85
|
<0.001
|
8.89
|
8.04 – 9.74
|
<0.001
|
|
stringency value
|
-0.89
|
-1.18 – -0.60
|
<0.001
|
-1.19
|
-1.53 – -0.85
|
<0.001
|
-0.76
|
-1.09 – -0.43
|
<0.001
|
|
GDP per capita scaled
|
|
|
|
0.05
|
0.02 – 0.08
|
0.002
|
0.10
|
0.07 – 0.13
|
<0.001
|
renewables energy per capita scaled
|
|
|
|
|
|
|
-0.59
|
-0.79 – -0.39
|
<0.001
|
|
Observations
|
124
|
124
|
124
|
|
R2 / R2 adjusted
|
0.232 / 0.225
|
0.290 / 0.278
|
0.448 / 0.434
|
library(sjPlot)
plot_model(model3,
type = "std",
title = "Figure 6. Standardized Coefficient Plot – Model 3",
show.values = TRUE,
value.offset = 0.3)
