This repository contains files for Task 1 of the J.P. Morgan Quantitative Research Virtual Job Experience.
The goal is to analyze natural gas monthly price data and build a model to:
- Estimate gas prices on any given date (historical or future).
- Extrapolate prices 12 months into the future for storage contract pricing.
- Identify seasonal patterns in the price data.
Commodity storage contracts depend heavily on future price movements.
We were provided with monthly natural gas prices (Oct 2020 – Sep 2024), and the task was to:
- Clean and analyze the dataset.
- Build a function that takes a date as input and returns an estimated price.
- Extend the forecast for 1 additional year beyond the given dataset.
- Visualize trends, seasonality, and fitted model.
I used a Sinusoidal Regression Model combined with a linear trend to capture:
- Trend: Long-term upward/downward movement of prices.
- Seasonality: Annual demand patterns (higher in winter, lower in summer).
- Converted dates into a time index (
tin months). - Added sin and cos terms to model yearly seasonality.
- Fitted a Linear Regression model:
[ Price = a \cdot t + b \cdot \sin\left(\frac{2 \pi t}{12}\right) + c \cdot \cos\left(\frac{2 \pi t}{12}\right) ] - Forecasted 12 months ahead (Oct 2024 – Sep 2025).
- Built a helper function
estimate_price_sinusoidal(date)for interpolation/extrapolation.
- The model captures both the upward trend and seasonal variation in natural gas prices.
- Provides daily estimates by mapping any input date into the sinusoidal model.
- Produces a 1-year forecast beyond the dataset.
print(estimate_price_sinusoidal("2024-06-15")) # interpolation
print(estimate_price_sinusoidal("2025-09-15")) # extrapolation