EvidenceComparison#
- class impulso.evidence.EvidenceComparison(*, evidences, reference)[source]#
Bases:
ImpulsoBaseModelBayes factors and posterior model probabilities across named model evidences.
Built by compare_evidence. The reference model is the denominator of every Bayes factor unless a different one is named per call.
- Parameters:
evidences (dict[str, ModelEvidence])
reference (str)
- evidences#
Named ModelEvidence objects, in the order they were compared.
- Type:
- bayes_factor(model, against=None)[source]#
Bayes factor of model against another model.
Saturates rather than overflowing: a log difference beyond about 709 returns inf (or 0.0 below -709). Quote log_bayes_factor or log10_bayes_factor when the ratio is that large.
- log10_bayes_factor(model, against=None)[source]#
Base-10 log Bayes factor — the unit Kass and Raftery (1995) tabulate.
- model_config = {'arbitrary_types_allowed': True, 'frozen': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- posterior_probabilities()[source]#
Posterior model probabilities under equal prior model weights.
Computed by a max-shifted softmax over the log marginal likelihoods, so the result is stable however far apart the models are.
- to_dataframe(reference=None)[source]#
Tabulate the comparison, one row per model in comparison order.
- Parameters:
reference (str | None) – Denominator for the Bayes-factor columns. Defaults to reference.
- Returns:
DataFrame indexed by model name (index.name is “model”) with columns log_marginal_likelihood, log_bayes_factor, log10_bayes_factor, bayes_factor, posterior_probability, n_obs, n_vars, n_lags and volatility. The reference row has a log Bayes factor of exactly 0.0. volatility is object dtype so a homoscedastic model reads as None rather than as a missing value.
- Return type: