Case Study
Stock Market Prediction — CPI → S&P 500
2025
- Python
- scikit-learn
- pandas
- Machine Learning
- Git/GitHub
- FastAPI
- Next.js
Full-stack app that tests how inflation data (CPI) relates to short-term S&P 500 returns. Includes a FastAPI backend for models and a Next.js dashboard for running scenarios.
Problem & Motivation:
People often assume inflation moves the market, but it’s unclear which CPI components matter or how strong the relationship actually is.
Data & Approach:
- Pulled and merged CPI categories with S&P 500 returns, then created lagged features to test delayed effects.
- Trained simple regression models (Ridge, ElasticNet, Gradient Boosting) with proper time-series splits.
- Built a dashboard where you can adjust weights or run 'what-if' scenarios and see model outputs instantly.
Results:
- ElasticNet ended up being the most stable baseline across different time windows.
- Some CPI categories showed predictable lag patterns, but only within certain periods.
- The dashboard made it easy to see how model predictions changed under different inflation assumptions.
Limitations:
Market regimes shift a lot, and CPI alone can’t explain most of the movement. Some categories also don’t have enough clean historical data to rely on.