Skip to content

Latest commit

 

History

38 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🇸🇳 Senegal Macroeconomic Analysis

The goal is to build a structured and reproducible macroeconomic analysis pipeline that retrieves, cleans, transforms, visualizes, and interprets economic data from the World Bank API.


Indicators

The current analysis focuses on GDP, with inflation planned as the next macroeconomic indicator.

  • GDP — NY.GDP.MKTP.CD
  • Inflation — FP.CPI.TOTL.ZG (planned)

Data Source

All data is retrieved from the World Bank Open Data API.

  • Country: Senegal (SN)
  • Period: 1990 – 2024

Project Structure

senegal-macro-analysis/
│
├── data/
│   ├── raw/
│   └── processed/
│
├── notebooks/
│   └── senegal_macroeconomic_analysis.ipynb
│
├── src/
│   ├── __init__.py
│   ├── data.py
│   ├── cleaning.py
│   ├── indicators.py
│   ├── time_series.py
│   └── visualization.py
│
├── README.md
└── requirements.txt

Methodology

The analysis follows a structured pipeline:

  1. Data collection from the World Bank API
  2. Data cleaning and preprocessing
  3. Macroeconomic indicator computation
    • GDP growth rate
    • CAGR / TCAM
    • Moving average
    • Volatility
    • Rolling volatility
  4. Data visualization and economic interpretation

Utility Modules

Reusable functions are implemented in the src/ directory and organized by responsibility.

src/data.py includes:

  • get_data → retrieve and structure data from the World Bank API

src/cleaning.py includes:

  • clean_data → clean datasets and detect/remove outliers

src/visualization.py includes:

  • line_plt → time series visualization
  • hist_plt → distribution analysis
  • scat_plt → relationship between variables
  • box_plt → outlier visualization

src/indicators.py includes:

  • compute_growth_rate → compute annual percentage growth
  • compute_cagr → compute compound annual growth rate over a selected period
  • compute_moving_average → smooth time-series indicators using a rolling average
  • compute_volatility → measure the instability of an indicator using standard deviation
  • compute_rolling_volatility → measure how volatility evolves over time using a rolling window

src/time_series.py includes:

  • test_stationarity → test whether a time series is stationary using the Augmented Dickey-Fuller test

🎯 Future Improvements

Roadmap

  • Build a clean data pipeline using the World Bank API
  • Add data cleaning and outlier detection functions
  • Add reusable visualization functions
  • Refactor source code into dedicated modules
  • Add GDP growth rate indicator
  • Add CAGR / TCAM indicator
  • Add GDP growth moving average indicator
  • Add GDP growth volatility indicator
  • Add GDP growth rolling volatility indicator
  • Add stationarity tests for time-series analysis
  • Add inflation analysis
  • Analyze the relationship between GDP growth and inflation
  • Add forecasting models such as ARIMA and VAR
  • Build an interactive dashboard for country-level macroeconomic analysis

How to Use

Clone the repository:

git clone https://github.com/MalickThaKidd/senegal-macro-analysis.git
cd senegal-macro-analysis

About

Macroeconomic analysis of Senegal using World Bank API data

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages