Skip to content

thecoderr13/inflation-rate-prediction

Repository files navigation

Inflation Rate Prediction using Economic Indicators

Project Overview

This project develops machine learning models to predict the Trimmed Mean PCE Inflation Rate using various economic indicators from the Federal Reserve Economic Data (FRED). The analysis covers data from 1995 to 2025 and implements multiple machine learning algorithms to forecast inflation trends.

Objective

To build accurate predictive models for inflation rates using historical economic data, enabling better economic forecasting and policy analysis.

Dataset Description

The dataset combines 16 economic indicators from FRED with daily frequency from 1995-07-01 to 2025-07-01:

Interest Rate Indicators

  • T10Y3M: 10-Year Treasury Constant Maturity Minus 3-Month Treasury Constant Maturity
  • DTB3: 3-Month Treasury Bill Secondary Market Rate
  • DGS10: 10-Year Treasury Constant Maturity Rate
  • DGS2: 2-Year Treasury Constant Maturity Rate
  • DGS3MO: 3-Month Treasury Constant Maturity Rate
  • DGS30: 30-Year Treasury Constant Maturity Rate
  • DBAA: Moody's Seasoned Baa Corporate Bond Yield
  • DAAA: Moody's Seasoned Aaa Corporate Bond Yield
  • BAMLH0A0HYM2: ICE BofA US High Yield Index Option-Adjusted Spread

Exchange Rates

  • CCUSMA02RUM618N: USD/RUB Exchange Rate
  • CCUSMA02INM618N: USD/INR Exchange Rate
  • CCUSMA02GBM618N: USD/GBP Exchange Rate

Economic Indicators

  • CPIAUCSL: Consumer Price Index for All Urban Consumers
  • UNRATE: Unemployment Rate
  • GDP: Gross Domestic Product
  • PCETRIM12M159SFRBDAL: Trimmed Mean PCE Inflation Rate (Target Variable)

Technical Implementation

Data Processing Pipeline

  • Temporal Alignment: Converted all data to daily frequency using appropriate interpolation methods
  • Missing Value Handling: Linear interpolation for continuous data, forward fill for quarterly data
  • Data Validation: Comprehensive quality checks ensuring complete date coverage
  • Feature Engineering: Correlation analysis and feature selection

Machine Learning Models

  1. Linear Regression - Baseline model
  2. Random Forest - Ensemble method with 200 trees
  3. XGBoost - Gradient boosting with hyperparameter tuning
  4. Support Vector Machine - RBF kernel with regularization
  5. Neural Network - Deep learning approach with 2 hidden layers

Model Evaluation Metrics

  • R² Score (Coefficient of Determination)
  • Root Mean Square Error (RMSE)
  • Mean Absolute Error (MAE)

Key Results

Model Performance Comparison

Model Train R² Test R² Test RMSE Test MAE
Linear Regression 0.8094 0.8168 0.3232 0.2614
Random Forest 0.9999 0.9999 0.0081 0.0022
XGBoost 0.9998 0.9996 0.0144 0.0097
SVM 0.9881 0.9876 0.0841 0.0667
Neural Network 0.9941 0.9941 0.0579 0.0440

Key Insights

  • Random Forest achieved near-perfect prediction accuracy (R² = 0.9999)
  • Interest rates show strong negative correlation with inflation
  • Exchange rates and CPI demonstrate positive correlation with inflation
  • Unemployment rate has the strongest negative correlation (-0.52) with inflation

Installation & Usage

Prerequisites

pip install pandas numpy matplotlib seaborn scikit-learn xgboost tensorflow

Running the Analysis

git clone https://github.com/yourusername/inflation-rate-prediction.git
cd inflation-rate-prediction

Key Findings

  • Economic Relationships: Confirmed inverse relationship between interest rates and inflation
  • Model Superiority: Tree-based models (Random Forest, XGBoost) outperformed linear models
  • Feature Importance: Multiple economic indicators contribute significantly to inflation prediction
  • Temporal Patterns: Identified rolling volatility patterns in inflation trends

Acknowledgments

  1. Federal Reserve Economic Data (FRED) for providing the economic indicators.
  2. Scikit-learn, XGBoost, and TensorFlow communities for ML libraries.

About

Inflation Rate Prediction using Macroeconomic Indicators.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published