Tutorials › Quantitative Systems Pharmacology (QSP) › Bayes Factors for Competing Biological Mechanisms

Competing Biological Hypotheses · Tutorial 619 of 799

Bayes Factors for Competing Biological Mechanisms

Use marginal likelihoods to calculate and interpret Bayes factors for competing QSP mechanisms, and assess how parameter priors affect the comparison.

Advanced 11 min read

What You'll Learn

  • Define a Bayes factor as a ratio of marginal likelihoods for two specified mechanisms.
  • Calculate marginal likelihoods by averaging likelihood over a model’s parameter prior.
  • Interpret the direction and strength of a Bayes factor without confusing it with posterior model probability.
  • Work through a hypothetical comparison of feedback and feedforward mechanisms.
  • Explain why prior distributions can change a Bayes factor, even when the observed data are unchanged.
  • Identify assumptions, diagnostics, and limitations of Bayes-factor comparisons.

Evidence for Mechanisms Requires Averaging Over Parameters

Two mechanistic QSP models can both describe the same biological system while encoding different causal structures. For example, one may represent cytokine regulation through feedback, while another represents feedforward control. A comparison should account not only for how well each mechanism can fit the observed data, but also for how well it predicted those data across the parameter values considered plausible before seeing them.

A Bayes factor makes this comparison using each model’s marginal likelihood: the likelihood averaged over that model’s parameter prior. It is a measure of relative evidence for the specified models, conditional on the data, the observation model, and the priors. It is not a probability that a mechanism is true.

Definition: Let \(M_1\) and \(M_2\) be two specified models, \(y\) the observed data, and \(\theta_j\) the parameters of model \(M_j\). Given a likelihood \(p(y\mid\theta_j,M_j)\) and a prior density \(\pi_j(\theta_j\mid M_j)\), the marginal likelihood is $$ p(y\mid M_j)=\int p(y\mid\theta_j,M_j)\,\pi_j(\theta_j\mid M_j)\,d\theta_j. $$ The Bayes factor in favor of \(M_1\) over \(M_2\) is $$ BF_{12}=\frac{p(y\mid M_1)}{p(y\mid M_2)}. $$ A value greater than 1 favors \(M_1\) relative to \(M_2\); a value less than 1 favors \(M_2\). A value of 1 means the observed data have equal marginal likelihood under the two models.

The integral averages the likelihood over parameter values, weighted by their prior probabilities. Thus, a parameter value that gives a high likelihood matters in proportion to how much prior probability the model assigned to it. For discrete parameter values, the integral is a weighted sum. For continuous parameters, it is an integral over the parameter space.

A Bayes factor compares the models as specified. The data, experimental design, likelihood, and relevant observation assumptions must be the same in both calculations; model-specific parameters and priors may differ. Each prior used to calculate an ordinary marginal likelihood must be a proper probability distribution, integrating or summing to 1. An improper prior generally leaves the marginal likelihood undefined up to an arbitrary constant, so the Bayes factor cannot then be calculated in the usual way.

Worked Example: Averaging Likelihoods for Two Mechanisms

Suppose a hypothetical experiment records a particular joint biomarker outcome, \(y\). Under a feedback mechanism \(M_F\), a parameter has two possible values with prior probabilities 0.7 and 0.3; the probabilities of observing \(y\) at those values are 0.30 and 0.02. Under a feedforward mechanism \(M_D\), the prior probabilities of its two parameter values are 0.4 and 0.6, with corresponding probabilities of \(y\) equal to 0.18 and 0.20. These are hypothetical probabilities for the same observed outcome under the same data definition.

The marginal likelihood for feedback is the prior-weighted average: $$ p(y\mid M_F)=0.7(0.30)+0.3(0.02)=0.210+0.006=0.216. $$

For feedforward, the calculation is $$ p(y\mid M_D)=0.4(0.18)+0.6(0.20)=0.072+0.120=0.192. $$

Therefore, $$ BF_{F,D}=\frac{0.216}{0.192}=1.125. $$ The observed outcome is 1.125 times as probable under the feedback model as under the feedforward model, after averaging over each model’s stated parameter prior. This is only a modest relative advantage for feedback; it does not establish that feedback is the true mechanism. Comparing only the highest likelihoods would give 0.30 versus 0.20 and miss the fact that the marginal likelihood also depends on the prior weight assigned to parameter values that predict the outcome.

A Two-Mechanism Example with Continuous Parameters

The following idealized calculation shows how two biological mechanisms can imply different prior distributions for a predicted biomarker effect. Let \(y\) be a hypothetical effect measured in normalized biomarker units. Under either mechanism, conditional on its predicted mean effect \(\theta\), suppose the observation model is \(Y\mid\theta,M\sim N(\theta,\sigma^2)\), with known measurement standard deviation \(\sigma=0.5\) units. Suppose the prior predictions for \(\theta\) are \(\theta_F\mid M_F\sim N(1.0,0.4^2)\) for feedback and \(\theta_D\mid M_D\sim N(0.2,0.4^2)\) for feedforward. These proper priors and the Gaussian observation model are assumptions for this hypothetical example, not claims about real mechanisms.

Suppose the observed effect is \(y=1.2\) units. Because the observation is normally distributed around \(\theta\), and the prior for \(\theta\) is normal, integrating over \(\theta\) gives a normal marginal distribution for \(Y\). Its mean is the prior mean, and its variance is the sum of the prior variance and observation variance:

$$ Y\mid M_F\sim N(1.0,\,0.4^2+0.5^2)=N(1.0,0.41), \qquad Y\mid M_D\sim N(0.2,\,0.4^2+0.5^2)=N(0.2,0.41). $$

Here, \(N(\mu,\sigma^2)\) uses variance as its second argument. The marginal likelihoods are probability densities evaluated at the observed value. Their units are inverse normalized-biomarker units, but those units cancel in their ratio. Since the two marginal distributions have the same variance, the normalizing constants cancel:

$$ BF_{F,D} = \frac{\exp\!\left[-(1.2-1.0)^2/(2(0.41))\right]} {\exp\!\left[-(1.2-0.2)^2/(2(0.41))\right]} = \exp\!\left(\frac{1.00-0.04}{0.82}\right) = \exp(1.1707) \approx 3.224. $$

Under these assumptions, the data have about 3.224 times the marginal likelihood under feedback as under feedforward. The observed effect is closer to the feedback prior mean, which explains the direction of the comparison. The calculation does not say that feedback has a 3.224 probability, nor does it establish a causal mechanism independently of the model assumptions.

Justification: The marginal distribution in the normal example follows from writing \(Y=\theta+\varepsilon\), where \(\theta\sim N(\mu_0,\tau^2)\), \(\varepsilon\sim N(0,\sigma^2)\), and \(\theta\) and \(\varepsilon\) are independent. The sum of independent normal variables is normal, so \(Y\sim N(\mu_0,\tau^2+\sigma^2)\). Its density at \(y\) is the integral of \(p(y\mid\theta)\) over the prior for \(\theta\), which is exactly the marginal likelihood.

Why Prior Distributions Affect the Comparison

A prior in a mechanistic model represents which parameter values were plausible before observing the data. Changing that distribution changes the weighting in the marginal-likelihood integral and can therefore change the Bayes factor. This dependence is not a defect in the arithmetic: it is part of what the Bayes factor measures. A model that concentrates prior probability on parameter values that predict the data well can receive more evidence than one that spreads prior probability across many values that predict them poorly.

One way to see the averaging effect is to compare the marginal likelihood with the best-fitting likelihood. If \(L(\theta)=p(y\mid\theta,M)\) and \(L_{\max}\) is its maximum over the model’s parameter space, then $$ p(y\mid M)=L_{\max}\int \frac{L(\theta)}{L_{\max}}\,\pi(\theta\mid M)\,d\theta. $$ The integral is a prior-weighted average of likelihood relative to its maximum and is no greater than 1. A model can fit the data very well at one parameter value but still have a lower marginal likelihood if its prior assigns little weight to the region that fits well. This is often described as an Occam effect: the calculation rewards predictive concentration, not flexibility by itself.

Worked Example: Checking Sensitivity to Prior Width

Keep the observed effect \(y=1.2\) units and both prior means from the continuous example, but widen each prior standard deviation from 0.4 to 1.5 units. Retain the observation standard deviation \(\sigma=0.5\) units. The common marginal variance is now $$ v=1.5^2+0.5^2=2.50. $$

The equal-variance normal-density ratio is $$ BF_{F,D} = \exp\!\left(\frac{(1.2-0.2)^2-(1.2-1.0)^2}{2(2.50)}\right) = \exp\!\left(\frac{1.00-0.04}{5.00}\right) = \exp(0.192) \approx 1.212. $$

With the wider priors, feedback still has the larger marginal likelihood, but the relative evidence is about 1.212 rather than 3.224. Both mechanisms’ broader prior predictions make the observed value less distinctive. This comparison illustrates why prior distributions should be justified scientifically and why it is useful to report how reasonable prior choices affect a Bayes factor.

Bayes Factors and Prior Model Odds

A Bayes factor is not the same quantity as posterior odds. If both models have prior model probabilities, Bayes’ rule gives $$ \frac{P(M_1\mid y)}{P(M_2\mid y)} = BF_{12}\frac{P(M_1)}{P(M_2)}. $$ Thus, the Bayes factor updates prior odds to posterior odds. The prior odds concern the models themselves; the parameter priors used inside each marginal likelihood concern parameter values conditional on a model. These are distinct choices.

Worked Example: Combining Evidence with Prior Model Odds

Suppose the Bayes factor from the continuous example is \(BF_{F,D}=3.224\), but before observing the data the stated prior odds favor feedforward four to one: \(P(M_F)/P(M_D)=1/4\). The posterior odds are $$ \frac{P(M_F\mid y)}{P(M_D\mid y)} = 3.224\left(\frac{1}{4}\right)=0.806. $$

For these two models alone, the corresponding posterior probability for feedback is $$ P(M_F\mid y)=\frac{0.806}{1+0.806}\approx 0.446. $$ The data favor feedback relative to feedforward, as indicated by the Bayes factor, while the specified prior odds are strong enough that the posterior probability for feedback remains below one half. This result depends on the two-model setup and the stated prior model odds; the Bayes factor itself is not a posterior model probability.

Assumptions, Diagnostics, and Alternatives

A defensible Bayes-factor comparison requires more than evaluating a ratio. Check that the competing models are explicit enough to define their likelihoods, that the data and observation assumptions are comparable, and that each parameter prior is proper and scientifically interpretable. The likelihood must represent the actual observation structure, including relevant measurement error and dependence among data. A prior predictive check—simulating data from the prior and model before conditioning on the observed data—can reveal whether a prior assigns substantial probability to biologically implausible outputs.

For complex QSP models, the marginal-likelihood integral may be difficult to compute. Numerical methods can be unstable when most prior parameter values give extremely small likelihoods. Inspect Monte Carlo or integration diagnostics, check stability across runs or numerical settings, and calculate ratios on the log scale when likelihood values are very small. A numerical estimate that changes substantially across reasonable computational settings is not a reliable basis for mechanistic interpretation.

The Bayes factor also inherits weaknesses in the model and prior. If all candidate mechanisms make poor predictions, the one with the larger marginal likelihood is only better relative to the specified alternative; it may still be inadequate. Posterior predictive checks and residual patterns can help reveal such failures. Sensitivity to plausible parameter priors is especially important when biological information is weak or when the data are sparse and indirect.

Other comparison approaches answer different questions. A likelihood-ratio test for nested models evaluates a test statistic under specified sampling assumptions; it does not average likelihood over parameter priors. Information criteria summarize fit with a complexity adjustment, while predictive cross-validation evaluates performance on held-out or predicted data. These can be useful alternatives or complementary checks, but their scores are not Bayes factors and should not be given Bayes-factor interpretations. In particular, a Bayes factor is not a generic measure of predictive performance outside the chosen likelihood and priors.

ApproachWhat is comparedKey distinction
Bayes factorMarginal likelihoods under specified models and parameter priorsDirectly depends on parameter priors and integrates over parameters
Likelihood-ratio testLikelihoods at fitted parameter values for a nested comparisonUses a sampling distribution for a test statistic; does not integrate over priors
Information criterionFit with a penalty or adjustment for model complexityProvides a criterion score, not a prior-based evidence ratio
Predictive cross-validationPredictive performance on held-out data or foldsTargets predictive performance under a specified validation scheme

Common Mistakes and Practical Interpretation

  • Calling a Bayes factor a probability. A value of 3 is not a 3/4 probability that the numerator model is true. It says the data have three times the marginal likelihood under that model as under the denominator model.
  • Using only the best-fitting parameter values. The Bayes factor uses an average over the parameter prior, not the maximum likelihood. Replacing the integral with a maximum changes the method.
  • Treating prior choice as irrelevant. Broad or poorly located priors can change marginal likelihoods. State the priors and assess whether scientifically plausible alternatives alter the comparison.
  • Claiming the favored mechanism is adequate. A relative advantage over one candidate does not show that either model captures the data-generating biology.
  • Comparing incompatible data likelihoods without explanation. Different data definitions or observation assumptions can make the ratio reflect those differences rather than the biological mechanisms of interest.

When reporting a result, identify the numerator and denominator mechanisms, state the data and priors used, give the Bayes factor and its direction, and describe the magnitude as relative evidence under those specifications. Avoid universal verbal labels for strength unless the interpretation convention has been stated. The substantive conclusion is conditional: these data favor one specified model over another under the stated likelihood and priors.

Check Your Understanding

Answer each question, then compare with the brief solutions below.

  1. If \(p(y\mid M_1)=0.12\) and \(p(y\mid M_2)=0.04\), what is \(BF_{12}\), and what does it mean?
  2. Why can a model with a larger maximum likelihood have a smaller marginal likelihood?
  3. In a two-model comparison, the Bayes factor is 2 and the prior odds \(P(M_1)/P(M_2)\) are \(1/3\). What are the posterior odds \(M_1:M_2\)?
  4. Name two checks that can help assess a Bayes-factor analysis for a mechanistic model.

Solutions. (1) \(BF_{12}=0.12/0.04=3\): the data have three times the marginal likelihood under \(M_1\) as under \(M_2\). (2) Its prior may assign little probability to the parameter region with high likelihood, reducing the prior-weighted average. (3) Posterior odds are \(2(1/3)=2/3\), or \(M_1:M_2=2:3\). (4) Examples include prior predictive checks, sensitivity to plausible parameter priors, and numerical stability checks for the marginal-likelihood calculation.

Clinical Biostats