VARX#
- class cultivars.multivariate.reduced_form.vector_autoregression.VARX(endog, exog, *, order, exog_order=0, trend='c', names=None, exog_names=None)[source]#
Vector autoregression with exogenous regressors, estimated by least squares.
The design gains one
(m,)block per exogenous lag, placed after the endogenous lags so that every offset the base computes stays correct without an override. The constructor is inherited from_ExogenousVectorAutoRegressionModel; the exogenous sample must be aligned with the endogenous one row for row and the two label sets may not overlap. No prior is accepted here.- Parameters:
endog (
ArrayLike) – The(nobs, k)endogenous panel.exog (
ArrayLike) – The(nobs, m)exogenous block, aligned on the same index.order (
int) – Endogenous autoregressive orderp.exog_order (
int) – Exogenous lagssbeyond the contemporaneous term. Defaults to zero.trend (
Literal['n','c','ct']) –"n","c"(default) or"ct".names (
Sequence[str] |None) – Endogenous labels. Defaults toy1 ... yk.exog_names (
Sequence[str] |None) – Exogenous labels. Defaults tox1 ... xm.
- Raises:
SpecificationError – If
exog_orderis malformed, the labels are malformed, or an endogenous and an exogenous label collide.DimensionError – If the two samples are not aligned or the sample is too short for the specification.
- Variables:
_endog – The validated
(nobs, k)endogenous panel._exog – The validated
(nobs, m)exogenous block._names – The resolved endogenous labels.
_exog_names – The resolved exogenous labels.
_order – The endogenous order.
_exog_order – The exogenous order.
_trend – The validated trend code.
_prior – Always
_NoPrior.
See also
VARXResult– the recordfit()returns.VAR– the model without the exogenous block.VECMX– the exogenous block under a cointegration restriction.
Example
>>> import numpy as np >>> rng = np.random.default_rng(0) >>> x = rng.standard_normal((200, 1)) >>> y = np.column_stack([x[:, 0] + rng.standard_normal(200), rng.standard_normal(200)]) >>> res = VARX(y, x, order=1, exog_order=1).fit() >>> res.forecast(3, exog_future=np.zeros((3, 1))).shape (3, 2) >>> VARX(y, x, order=1, names=("a", "b"), exog_names=("a",)) Traceback (most recent call last): cultivars.exceptions.SpecificationError: names and exog_names must not overlap, ...
Attributes#
The validated sample. |
|
The validated exogenous block. |
|
Exogenous labels. |
|
Exogenous lags beyond the contemporaneous term. |
|
Whether a prior contributes anything to this estimate. |
|
Number of endogenous variables. |
|
Number of exogenous variables. |
|
Regressors per equation, including the distributed lag. |
|
Variable labels. |
|
Autoregressive order. |
|
The prior on the coefficients; |
|
Deterministic specification. |
Methods#
|
Estimate the system and return the fitted result. |
|
Score every order from zero to |