Skip to main content

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

Project description

Revealed Comparative Advantage Calculator

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 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 = importer, j = exporter, 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

  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:

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.0.tar.gz (9.2 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.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rca_batch_calc-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9af6cb7fea43a593ad049d710272ac45a205be6185afd1ccdd05512f79322181
MD5 1d4a8a1d5fd60dd4c4730d12f2700065
BLAKE2b-256 85ab304bc893497fc3a35201d9f8c4a716c1c0942eb3fc02206f0d8205c1451d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rca_batch_calc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4c2d815ffe19f6c443ce8ab92f76bcb9dd2d1a8cb711acfdfa80646fbda9811
MD5 8b6cafc19fcd2a459ea759f6e9dddead
BLAKE2b-256 369fc63e8acc4bd1b3112e500e3cc37cd7ba6cc54172b1a7ce0ad2a2cdb1054d

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