bioniumx.detection.bayes_factor
- bioniumx.detection.bayes_factor(evidence_m1: float, evidence_m2: float) float[source]
Calculate the Bayes Factor (K) comparing two models.
The Bayes factor is the ratio of the marginal likelihoods (evidences) of two competing models. In atmospheric retrieval, M1 might be a model containing a specific molecule, and M2 is the model without it.
- Parameters:
- Returns:
K – The Bayes factor K = Z1 / Z2. Returns float(‘inf’) if numerical overflow.
- Return type:
References
Trotta, R. (2008), Bayes in the sky: Bayesian inference and model selection in cosmology, Contemp. Phys., 49, 71-104.
Examples
>>> lnZ_with_h2o = -150.2 >>> lnZ_no_h2o = -155.4 >>> K = bayes_factor(lnZ_with_h2o, lnZ_no_h2o) >>> print(f"Bayes factor for H2O: {K:.1f}")