ModelEvidence#
- class impulso.evidence.ModelEvidence(*, log_marginal_likelihood, n_obs, n_vars, var_names, n_lags, volatility=None, hyperparameters=<factory>, sample_start, sample_end, sample_digest)[source]#
Bases:
ImpulsoBaseModelClosed-form log marginal likelihood of a conjugate VAR, with comparability metadata.
The value is the log density of the observed response block given the presample and the hyperparameters,
log p(y_{p+1:T} | y_{1:p}, hyperparameters, model),
with three properties worth stating explicitly:
It is a density over the observed data. When a deterministic volatility break rescales the sample, the change-of-variables Jacobian is included, so a break model and a homoscedastic model fitted to the same observations are directly comparable.
It is conditional on the hyperparameters in hyperparameters. With NIWPrior(select=True) those were chosen by maximising evidence times hyperprior, so a ratio of two such values is an empirical-Bayes (conditional) Bayes factor, not a fully marginal one. When hyperparameters is empty — a fixed prior with no volatility break — nothing was selected and the value is the full marginal likelihood of the model.
It conditions on the presample, so models with different lag orders condition on different initial rows. Fixing the response window and conditioning on initial conditions is the standard practice (Giannone, Lenza and Primiceri 2015), but the resulting Bayes factor is conditional on those initial conditions.
- Parameters:
- hyperparameters#
Hyperparameters the evidence was evaluated at (empty when the prior is fixed and there is no volatility break).
- sample_start#
Timestamp of the first response row.
- Type:
pd.Timestamp
- sample_end#
Timestamp of the last response row.
- Type:
pd.Timestamp
- model_config = {'arbitrary_types_allowed': True, 'frozen': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].