StudentBVARResult.outlier_dates#

StudentBVARResult.outlier_dates(threshold=0.5)[source]#

Effective-sample rows the t distribution treats as tail events.

A weight \(w_t\) scales the innovation covariance at date t to \(\Sigma / w_t\), so a weight of one half is a date the model reads as carrying twice the usual innovation variance.

Parameters:

threshold (float) – Weight below which a date counts – 1 is a typical date, and the 2008-shaped dates sit far below.

Return type:

NDArray[int_]

Returns:

Row indices into resid, ascending.

Example

The flagged dates are the large-residual dates, and the set shrinks as the threshold tightens:

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> y = np.zeros((200, 2))
>>> for t in range(1, 200):
...     w = rng.gamma(2.0, 0.5)
...     y[t] = 0.5 * y[t - 1] + rng.standard_normal(2) / np.sqrt(w)
>>> res = StudentBVAR(y, order=1).fit(n_draws=400, n_burn=200, seed=0)
>>> flagged = res.outlier_dates()
>>> bool(0 < flagged.size < 30), bool(np.all(np.diff(flagged) > 0))
(True, True)
>>> largest = int(np.argmax(np.abs(res.resid).max(axis=1)))
>>> bool(largest in flagged), bool(res.outlier_dates(0.25).size <= flagged.size)
(True, True)