Why Compare INLA With MCMC?
INLA can produce posterior summaries quickly for latent Gaussian models, while Markov chain Monte Carlo (MCMC) approximates posterior quantities using dependent draws. Comparing the two is useful when fitting a joint model, but the comparison has a precise scope: it assesses whether INLA’s approximation and numerical integration give summaries close to those from a well-behaved MCMC analysis of the same posterior distribution. MCMC is not an error-free benchmark. Its estimates also have simulation error, and poor chain exploration can make them misleading.
A fair comparison therefore starts with the target, not with the software output. The data, likelihood, priors, parameter scales, and derived quantities must match. If they do not, different summaries may reflect different analyses rather than approximation error.
Model and Conditions for a Fair Comparison
For concreteness, consider a shared-random-effects model. Subject \(i\) has a longitudinal measurement \(y_{ij}\) at time \(t_{ij}\), and an event time \(T_i\) with event indicator \(\delta_i\). One possible longitudinal submodel is
The subject-specific random effects are \(b_i=(b_{0i},b_{1i})^\mathsf{T}\), with \(b_i\sim N(0,D)\). A current-value survival submodel can be written
where \(m_i(t)=\beta_0+\beta_1t+b_{0i}+b_{1i}t\), \(z_i\) is a baseline covariate, and \(h_{0k}\) is the baseline hazard in interval \(k\). The association parameter \(\alpha\) describes how the modeled longitudinal value is associated with the event hazard, conditional on the other model terms; it is not, by itself, a causal effect.
The comparison assumes independent subjects, the stated longitudinal error and random-effects distributions, the specified piecewise baseline hazard, and censoring that is noninformative conditional on the modeled information. Within a subject, the longitudinal and event records are linked through the shared random effects. Both methods must use the same likelihood and priors for \(\beta_0,\beta_1,D,\sigma^2,\gamma,\alpha\), and the baseline hazard parameters. Any constraints or transformations must also correspond.
INLA approximates posterior marginals for latent Gaussian variables and hyperparameters, including through numerical integration over hyperparameters. MCMC instead uses draws from a Markov chain targeting the posterior. Under suitable regularity and convergence conditions, MCMC averages approach posterior expectations as the number of draws increases. In a finite run, however, those averages have Monte Carlo error. The earlier material on chain diagnostics and INLA hyperparameter integration supplies useful background; here the task is to compare the resulting summaries.
What to Compare
Begin with a small set of summaries tied to the scientific question. For a scalar parameter, compare posterior means or medians, posterior standard deviations, and several quantiles, such as the 2.5th, 50th, and 97.5th percentiles. Also compare a relevant posterior probability, such as \(P(\alpha>0\mid\text{data})\), when that probability has a clear interpretation. For variance components, inspect the distribution itself or a set of quantiles, because a positive variance parameter can have a strongly right-skewed posterior.
Keep posterior uncertainty distinct from computational uncertainty. A posterior standard deviation describes spread in the parameter’s posterior distribution. The Monte Carlo standard error (MCSE) describes simulation uncertainty in an MCMC estimate of a posterior summary, such as the posterior mean. A narrow MCSE does not mean the posterior is narrow, and a narrow posterior does not guarantee that a chain has been simulated accurately.
Here \(\theta\) is the exact posterior quantity of interest, if it were available. The first error on the right is MCMC simulation error; the second is INLA approximation and numerical-integration error. The equation explains why a difference between software summaries cannot automatically be attributed to INLA. MCMC diagnostics and MCSEs help assess its contribution, but do not measure INLA error directly.
For scale, one can report the absolute difference in posterior means divided by a posterior-spread benchmark:
This descriptive quantity expresses the difference relative to the combined posterior spread. It is not a hypothesis test, and no universal cutoff makes two methods “agree.” Separately, compare the mean difference with the MCMC MCSE. A difference much larger than the MCSE is unlikely to be explained by that estimated MCMC simulation error alone, but it does not prove that INLA is wrong: the MCMC run could still have poor exploration, or other implementation differences could remain.
Worked Example: Comparing the Association Estimate
Suppose a hypothetical joint-model analysis gives an INLA posterior mean and standard deviation for \(\alpha\) of \(0.72\) and \(0.23\). A converged MCMC analysis of the same target gives a posterior mean of \(0.68\), posterior standard deviation \(0.24\), and MCSE for the mean \(0.012\). The posterior medians are \(0.71\) (INLA) and \(0.67\) (MCMC). Assume the MCMC chain diagnostics support adequate mixing for this summary.
The difference in posterior means is \(0.72-0.68=0.040\). Relative to the estimated MCMC MCSE, this is \(0.040/0.012=3.33\) MCSEs. Thus, the reported difference is larger than would ordinarily be attributed to the estimated Monte Carlo error of this MCMC mean alone. It warrants investigation, but this ratio is not a p-value and does not identify which method is responsible.
The spread-scaled difference is \(\,0.040/\sqrt{0.23^2+0.24^2}=0.040/0.3325=0.120\). The mean difference is small relative to the posterior spread, even though it is several MCMC MCSEs. These answer different questions: the first compares the difference with MCMC simulation precision; the second compares it with uncertainty about \(\alpha\).
For interpretation on the hazard-ratio scale, suppose the 95% posterior quantiles for \(\alpha\) are \((0.27,1.18)\) from INLA and \((0.22,1.14)\) from MCMC. Exponentiating the endpoints gives INLA \((e^{0.27},e^{1.18})=(1.31,3.25)\) and MCMC \((e^{0.22},e^{1.14})=(1.25,3.13)\). These intervals concern the hazard ratio for a one-unit increase in the modeled longitudinal value, given the stated model and units. The transformed medians are \(e^{0.71}=2.03\) and \(e^{0.67}=1.95\). Exponentiating a posterior median gives the transformed median; exponentiating a posterior mean would not generally give the posterior mean hazard ratio.
Worked Example: A Variance Component With a Skewed Marginal
For the same hypothetical analysis, suppose the posterior summaries for the random-intercept variance \(D_{11}\), measured in squared longitudinal-response units, are: INLA mean \(0.42\), standard deviation \(0.31\); MCMC mean \(0.30\), standard deviation \(0.27\), and MCSE of the MCMC mean \(0.018\). The MCMC chain has adequate effective sample size for this variance summary.
The mean difference is \(0.42-0.30=0.12\), or \(0.12/0.018=6.67\) MCMC MCSEs. The spread-scaled difference is \[ \frac{0.12}{\sqrt{0.31^2+0.27^2}} = \frac{0.12}{0.4110} =0.292. \] The discrepancy is notable relative to the estimated simulation error, while still modest compared with posterior spread. It should prompt checks of parameterization, prior matching, and INLA numerical settings rather than a conclusion based on one ratio.
Suppose the 95% posterior intervals are \((0.08,1.20)\) for INLA and \((0.04,0.98)\) for MCMC. Both distributions are positive and plausibly right-skewed, but the upper tails and means differ. Reporting only the standard deviations or only an interval could conceal this pattern. If one method parameterizes the model using a precision, the comparison must be made on the variance scale by transforming the posterior distribution, not by taking the reciprocal of a single summary such as the mean precision.
A Practical Assessment Workflow
Write down the exact model, prior distributions, data, and parameter scale. Confirm that both methods encode the same event contribution, longitudinal likelihood, and shared effects.
Use chain diagnostics, effective sample sizes, and MCSEs for the summaries being compared. If these indicate inadequate exploration, improve the MCMC run before treating it as a reference.
Tabulate means or medians, posterior standard deviations, selected quantiles, and relevant posterior probabilities. Transform draws or marginal distributions before comparing derived quantities such as hazard ratios.
Check coding and parameterization first. Then examine whether differences are stable under longer MCMC runs and reasonable changes to INLA integration or approximation settings.
A useful report distinguishes numerical findings from judgment. For example: “The posterior mean difference was 0.040, compared with an MCMC MCSE of 0.012; the posterior standard deviations and 95% intervals were similar.” This is more informative than saying simply that the methods “agree” or “disagree.” A reproducible comparison should also record software settings, parameter transformations, and which MCMC draws or chains were included.
Reading Differences and Recognizing Failure Modes
A pattern of close means but different tail quantiles can indicate that marginal shapes differ even when central locations agree. For a variance parameter, upper-tail differences may matter for uncertainty about subject heterogeneity. For an association parameter, differences in a tail probability such as \(P(\alpha>0\mid\text{data})\) may matter even if the means are close. Inspect plots of the marginal densities or cumulative distributions when a small table of summaries does not resolve the pattern.
Marginal agreement is not the same as agreement of the joint posterior. Two methods can give similar one-parameter marginals but differ in dependence among \(\alpha\), the variance components, and other parameters. If the scientific quantity is a joint function of parameters, compare that function’s posterior distribution directly, computed from MCMC draws and from the corresponding INLA approximation where available.
The main alternative to a fast INLA fit is to rely on MCMC for the posterior summaries. A carefully checked MCMC analysis avoids INLA’s marginal approximation, but it can require substantially more computation and remains subject to Monte Carlo error. INLA can be attractive for repeated fitting and rapid marginal summaries, but its accuracy must be assessed for the model and quantities at hand. Neither method repairs a misspecified likelihood, unsuitable priors, or an incorrect interpretation of the association parameter.
Worked Example: Comparing a Slope Marginal
Worked Example: Comparing a Slope Marginal
In a third hypothetical fit, the longitudinal time slope \(\beta_1\) has INLA posterior mean \(0.31\), posterior standard deviation \(0.12\), and 95% interval \((0.08,0.55)\). MCMC gives mean \(0.30\), standard deviation \(0.13\), interval \((0.06,0.56)\), and MCSE for its mean \(0.006\). The response is measured in units per year, so \(\beta_1\) is in response units per year.
The difference in means is \(0.31-0.30=0.010\), which is \(0.010/0.006=1.67\) MCMC MCSEs. The spread-scaled difference is \[ \frac{0.010}{\sqrt{0.12^2+0.13^2}} = \frac{0.010}{0.1769} =0.0565. \] The intervals overlap substantially, and their endpoints differ by \(0.02\) at the lower end and \(0.01\) at the upper end. These summaries suggest close agreement for this marginal, though they do not prove exact equality.
Suppose the fitted marginal calculations give \(P(\beta_1>0\mid\text{data})=0.994\) by INLA and \(0.991\) by MCMC. The difference is \(0.003\), or 0.3 percentage points. Both summaries indicate strong posterior support for a positive time slope under this model. This is a statement about the posterior conditional on the data and prior, not a probability that a fixed parameter is positive in repeated sampling.
Limitations and Takeaway
No single discrepancy score can certify accuracy. MCSEs are themselves estimates, posterior summaries may be sensitive to weak information or prior choices, and checking a handful of marginals cannot rule out error elsewhere in the posterior. If discrepancies persist after matching the target and checking numerical settings, use a more carefully validated computation or investigate the model implementation before relying on the affected summary. The goal is not to declare a universal winner, but to determine whether the approximation is adequate for the parameters and decisions that matter.
Check Your Understanding
Answer each question, then compare with the solutions below.
- INLA and MCMC use different priors for the association parameter. Can their summary difference be interpreted as INLA approximation error?
- An MCMC posterior mean is 0.50 with MCSE 0.02; an INLA mean is 0.54. Calculate the difference in MCMC MCSE units. What does it establish?
- Why should a variance component be compared using its marginal distribution or quantiles, rather than only its posterior mean?
- INLA and MCMC give similar marginal intervals for every parameter checked. Does this establish that their joint posterior dependence is the same?
- If \(\alpha\) is a log-hazard association parameter, how should its posterior interval be converted to a hazard-ratio interval?
Solutions. (1) No. The analyses target different posterior distributions, so the difference combines changes in the target with computational differences. (2) The difference is \(0.54-0.50=0.04\), or \(0.04/0.02=2\) MCSEs. This says the difference is two estimated MCSEs of the MCMC mean; it is not a p-value and does not identify which method is inaccurate. (3) A variance is positive and may have a skewed posterior, so a mean alone can hide tail and shape differences relevant to uncertainty. (4) No. Similar marginals do not establish equal dependence or agreement for joint functions; compare the relevant joint quantity directly. (5) Exponentiate the posterior quantiles for \(\alpha\), including both interval endpoints, to obtain the corresponding hazard-ratio interval.