VARData#
- class impulso.data.VARData(*, endog, endog_names, exog=None, exog_names=None, index)[source]#
Bases:
ImpulsoBaseModelImmutable, validated container for VAR estimation data.
Variable names must be unique. endog_names and exog_names are each checked for internal duplicates, and the two must not share any name — a single label cannot refer to both an endogenous and an exogenous column.
Exogenous columns must vary within the sample. A column that is exactly constant is collinear with the intercept every VAR carries, so it is not identified; it is rejected rather than silently soaking up an arbitrary share of the intercept.
Every value must be finite. NaN or Inf in either block is rejected at construction, not left to surface later as a failed fit or an all-NaN posterior.
Immutability extends to the arrays themselves: endog and exog are copied and marked read-only once validation passes, so a fitted model can never be re-pointed at data that was mutated underneath it.
- Parameters:
- endog#
Endogenous variable array of shape (T, n) where T >= 1 and n >= 2.
- Type:
- exog#
Optional exogenous variable array of shape (T, k). Every column must take at least two distinct values. Endogenous variables are modelled jointly and each carries a structural shock; exogenous regressors enter contemporaneously, are never explained by the system, and carry no shock of their own. Which columns belong on which side is a modelling assumption the data cannot check.
- Type:
numpy.ndarray | None
- exog_names#
Names for each exogenous variable. Required if exog is provided. Must be unique and disjoint from endog_names.
- index#
DatetimeIndex of length T.
- Type:
Expand for references to
impulso.data.VARData- classmethod from_df(df, endog, exog=None)[source]#
Construct VARData from a pandas DataFrame.
Column names must be unique within endog, within exog, and across the two — pandas silently widens the selection when a label is repeated or when df itself carries duplicate column labels, which would produce arrays that no longer match their names.
- Parameters:
- Returns:
Validated VARData instance.
- Return type:
- model_config = {'arbitrary_types_allowed': True, 'frozen': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].