Analytica > Blogs > Electricity price forecasting via time-series, regression & nearest neighbor models

# Electricity price forecasting via time-series, regression & nearest neighbor models

Flip the switch and the light goes on. How simple it is to take this for granted. Large-scale engineered and networked systems manage our daily electrical needs, and many negotiations and transactions happen so that we can fire up our machines and appliances. Electricity markets facilitate the buying and selling of this commodity, and predicting electricity price (even for the next day) is crucial for players in the market.

## Planning by market players

Electricity generation companies seek to maximize their profit when transacting in a deregulated electricity market. Explored in a 2008 power engineering paper by a Chalmers University of Technology researcher, a general description of this objective is below.

The objective described is based on the process below, which are typical steps involved in the short-term operational planning by electricity market players.

Analytically, this suggests designing strategic bidding plans that seek to maximize profit given system behaviors and constraints. Solution approaches range from simple heuristics to game-theoretic algorithms. However, an important component in all approaches is the next-day forecast of the market electricity price. Systems analysts may be tempted to model the system and use a simulation approach to forecast the electricity price, but this requires a lot of information, including the behavior of other commodities and natural phenomena like weather. Although I am all for creating virtual worlds, this one may cause you to be squeamish- but donâ€™t let me stop you from simulating. Itâ€™s doable using, say, Monte Carlo simulation.

## Time-series models

Electricity price forecasting can be wrangled by one of several mathematical models. In contrast to a simulation approach, a time-series approach is what I call a response-focused approach. Instead of trying to model the different player behaviors in a market along with effects from other factors, a time-series model seeks to forecast electricity price Z (the response) using the values of Z at previous points in time. The 2008 power engineering paper presents this well, beginning with an autoregressive (AR) model as shown below.

We can sometimes get a higher rate of accuracy using a more encompassing approach like an autoregressive moving average (ARMA) model as shown below.

Other more sophisticated time-series models like ARIMA and GARCH exploit certain possible behaviors in the data. I discuss the application of time-series models to crude oil price forecasting in a prior blog, another heavy problem in forecasting.

## Causal forecasting models

Causal forecasting might be too bold of a name, but it suggests that we can forecast electricity price using variables that seem to influence it. This is technically called regression modeling. The power engineering paper shows a practical regression using some standard variables.

These models can be set up and explored in Lumina Decision Systemâ€™s Analytica platform. A more general approach for electricity price forecasting that can incorporate previous prices and other variables based on time is called a dynamic regression model. This is discussed in a 2006 paper by a University of Waterloo researcher, and the general mathematical form is below.

## A machine learning model

By no means shall I present a tour of plausible learning models that can be used for electricity price forecasting. Instead, Iâ€™ll present a simple machine-learning model that seems to work well. The model is called weighted nearest neighbors, and the idea is to forecast based on the properties of neighboring data points. This method is discussed in a 2007 paper published in IEEE Transactions on Power Systems. Using a few days in the past, we pick several data points close to the current day and use those hourly electricity prices to predict the hourly prices for each hour for the next [future] day. This is illustrated below.

You should now see a cloud of questions above your head. The paper addresses four major items: 1) how far back we should go, 2) the number of data points (neighbors) to choose, 3) how we can identify neighboring data points, and 4) the formula to use to compute the future price. As you can imagine, the formula can be a linear combination of weights and previous prices. The paper shares the quite astonishing results of this method along with a comparison. Promising, I tell you.

## Thoughts

Notice that weâ€™ve reviewed methods and progress in forecasting an important commodity for just one day in the future! What do you think causes electricity price forecasting to be such a tough nut to pry open? What social, cooperative, and competitive factors are at play?

## Share nowÂ

### Building electrification: heat pump technology

Lumina set out to build a useful tool to assess the benefits of heat pumps. Learn more about heat pumps and their impact.

### Navigating the heat pump landscape

Fort Collins, Lumina, and Apex Analytics have created a tool to help reduce greenhouse gas emissions by optimizing building electrification programs.

### US gas leaks much larger than previously estimated

A new Stanford-led study on natural gas leak rates from oil and gas activity across a large fraction of the US are about 3x more than previous government estimates. The

### Building electrification: heat pump technology

Lumina set out to build a useful tool to assess the benefits of heat pumps. Learn more about heat pumps and their impact.

Moreâ€¦

### Decision making when there is little historic precedent

Learn how to make decisions and strategic plans in uncertain situations, where historical data is not available. See how to model this in Analytica with clarity and insight.

Moreâ€¦

### Does GPT-4 pass the Turing test?

UCSD researchers conducted an online Turing test of GPT-4 with 652 human participants. Humans were not fooled ~60% of the time.

Moreâ€¦

### What is Analytica software?

Analytica is a decision analysis tool that helps you generate clearer and more justified results through modeling.

Moreâ€¦

The free version of Analytica lets you create and edit models with up to 101 variables, which is pretty substantial since each variable can be a multidimensional array. It also lets you run larger modes in ‘browse mode.’ Learn more about the free edition.

While Analytica doesn’t run on macOS, it does work with Parallels or VMWare through Windows.

The free version of Analytica lets you create and edit models with up to 101 variables, which is pretty substantial since each variable can be a multidimensional array. It also lets you run larger modes in ‘browse mode.’ Learn more about the free edition.

While Analytica doesn’t run on macOS, it does work with Parallels or VMWare through Windows.

The free version of Analytica lets you create and edit models with up to 101 variables, which is pretty substantial since each variable can be a multidimensional array. It also lets you run larger modes in ‘browse mode.’ Learn more about the free edition.

While Analytica doesn’t run on macOS, it does work with Parallels or VMWare through Windows.

The free version of Analytica lets you create and edit models with up to 101 variables, which is pretty substantial since each variable can be a multidimensional array. It also lets you run larger modes in ‘browse mode.’ Learn more about the free edition.

While Analytica doesn’t run on macOS, it does work with Parallels or VMWare through Windows.