Forecasting Electricity Price Time Series Data in Python using a VAR Model

A Crash Course in Time Series Decomposition and Forecasting with a Vector Autoregression (VAR) Model

Kirsten Perry

Snapshot of the time series data for electricity prices, pulled via the EIA API

Time Series Decomposition: Monthly Electricity Prices in TX

Image courtesy of

Plotted Natural Gas Prices and Electricity Prices over Time

VAR equation for two variables and first-order dynamics: Image courtesy of

Outputs for the Augmented Dickey-Fuller Test for the electricity price time series and the natural gas price time series, respectively

VAR Model Summary, with y1=Electricity Price Time Series, and y2=Natural Gas Price Time Series

Actual electricity price vs. VAR-model predicted electricity price, predicted out 10 months (after un-differencing and back-transformation) Accuracy metrics for the forecast: forecast bias, mean absolute error, mean squared error, and root mean square error


Leave a Comment