MIDASVAR._design#

MIDASVAR._design(order=None, *, trim=0)[source]#

Build the target and regressor matrix at flat weights.

Used by lag-order selection, where the candidates must differ in the endogenous order and in nothing else: holding the polynomial flat keeps the compressed block identical across candidates, so the criteria compare lag structures rather than incidental re-estimates of the weights.

Parameters:
  • order (int | None) – Endogenous order; defaults to the fitted order.

  • trim (int) – Leading low-frequency observations to discard first.

Return type:

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

Returns:

The target block, the design, and the row count of both.

Raises:

DimensionError – If the trimmed sample cannot supply the lags and the weight window.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> x = rng.standard_normal((120, 1))
>>> model = MIDASVAR(rng.standard_normal((40, 2)), x, order=1, period=3)
>>> target, design, effective = model._design(order=2)
>>> target.shape, design.shape, effective
((38, 2), (38, 6), 38)
>>> bool(np.allclose(design[:, -1], x[:, 0].reshape(40, 3)[2:].mean(axis=1)))
True