Skip to main content

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

Project description

Revealed Comparative Advantage Calculator

PyPI - Version

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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: rca_batch_calc-0.1.4.tar.gz
  • Upload date:
  • Size: 9.3 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.4.tar.gz
Algorithm Hash digest
SHA256 54aeb94ecb7a2416b8b49192ddc5c1cf3629bc06964ce63dd915718ce390fe8e
MD5 1074e559c17f46ce723f90c87c15381d
BLAKE2b-256 e989d9f295fc1f6ea875fb37f655c9016f7271108c23c6b25810201cee1cd437

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rca_batch_calc-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 de505e01f319a0f968a1bc300e8f2b40aff78d07ea48e8d9c6ed71e2b57dd7b3
MD5 7d46e0981be2579fe2ca9c55fc98f067
BLAKE2b-256 82c3934ca6add5b7f6217a9918374a0e33e712973a9fc21951d01228a850664b

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