# Probabilistic Methods

Here we provide a collection of methods designed to provide hierarchically coherent probabilistic distributions, which means that they generate samples of multivariate time series with hierarchical linear constraints.

We designed these methods to extend the `core.HierarchicalForecast`

capabilities class. Check their usage example
here.

# 1. Normality

source

### Normality

*Normality Probabilistic Reconciliation Class.

The Normality method leverages the Gaussian Distribution linearity, to
generate hierarchically coherent prediction distributions. This class is
meant to be used as the `sampler`

input as other `HierarchicalForecast`

reconciliation
classes.

Given base forecasts under a normal distribution: $\hat{y}_{h} \sim \mathrm{N}(\hat{\boldsymbol{\mu}}, \hat{\mathbf{W}}_{h})$

The reconciled forecasts are also normally distributed:

**Parameters:**

`S`

: np.array, summing matrix of size (`base`

,
`bottom`

).

`P`

: np.array, reconciliation matrix of size (`bottom`

,
`base`

).

`y_hat`

: Point forecasts values of size (`base`

,
`horizon`

).

`W`

: np.array, hierarchical covariance matrix of size
(`base`

, `base`

).

`sigmah`

: np.array, forecast standard dev. of size
(`base`

, `horizon`

).

`num_samples`

: int, number of bootstraped
samples generated.

`seed`

: int, random seed for numpy generator’s
replicability.

source

### Normality.get_samples

*Normality Coherent Samples.

Obtains coherent samples under the Normality assumptions.

**Parameters:**

`num_samples`

: int, number of samples generated from
coherent distribution.

**Returns:**

`samples`

: Coherent samples of size (`base`

, `horizon`

,
`num_samples`

).*

# 2. Bootstrap

source

### Bootstrap

*Bootstrap Probabilistic Reconciliation Class.

This method goes beyond the normality assumption for the base forecasts,
the technique simulates future sample paths and uses them to generate
base sample paths that are latered reconciled. This clever idea and its
simplicity allows to generate coherent bootstraped prediction intervals
for any reconciliation strategy. This class is meant to be used as the
`sampler`

input as other `HierarchicalForecast`

reconciliation
classes.

Given a boostraped set of simulated sample paths: $(\hat{\mathbf{y}}^{[1]}_{\tau}, \dots ,\hat{\mathbf{y}}^{[B]}_{\tau})$

The reconciled sample paths allow for reconciled distributional forecasts: $(\mathbf{S}\mathbf{P}\hat{\mathbf{y}}^{[1]}_{\tau}, \dots ,\mathbf{S}\mathbf{P}\hat{\mathbf{y}}^{[B]}_{\tau})$

**Parameters:**

`S`

: np.array, summing matrix of size (`base`

,
`bottom`

).

`P`

: np.array, reconciliation matrix of size (`bottom`

,
`base`

).

`y_hat`

: Point forecasts values of size (`base`

,
`horizon`

).

`y_insample`

: Insample values of size (`base`

,
`insample_size`

).

`y_hat_insample`

: Insample point forecasts of size
(`base`

, `insample_size`

).

`num_samples`

: int, number of bootstraped
samples generated.

`seed`

: int, random seed for numpy generator’s
replicability.

**References:**

- Puwasala Gamakumara Ph. D. dissertation. Monash
University, Econometrics and Business Statistics (2020). “Probabilistic
Forecast
Reconciliation” -
Panagiotelis A., Gamakumara P. Athanasopoulos G., and Hyndman R. J.
(2022). “Probabilistic forecast reconciliation: Properties, evaluation
and score optimisation”. European Journal of Operational
Research.*

source

### Bootstrap.get_samples

*Bootstrap Sample Reconciliation Method.

Applies Bootstrap sample reconciliation method as defined by Gamakumara 2020. Generating independent sample paths and reconciling them with Bootstrap.

**Parameters:**

`num_samples`

: int, number of samples generated from
coherent distribution.

**Returns:**

`samples`

: Coherent samples of size (`base`

, `horizon`

,
`num_samples`

).*

# 3. PERMBU

source

### PERMBU

*PERMBU Probabilistic Reconciliation Class.

The PERMBU method leverages empirical bottom-level marginal distributions with empirical copula functions (describing bottom-level dependencies) to generate the distribution of aggregate-level distributions using BottomUp reconciliation. The sample reordering technique in the PERMBU method reinjects multivariate dependencies into independent bottom-level samples.

**Parameters:**

`S`

: np.array, summing matrix of size (`base`

,
`bottom`

).

`tags`

: Each key is a level and each value its `S`

indices.

`y_insample`

: Insample values of size (`base`

,
`insample_size`

).

`y_hat_insample`

: Insample point forecasts of size
(`base`

, `insample_size`

).

`sigmah`

: np.array, forecast standard
dev. of size (`base`

, `horizon`

).

`num_samples`

: int, number of
normal prediction samples generated.

`seed`

: int, random seed for
numpy generator’s replicability.

source

### PERMBU.get_samples

*PERMBU Sample Reconciliation Method.

Applies PERMBU reconciliation method as defined by Taieb et. al 2017. Generating independent base prediction samples, restoring its multivariate dependence using estimated copula with reordering and applying the BottomUp aggregation to the new samples.

**Parameters:**

`num_samples`

: int, number of samples generated from
coherent distribution.

**Returns:**

`samples`

: Coherent samples of size (`base`

, `horizon`

,
`num_samples`

).*

# References

- Rob J. Hyndman and George Athanasopoulos (2018). “Forecasting
principles and practice, Reconciled distributional
forecasts”.
- Puwasala Gamakumara Ph. D. dissertation. Monash University,
Econometrics and Business Statistics (2020). “Probabilistic Forecast
Reconciliation”
- Panagiotelis A., Gamakumara P. Athanasopoulos G., and Hyndman R. J.
(2022). “Probabilistic forecast reconciliation: Properties,
evaluation and score optimisation”. European Journal of Operational
Research.
- Taieb, Souhaib Ben and Taylor, James W and Hyndman, Rob J. (2017).
Coherent probabilistic forecasts for hierarchical time series.
International conference on machine learning
ICML.