## 10.6 Mapping matrices

All of the methods considered so far can be expressed using a common notation.

Suppose we forecast all series independently, ignoring the aggregation constraints. We call these the base forecasts and denote them by $$\hat{\bm{y}}_h$$ where $$h$$ is the forecast horizon. They are stacked in the same order as the data $$\bm{y}_t$$.

Then all forecasting approaches for either hierarchical or grouped structures can be represented as $$$\tilde{\bm{y}}_h=\bm{S}\bm{P}\hat{\bm{y}}_h, \tag{10.6}$$$ where $$\bm{P}$$ is a matrix that maps the base forecasts into the bottom-level, and the summing matrix $$\bm{S}$$ sums these up using the aggregation structure to produce a set of coherent forecasts $$\tilde{\bm{y}}_h$$.

The $$\bm{P}$$ matrix is defined according to the approach implemented. For example if the bottom-up approach is used to forecast the hierarchy of Figure 10.1, then $\bm{P}= \begin{bmatrix} 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1\\ \end{bmatrix}.$ Notice that $$\bm{P}$$ contains two partitions. The first three columns zero out the base forecasts of the series above the bottom-level, while the $$m$$-dimensional identity matrix picks only the base forecasts of the bottom-level. These are then summed by the $$\bm{S}$$ matrix.

If any of the top-down approaches were used then $\bm{P}= \begin{bmatrix} p_1 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ p_2 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ p_3 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ p_4 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ p_5 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ \end{bmatrix}.$ The first column includes the set of proportions that distribute the base forecasts of the top-level to the bottom-level. These are then summed up the hierarchy by the $$\bm{S}$$ matrix. The rest of the columns zero out the base forecasts below the highest level of aggregation.

For a middle out approach, the $$\bm{P}$$ matrix will be a combination of the above two. Using a set of proportions, the base forecasts of some pre-chosen level will be disaggregated to the bottom-level, all other base forecasts will be zeroed out, and the bottom-level forecasts will then summed up the hierarchy via the summing matrix.

### Forecast reconciliation

We can rewrite Equation (10.6) as $$$\tilde{\bm{y}}_h=\bm{R}\hat{\bm{y}}_h, \tag{10.7}$$$ where $$\bm{R}=\bm{S}\bm{P}$$ is a “reconciliation matrix”. That is, it takes the incoherent base forecasts $$\hat{\bm{y}}_h$$, and reconciles them to produce coherent forecasts $$\tilde{\bm{y}}_h$$.

In the methods discussed so far, no real reconciliation has been done because the methods have been based on forecasts from a single level of the aggregation structure, which have either been aggregated or disaggregated to obtain forecasts at all other levels. However, in general, we could use other $$\bm{P}$$ matrices, and then $$\bm{R}$$ will be combining and reconciling all the base forecasts in order to produce coherent forecasts.

In fact, we can find the optimal $$\bm{P}$$ matrix to give the most accurate reconciled forecasts.