BacktestResult.record#

BacktestResult.record(horizon=1)[source]#

One horizon’s (paths, realized) as (T, S, k) and (T, k).

The shapes a calibration record takes: the draws of the \(h\)-step predictive distribution at each origin beside the outcome they were for, which is what a probability integral transform is computed from.

Parameters:

horizon (int) – The horizon, in 1 .. horizons.

Return type:

tuple[NDArray[double], NDArray[double]]

Returns:

(paths, realized) for that horizon.

Raises:

SpecificationError – If the horizon is unknown or no draws were recorded.

Example

>>> import numpy as np
>>> from cultivars.multivariate.large_dim.bayesian import BVAR
>>> y = np.random.default_rng(0).standard_normal((140, 2))
>>> fit = lambda w: BVAR(w, order=1).fit(n_draws=50, seed=0)
>>> record = Backtest(y, fit, horizons=2, start=130, step=5).run()
>>> paths, realized = record.record(2)
>>> paths.shape, realized.shape
((2, 50, 2), (2, 2))