Skip to main content

A tool to calculate Revealed Comparative Advantage (RCA) in batch.

Project description

Revealed Comparative Advantage Calculator

PyPI - Version DOI

This is the repository associated with the manuscript Competitiveness analysis to identify marginal suppliers in consequential LCA: A seaweed case.

The repository is designed as a Python library to help users calculate Revealed Comparative Advantage (RCA) using BACI trade data.

📖 Background Knowledge

BACI Dataset

The BACI (from CEPII) dataset offers detailed information on bilateral trade flows for 200 countries, broken down by product (covering 5,000 products). The data spans various time periods, ranging from 2 to 28 years, depending on the specific dataset. Each year's data is stored in a separate CSV file. Each file contains six columns: t = year, i = exporter, j = importer, k = product, v = value, and q = quantity, and comprises over one million rows of data.

This library can calculate RCA for both quantity (metric tons) and value (thousand USD).

Revealed Comparative Advantage (RCA)

In international economics, the RCA is a metric that evaluating the relative advantage or disadvantage of a certain country in a certain class of goods or services as evidenced by trade flows. It is based on the Ricardian comparative advantage concept. WIKI

Formula

$RCA^i_j = \left( \frac{X^i_j}{X^i_n} \middle/ \frac{X^w_j}{X^w_n} \right)$ Where:

  • $X^i_j$: Export value of commodity i from a country to country j.
  • $X^i_n$: Total export value of commodity i from all exporting countries to country j.
  • $X^w_j$: Total export value of all commodities from a country to country j.
  • $X^w_n$: Total export value of all commodities from all exporting to country j.
  • $RCA^i_j$: Comparative advantage of commodity i of a country in country j.

Reference:
Competitiveness of Indonesian Non-Human Consumption Seaweed in the China Market.pdf

✨ Features

(applicable to all BACI dataset versions)

  1. Get the data for specific products from the BACI dataset.
  2. Calculate RCA in batches.
  3. Convert country codes into country names.

👩‍💻 Quick Start

Requirements

  • This project was developed using Python 3.12.9.

Option 1. Install via pip

  1. Open your local terminal.
    (For windows, search for "Terminal/Prompt/PowerShell"; for macOS, search for "Terminal")

  2. Install the library.

    pip install rca_batch_calc
    
  3. Follow the instructions in Example to use the library.

Option 2. Clone and run from GitHub

  1. Open your local terminal.
    (For windows, search for "Terminal/Prompt/PowerShell"; for macOS, search for "Terminal")
  2. Clone this repository into your local computer
git clone https://github.com/Annedrew/Revealed-Comparative-Advantage-Calculator.git
  1. Navigate into the project folder:
cd Revealed-Comparative-Advantage-Calculator
  1. Install dependencies:
pip install pandas
  1. Follow the instructions in Example to use the library.

💬 Contact

If you encounter any issues or would like to contribute to the library, please contact:

Funding

Ravalnath Shikhare’s contribution is funded by the FunSea Project (Horizon Europe BlueBio Partnership, grant number 3157-00016B). Ning An’s contribution is funded by the ALIGNED project (Horizon Europe, grant number 101059430). Massimo Pizzol’s contribution is funded by both FunSea and ALIGNED.

Acknowledgements

The work was partially supported by DeiC National HPC (g.a. DeiC-AAU-L1-402401).

Conflict of Interest statement

The authors declare no conflict of interest.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rca_batch_calc-0.1.6.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rca_batch_calc-0.1.6-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file rca_batch_calc-0.1.6.tar.gz.

File metadata

  • Download URL: rca_batch_calc-0.1.6.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rca_batch_calc-0.1.6.tar.gz
Algorithm Hash digest
SHA256 6b215961e23d00a8994361fcdf196f131533538cf8626cf402d0907c869ae6e7
MD5 6259a212da52475ed479b4c670441cbd
BLAKE2b-256 93beaa81af4ac10a42727a2ec479d51fe6373f3b3a29cb2c7fdca393b27f75d6

See more details on using hashes here.

File details

Details for the file rca_batch_calc-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: rca_batch_calc-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rca_batch_calc-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 aa3564a00bffea767eaae23cec749c1107682c8d0153f31b0d5671abb5e36978
MD5 175f371754edd01981bce30f2d1c9aea
BLAKE2b-256 3a86ecbff5dc80f918ab7bb7f5e0b4f68b4e19f4c6ef7293c4ba4252079edb06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page