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 (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)
- Get the data for specific products from the BACI dataset.
- Calculate RCA in batches.
- Convert country codes into country names.
👩💻 Quick Start
Requirements
- This project was developed using Python 3.12.9.
Option 1. Install via pip
-
Open your local terminal.
(For windows, search for "Terminal/Prompt/PowerShell"; for macOS, search for "Terminal") -
Install the library.
pip install rca_batch_calc -
Follow the instructions in Example to use the library.
Option 2. Clone and run from GitHub
- Open your local terminal.
(For windows, search for "Terminal/Prompt/PowerShell"; for macOS, search for "Terminal") - Clone this repository into your local computer
git clone https://github.com/Annedrew/Revealed-Comparative-Advantage-Calculator.git
- Navigate into the project folder:
cd Revealed-Comparative-Advantage-Calculator
- Install dependencies:
pip install pandas
- 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:
- Ning An (ningan@plan.aau.dk)
- Ravalnath Shikhare (ravshi@plan.aau.dk)
- Massimo Pizzol (massimo@plan.aau.dk)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rca_batch_calc-0.1.5.tar.gz.
File metadata
- Download URL: rca_batch_calc-0.1.5.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56bc0553ffba0bfc06a1259caaeed7938710e57a66c9870f8a9c04a66985a04b
|
|
| MD5 |
81d4054c5c6d3992606c7e1867210475
|
|
| BLAKE2b-256 |
aaf0add20f4a9703852b9fa1ec715c6d0de36bd253298af5556ec30e5021125b
|
File details
Details for the file rca_batch_calc-0.1.5-py3-none-any.whl.
File metadata
- Download URL: rca_batch_calc-0.1.5-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
549881f8a041f5ee3cc7874c8e072879642009031faac6aa6d3f50d305de2a9b
|
|
| MD5 |
cd62ebd7d8206ffacf9cbc406b9f0e01
|
|
| BLAKE2b-256 |
67691e4f1189ee0d5e512290fc6c80d268754645e8779207c2ae1e4d17a5b760
|