PanelVAR#

class cultivars.multivariate.reduced_form.panel.PanelVAR(panel, *, order, effects='unit', trend='n', names=None, unit_names=None)[source]

Bases: _PanelVectorAutoRegressionModel[PanelVARResult]

Panel vector autoregression with pooled slopes and unit fixed effects.

Every unit shares \(A_1, \dots, A_p\) and \(\Sigma_u\); only the intercept may differ, as one dummy per unit (effects="unit", the default, with trend forced to "n" because unit dummies already span the constant) or as a single pooled deterministic block (effects="none"). The panel may be balanced – an (n_units, nobs, k) array – or a sequence of (nobs_i, k) arrays of unequal length; lags are built inside each unit and never across a boundary, and the shortest unit must still supply order lags.

Variables:
  • _endog – The units stacked into one (sum T_i, k) panel.

  • _names – Variable labels.

  • _order – Autoregressive order, common to all units.

  • _trend – Deterministic terms, "n" under unit effects.

  • _prior – The base slot for a shrinkage prior, unused by this family.

  • _units – The validated per-unit arrays.

  • _lengths – Observations per unit.

  • _unit_names – Unit labels.

  • _effects (str) – "unit" or "none".

See also

  • PanelVARResult – the record fit() returns.

  • VAR – the single-unit model.

  • GVAR – the alternative when units should keep their own dynamics and be linked rather than pooled.

References

Holtz-Eakin, D., Newey, W., & Rosen, H. S. (1988). Estimating vector autoregressions with panel data. Econometrica, 56(6), 1371-1395.

Nickell, S. (1981). Biases in dynamic models with fixed effects. Econometrica, 49(6), 1417-1426.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> panel = rng.standard_normal((5, 60, 2))
>>> res = PanelVAR(panel, order=1).fit()
>>> res.forecast(3, unit="unit1").shape
(3, 2)