compare_evidence#

impulso.compare_evidence(**fits)[source]#

Compare conjugate-VAR fits by marginal likelihood.

Each keyword names a model, so the labels flow through to the Bayes-factor table:

`python comparison = impulso.compare_evidence(baseline=fit_p1, with_break=fit_p2) comparison.to_dataframe() `

The first fit passed becomes the reference (the denominator of every Bayes factor); override it per call with bayes_factor(name, against=…) or to_dataframe(reference=…).

Every fit must be comparable to the first: the same variable set (order is irrelevant), the same number of response observations, the same sample window and byte-identical response data. What is allowed to differ is exactly what is being compared — lag order, volatility break, prior settings and selected hyperparameters. Note that a VAR(p) drops p initial rows, so comparing lag orders means aligning the response windows by hand (fit the shorter-lag model on data already trimmed by the largest lag order).

Three caveats carry over from ModelEvidence: the evidence conditions on the presample, it conditions on the selected hyperparameters (making the ratio an empirical-Bayes Bayes factor when NIWPrior(select=True) was used), and it includes the volatility-rescaling Jacobian so break and no-break models are comparable.

Parameters:

**fits (FittedVAR | ModelEvidence) – Two or more FittedVAR objects from ConjugateVAR.fit (or bare ModelEvidence objects), keyed by the label to report them under.

Returns:

An EvidenceComparison over the named evidences.

Raises:
  • ValueError – If fewer than two fits are given, if a fit carries no evidence (the PyMC/NUTS path), or if two fits are not comparable.

  • TypeError – If an argument is neither a fitted VAR nor a ModelEvidence.

Return type:

EvidenceComparison

Expand for references to impulso.compare_evidence

The conjugate VAR: fast Bayesian estimation / When to reach for ConjugateVAR instead of the NUTS VAR / Scope