Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

U.S. Energy Trade Barriers

This repository contains the scripts, curated datasets, methodological documentation and generated figure outputs required to reproduce analysis from "Effects of Escalating Trade Barriers on the U.S. Energy System".

Overview

The workflow has two stages:

  1. prepare_input_data.R converts the curated GTA intervention file plus two mapping tables into two analysis-ready Excel datasets.
  2. plot_figures_SetA.R and plot_figures_SetB.R read those prepared datasets and export the final figures.

The analysis is implemented in two complementary counting frameworks:

  • Set A (intervention level): counts unique interventions by sector, with one row per (intervention_id, sector).
  • Set B (intervention-product level): counts intervention-product pairs, with one row per (intervention_id, hs_code) after matching affected HS codes to energy sectors.

Both sets classify observations into five energy system sectors:

  • EV & Batteries
  • Renewable Electricity
  • Other Low-Carbon
  • Fossil Fuels
  • Grid

Methodology

Data on trade barriers from 2009 – 2024 in Figure 1 were sourced from the Global Trade Alert database as of May 2026. GTA tracks unilateral government interventions that affect competitive trade and evaluates them in terms of their degree of discrimination of foreign commercial interests.

  • Trade-barrier observations are sourced from the Global Trade Alert (GTA) database as of May 2026.
  • The analytical sample is limited to U.S.-implementing interventions with Red or Amber GTA evaluations.
  • Liberalizing measures are excluded.
  • Interventions are assigned to one of three policy categories using the GTA MAST chapter:
    • Tariff
    • NTM
    • Subsidies
  • Energy-system exposure is identified through HS-code matching using the curated sector classification in Method/Energy Sector HS Code Classification.xlsx.

The README and scripts distinguish between the repository's two counting units because they answer different methodological questions:

  • Set A measures how many distinct interventions affect each sector.
  • Set B measures how broad product coverage is within those interventions by counting matched HS codes separately.

This means one intervention can appear:

  • once in a sector in Set A, even if it affects multiple HS codes in that same sector;
  • multiple times in Set B if it affects multiple matched HS codes; and
  • in multiple sectors in both sets when its affected products map to more than one sector.

Repository Structure

  • Code/
    • prepare_input_data.R: builds the analysis-ready input files for Set A and Set B.
    • plot_figures_SetA.R: generates all Set A figures from Data/Input Data SetA.xlsx.
    • plot_figures_SetB.R: generates all Set B figures from Data/Input Data SetB.xlsx.
  • Data/
    • GTA Intervention Data.xlsx: curated intervention-level source data.
    • Input Data SetA.xlsx: prepared Set A input data generated by prepare_input_data.R.
    • Input Data SetB.xlsx: prepared Set B input data generated by prepare_input_data.R.
  • Figures/
    • SetA/: exported Set A figures in .png and .pdf formats.
    • SetB/: exported Set B figures in .png and .pdf formats.
  • Method/
    • GTA Intervention Classification.xlsx: maps MAST chapters to policy categories (Tariff, NTM, Subsidies).
    • Energy Sector HS Code Classification.xlsx: maps HS codes to energy system sectors.
    • US Trade Barriers Energy System_Supplementary Material.docx: supplementary methodological documentation.

Data Scope

The curated GTA sample used in this repository is:

  • U.S.-implementing measures
  • Red and Amber interventions only
  • Liberalizing measures excluded
  • Time span: 2009-2024

In prepare_input_data.R, the analysis year is taken from Date Implemented and falls back to Date Announced when Date Implemented is missing. Records are then filtered to the 2009-2024 study window.

Data Processing Logic

Code/prepare_input_data.R implements the following preparation steps:

  1. Reads the curated GTA intervention file and trims source column names.
  2. Maps each intervention's Mast Chapter to Tariff, NTM, or Subsidies using Method/GTA Intervention Classification.xlsx.
  3. Expands the Affected Products field into one row per affected HS code.
  4. Matches HS codes to one of the five energy sectors using Method/Energy Sector HS Code Classification.xlsx.
  5. Builds:
    • Set A by deduplicating to one row per (intervention_id, sector).
    • Set B by retaining one row per (intervention_id, hs_code) after sector matching.

HS-code handling in the preparation script is intentionally strict:

  • codes are normalized to 6-digit strings;
  • Excel-style numeric values such as 123456.0 are coerced to 123456; and
  • only valid 6-digit HS codes are retained for sector matching.

Reproducibility

Requirements

  • R (recommended: R 4.2+)
  • Packages: readxl, writexl, dplyr, tidyr, lubridate, ggplot2, forcats, this.path

Install packages in R:

install.packages(c(
  "readxl", "writexl", "dplyr", "tidyr", "lubridate",
  "ggplot2", "forcats", "this.path"
))

Workflow

Run all scripts from the repository root or from any location, because each script resolves paths relative to its own file location.

  1. Prepare the analysis-ready datasets:
Rscript Code/prepare_input_data.R

This script reads:

  • Data/GTA Intervention Data.xlsx
  • Method/GTA Intervention Classification.xlsx
  • Method/Energy Sector HS Code Classification.xlsx

It writes:

  • Data/Input Data SetA.xlsx
  • Data/Input Data SetB.xlsx
  1. Generate Set A figures:
Rscript Code/plot_figures_SetA.R
  1. Generate Set B figures:
Rscript Code/plot_figures_SetB.R

Figure Outputs

plot_figures_SetA.R exports six figures to Figures/SetA/:

  • SetA_US_Energy_Trade_Barriers_2009-2024_with_subsidies
  • SetA_US_Energy_Trade_Barriers_2009-2024_with_subsidies_no_title
  • SetA_US_Energy_Trade_Barriers_2009-2024_tariff_ntm
  • SetA_US_Energy_Trade_Barriers_2009-2024_tariff_ntm_no_title
  • SetA_US_Energy_Trade_Barriers_2009-2024_annual
  • SetA_US_Energy_Trade_Barriers_2009-2024_annual_no_title

plot_figures_SetB.R exports six figures to Figures/SetB/:

  • SetB_US_Energy_Trade_Barriers_2009-2024_intervention_product_with_subsidies
  • SetB_US_Energy_Trade_Barriers_2009-2024_intervention_product_with_subsidies_no_title
  • SetB_US_Energy_Trade_Barriers_2009-2024_intervention_product_tariff_ntm
  • SetB_US_Energy_Trade_Barriers_2009-2024_intervention_product_tariff_ntm_no_title
  • SetB_US_Energy_Trade_Barriers_2009-2024_intervention_product_annual
  • SetB_US_Energy_Trade_Barriers_2009-2024_intervention_product_annual_no_title

Each exported figure is saved as both .png and .pdf.

The plotted period groupings are:

  • 2009-2012
  • 2013-2016
  • 2017-2020
  • 2021-2024

Interpretation Note

Set A and Set B should be interpreted together:

  • Set A reflects the number of distinct policy interventions affecting each sector.
  • Set B reflects the breadth of product coverage within those interventions.

Because one intervention can affect multiple HS codes and multiple sectors, Set A deduplicates to one count per intervention-sector pair, while Set B retains the product-level breadth.

For the figure variants:

  • the with_subsidies outputs include all three policy categories;
  • the tariff_ntm and annual outputs exclude Subsidies; and
  • the annual line charts aggregate only Tariff and NTM observations.

Citation

If you use this repository, please cite the associated paper:

Citation details to be added upon publication.

License and Data Use

Please follow the licensing and terms of use for underlying data sources, including Global Trade Alert, and contact the authors for reuse questions if needed.

About

Source and documentation for analysis on U.S. energy trade barriers

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages