pastas.stats.metrics.picp#

pastas.stats.metrics.picp(obs: pandas.Series, bounds: pandas.DataFrame)#

Compute the prediction interval coverage probability (PICP).

Parameters:
  • obs (pandas.Series) – Pandas Series with the observed time series and a DateTimeIndex.

  • bounds (DataFrame) – DataFrame with the lower (first column) and upper (second columns) bounds of the prediction intervals.

Notes

The Prediction Interval Coverage Probability (PICP) is computed as follows:

\[\begin{split}PICP = \\frac{1}{N} \\sum_{i=1}^N a_i, a_i = \\begin{cases} 1 & \\text{if} h_i \\text{in} [\\hat{h_i}^L, \\hat{h_i}^U], \\ 0 & \\text{otherwise} \\end{cases}\end{split}\]

Examples

>>> import pandas as pd
>>> import numpy as np
>>> from pastas.stats import picp
>>> obs = pd.Series(np.random.rand(100),
...                     index=pd.date_range("2000-01-01", periods=100))
>>> bounds = pd.DataFrame(np.random.rand(100, 2), index=obs.index)
>>> picp(obs, bounds)