Forecasting

The Magical Trinary

June 21, 2021

Sometimes things don’t look like they’re supposed to look. Just walk into your child’s bedroom. At first glance (and second glance and maybe all the time), there is chaos with clothing, books and random toys scattered across the floor. But hidden in that chaos is a secret sense of order. Ask for a specific item and like a magician, presto, the child produces it in minutes.

Okay, maybe this is wishful thinking. But in model building, I sometimes find this child’s magic.

The Problem: Simplified Chaos

The picture below, created in our MetrixND software, is simplified chaos. My beautiful model (in blue) is set against the actual values (in red). Unlike every other year (you must trust me on this assumption), this March and April show an unexpected sawtooth pattern.

Simplified Chaos

Forecasting Model

The Binary Solution

Glancing at the chaos, my first instinct is to call March and April “outliers”, add a couple binaries, and move on with my life. Using two variables (March2021 and April2021 binaries), I remove the outliers and finish. The binaries are defined below.

March2021 = (Year= 2021) * (Month =3)

April2021 = (Year= 2021) * (Month =4)

You can see the result below.

Binary Solution

Forecasting Model

The Trinary Solution

But what if there is order hidden in the chaos? Could there be a reason that March is lower than expected only to be offset with April higher than expected?

In this case, we learn that several customers did not get billed in March and they received double bills in April. In other words, a group of customers’ March consumption data was moved to April creating a dip followed by a spike. Knowing this reason, we can model this data movement with a trinary variable.

A trinary variable is like a binary except that it involves two data points instead of one. Our trinary variable is created below:

MarchApril2021Trinary = (-1) * March2021 + (1) * April2021

The formula creates the following time series.

MarchApril2021Trinary

Forecasting Model

Using the trinary in the model creates the following result.

Trinary Solution

Forecasting Model

The Case for Trinaries

In simplified chaos, the trinary and binary solutions produce virtually identical results with nearly identical R2 and MAPE values. While the binary solution literally zeros out the errors for two data points, the trinary solution captures the data movement but still leaves a little error.

So why use a trinary? Here are a couple thoughts.

  1. Degrees of Freedom. The trinary solution involves fewer variables, thus increasing the degrees of freedom. In situations where the problem occurs multiple times, using trinary variables can provide a similar answer with fewer variables.
  2. Preserve Impacts. A binary removes the entire impact of the data point. A trinary moves a portion of the impact from one period to another preserving the impact from the remaining variables. In other words, the weather variable impact is still captured from the data points recognized by the trinary. In situations where the data points occur with large weather impacts (e.g., January or August), keeping the weather impacts with a trinary may be more useful than removing the weather impact with a binary.

 

Here’s a real-world example. In the left picture, chaos reigns with a sawtooth pattern extending from January through June 2021 (although you can argue that it mildly extends to October). In the right picture, I use trinary variables to capture the sawtooth pattern. Using the trinary solution, I improve the overall fit, preserve the weather response, and do not remove any 2021 data points from the data set.

Forecasting Model

And, I think that’s magic.

If you would like to learn more about MetrixND, please go to the forecasting section of the Itron website or send us an email at forecasting@itron.com. And be sure to subscribe to our blog for more tips and tricks and to be notified when we post our other interesting blogs.

By Mark Quan


Principal Forecast Consultant


Mark Quan is a Principal Forecast Consultant with Itron’s Forecasting Division. Since joining Itron in 1997, Quan has specialized in both short-term and long-term energy forecasting solutions as well as load research projects. Quan has developed and implemented several automated forecasting systems to predict next day system demand, load profiles, and retail consumption for companies throughout the United States and Canada. Short-term forecasting solutions include systems for the Midwest Independent System Operator (MISO) and the California Independent System Operator (CAISO). Long-term forecasting solutions include developing and supporting the long-term forecasts of sales and customers for clients such as Dairyland Power and Omaha Public Power District. These forecasts include end-use information and demand-side management impacts in an econometric framework. Finally, Quan has been involved in implementing Load Research systems such as at Snohomish PUD. Prior to joining Itron, Quan worked in the gas, electric, and corporate functions at Pacific Gas and Electric Company (PG&E), where he was involved in industry restructuring, electric planning, and natural gas planning. Quan received an M.S. in Operations Research from Stanford University and a B.S. in Applied Mathematics from the University of California at Los Angeles.


Region Selector Select a region and country for the best experience.