Tutorials › Generalized Linear Mixed Models (GLMM) › Posterior Summaries on Variance and Standard-Deviation Scales

Bayesian GLMM and Prior Specification for Variance Components · Tutorial 285 of 698

Posterior Summaries on Variance and Standard-Deviation Scales

You will learn which posterior summaries transform directly between variance and standard-deviation scales, which do not, and how to report each on the scale that answers your scientific question.

Advanced 12 min read

What You'll Learn

  • Transform posterior draws of a variance component to the corresponding standard-deviation scale.
  • Distinguish the posterior mean of a standard deviation from the square root of the posterior mean variance.
  • Use generalized-inverse quantiles to transform posterior medians and equal-tail intervals, including for distributions with atoms.
  • Recognize why interpolated finite-sample quantiles and MAP estimates may not transform directly.
  • Report uncertainty and units correctly on either scale.

Why the Scale of a Posterior Summary Matters

A GLMM variance component describes the amount of variability attributed to a set of random effects. Its square root describes that variability in the same units as the random effects themselves. Those are related quantities, but their posterior summaries are not interchangeable. For example, the posterior mean variance is not generally the square of the posterior mean standard deviation.

This distinction matters when fitting a Bayesian model: computation may be convenient on one scale, while interpretation is clearer on another. The basic procedure is to transform each posterior draw, then summarize the transformed draws. Some summaries also have exact transformations at the level of the posterior distribution; others do not.

Definition: Let \(V=\sigma_b^2\) be a nonnegative variance component for a random effect \(b\), and let \(T=\sigma_b=\sqrt{V}\) be its standard deviation. For posterior draws \(V^{(1)},\ldots,V^{(M)}\), the corresponding standard-deviation draws are \(T^{(m)}=\sqrt{V^{(m)}}\) for \(m=1,\ldots,M\). A posterior summary on the \(T\) scale is calculated from these transformed draws, unless a distribution-level transformation is justified for that particular summary.

For a random intercept in a logistic GLMM, for example, \(V\) is measured in squared log-odds units and \(T\) in log-odds units. More generally, the standard deviation has the units of the random effect and the variance has their square. The transformation is defined for every valid draw because a variance component is nonnegative.

What Transforms Directly—and What Does Not

Suppose the posterior distribution of \(V\) is \(p(V\mid y)\), conditional on the observed data \(y\), the model, and its prior specification. The posterior distribution of \(T=\sqrt V\) is the distribution induced by applying the square-root function to \(V\). This monotone transformation makes certain summaries easy to relate, but it does not preserve every numerical operation.

The posterior mean on the standard-deviation scale is \(E(\sqrt V\mid y)\). It is generally not equal to \(\sqrt{E(V\mid y)}\). Since the square-root function is concave on the nonnegative real numbers, Jensen’s inequality gives

$$ E(\sqrt{V}\mid y)\leq \sqrt{E(V\mid y)} $$

provided \(E(V\mid y)\) is finite. Equality holds only in special cases, such as when \(V\) is constant with posterior probability one. Thus, if the target is a posterior mean standard deviation, take the square root of every variance draw and average those transformed draws. Do not take the square root of the posterior mean variance.

Quantile result: Define the posterior \(p\)-quantile of a random variable \(X\) by the generalized inverse \(q_p(X)=\inf\{x:F_X(x)\ge p\}\), where \(F_X\) is its cumulative distribution function and \(0<p<1\). For \(T=\sqrt V\), \(q_p(T)=\sqrt{q_p(V)}\). This identity applies to posterior distributions with atoms as well as continuous distributions.

To justify the quantile result, for \(t\geq0\) the distribution function satisfies \(F_T(t)=P(T\leq t\mid y)=P(V\leq t^2\mid y)=F_V(t^2)\). Therefore, the set of nonnegative \(t\) for which \(F_T(t)\geq p\) is the square root of the corresponding set of nonnegative variance values. Taking the infimum gives \(q_p(T)=\sqrt{q_p(V)}\). The generalized-inverse definition is important: when a posterior has an atom, its distribution function can jump past \(p\), so it need not equal \(p\) at the quantile.

The posterior median is the \(p=0.5\) quantile under this convention, so the median standard deviation is the square root of the median variance. Equal-tail posterior intervals transform endpoint by endpoint. In particular, if \([q_{\alpha/2}(V),q_{1-\alpha/2}(V)]\) is an equal-tail interval, then its transformed interval is \([\sqrt{q_{\alpha/2}(V)},\sqrt{q_{1-\alpha/2}(V)}]\). A monotone transformation preserves the posterior probability of the mapped set. With discrete posterior distributions, however, endpoint quantiles may yield interval probability greater than the nominal level.

Worked Example: Summarizing Four Hypothetical Posterior Draws

Suppose four equally weighted posterior draws for a random-intercept variance, in squared log-odds units, are \(0.25, 1, 4,\) and \(9\). The corresponding standard-deviation draws are \(0.5, 1, 2,\) and \(3\) log-odds units.

The mean variance is

$$ \bar V=\frac{0.25+1+4+9}{4}=\frac{14.25}{4}=3.5625 $$

The mean standard deviation is calculated from the transformed draws:

$$ \bar T=\frac{0.5+1+2+3}{4}=\frac{6.5}{4}=1.625 $$

By contrast, the square root of the mean variance is \(\sqrt{3.5625}\approx1.887\) log-odds units. It is not the mean standard deviation; it is larger, as Jensen’s inequality predicts.

Using the empirical distribution’s generalized-inverse quantiles, the median variance is \(1\) and the median standard deviation is \(1=\sqrt{1}\). The 25th and 75th percentile variance quantiles are \(0.25\) and \(4\), so the corresponding standard-deviation quantiles are \(0.5\) and \(2\). These are posterior summaries of a hypothetical random-intercept dispersion, not estimates from an actual study.

Quantiles from Posterior Draws: A Finite-Sample Caution

For a finite collection of draws, an empirical distribution has a well-defined generalized-inverse quantile. Its order-statistic quantiles respect a monotone transformation: sorting the variance draws and then taking the square root gives the same order statistics as sorting the square-root draws. This is the draw-based counterpart of the distribution-level quantile identity.

Some software instead reports interpolated sample quantiles. Such interpolation need not commute with a nonlinear transformation, even when the same interpolation convention is applied on both scales. For instance, with draws \(V=(1,4)\), linear interpolation gives the sample median \((1+4)/2=2.5\). Its square root is \(\sqrt{2.5}\approx1.581\). The transformed draws are \(T=(1,2)\), whose interpolated sample median is \((1+2)/2=1.5\). These values differ. If a particular software convention is required, calculate the requested quantile directly from the draws on the scale being reported and state the convention.

This distinction is about the finite-sample summary rule, not a failure of the posterior-distribution identity. The empirical distribution’s generalized-inverse quantile is an order statistic; an interpolated sample quantile can lie between order statistics and is not necessarily that empirical-distribution quantile.

Worked Example: Atoms and a Posterior Median

Consider a hypothetical posterior distribution that puts probability \(0.2\) on \(V=0\) and probability \(0.8\) on \(V=1\). Its cumulative probability at zero is \(F_V(0)=0.2\). Under the generalized-inverse definition, the 10th percentile of \(V\) is \(0\), because zero is the smallest value where the CDF is at least \(0.1\). It would be incorrect to require \(F_V(q_{0.1}(V))=0.1\).

The transformed variable \(T=\sqrt V\) has probability \(0.2\) at zero and \(0.8\) at one. Its 10th percentile is also zero, and indeed \(q_{0.1}(T)=\sqrt{q_{0.1}(V)}=0\). The generalized-inverse definition handles the jump in the CDF without requiring equality between the CDF and the percentile level.

Intervals, Density Summaries, and Reporting

A credible interval is a set of parameter values with specified posterior probability, conditional on the model, prior, and observed data. If a variance interval is \([a,b]\) with \(0\leq a\leq b\), the mapped interval \([\sqrt a,\sqrt b]\) has the same posterior probability for \(T\), because \(T\in[\sqrt a,\sqrt b]\) exactly when \(V\in[a,b]\). This applies to any interval set under the one-to-one square-root mapping.

Not every interval construction is invariant in its label or procedure. A highest-posterior-density (HPD) interval is based on posterior density, and density changes under nonlinear transformations through a Jacobian factor. Consequently, transforming an HPD interval for \(V\) gives a valid interval for \(T\) with the same posterior probability, but it need not be the HPD interval for \(T\). If the desired output is an HPD interval on the standard-deviation scale, compute it from the standard-deviation draws using the stated HPD procedure.

The same caution applies to the maximum a posteriori estimate (MAP). A density mode is not generally invariant under nonlinear reparameterization, because the transformed density includes a Jacobian. A posterior median is equivariant under the square-root transformation when defined by generalized-inverse quantiles; a posterior mean and a density mode generally are not.

Worked Example: Reporting a Transformed Equal-Tail Interval

Suppose hypothetical posterior draws for a random-intercept variance yield a median of \(0.49\) squared log-odds units and a 90% equal-tail interval with endpoints \(0.09\) and \(1.96\) squared log-odds units, using generalized-inverse quantiles.

The median standard deviation is \(\sqrt{0.49}=0.70\) log-odds units. The 90% equal-tail interval on the standard-deviation scale is

$$ [\sqrt{0.09},\sqrt{1.96}]=[0.30,1.40]\text{ log-odds units}. $$

A suitable report is: “The posterior median random-intercept standard deviation was \(0.70\) log-odds units, with a 90% equal-tail credible interval from \(0.30\) to \(1.40\) log-odds units.” Conditional on the specified model, prior, and data, the interval has 90% posterior probability under the assumed quantile convention. This is not a claim that there is a 90% probability that a fixed parameter lies in this particular interval.

Assumptions, Diagnostics, and Practical Choices

Transforming draws is straightforward, but a trustworthy summary still depends on the draws representing the intended posterior. The variance draws must be nonnegative and come from a proper target posterior. For Monte Carlo summaries, the retained draws should adequately explore that target; chains that have not mixed or have not reached their stationary sampling distribution can give misleading summaries on either scale. The transformation cannot repair poor sampling.

Check that the model output is actually a variance rather than a standard deviation, and that the parameter is a variance component rather than a covariance. For a covariance matrix, apply the relevant transformation to the variance component itself; taking square roots of arbitrary covariance entries is not the standard-deviation transformation. Verify that each transformed draw is \(\sqrt{V^{(m)}}\), retaining the draw pairing if joint summaries with other parameters are needed.

Choose the summary based on the question. A variance is natural when describing dispersion in squared units or comparing variance components. A standard deviation is often easier to communicate as the scale of random-effect deviations. If reporting a posterior mean on the latter scale, average the transformed draws. If reporting a median or equal-tail quantiles, use generalized-inverse posterior quantiles or compute the chosen finite-draw quantile convention directly on the transformed draws.

Common Mistakes and Alternatives

  • Taking the square root of the posterior mean variance and calling it the mean standard deviation. These are generally different. Transform each draw first if the target is \(E(T\mid y)\).
  • Assuming the CDF equals \(p\) at every \(p\)-quantile. A distribution with atoms can jump past \(p\). Use the generalized inverse \(q_p(X)=\inf\{x:F_X(x)\ge p\}\).
  • Transforming an interpolated sample quantile as if it must equal the quantile of transformed draws. This can fail for nonlinear transformations. Calculate the reported sample quantile on the scale of interest, or use order-statistic quantiles when a transformation identity is wanted.
  • Calling a transformed HPD interval the HPD interval on the new scale. The transformed interval has the same posterior probability, but the density-based HPD procedure can change under reparameterization.
  • Reporting a number without its scale or units. State whether the value is a variance or standard deviation and use squared or unsquared units accordingly.

The main alternatives are to report summaries on the variance scale, transform posterior draws and report summaries on the standard-deviation scale, or report both when each answers a distinct question. The draw-by-draw approach is flexible and applies to means, medians, intervals, and joint summaries, but the chosen summary rule and scale should be explicit. A summary on one scale should not be substituted for a different summary on another.

Key takeaway: For a variance draw \(V^{(m)}\), form \(T^{(m)}=\sqrt{V^{(m)}}\) before calculating a standard-deviation-scale mean or other draw-based summary. Generalized-inverse posterior quantiles transform exactly under the square root, even with atoms; interpolated finite-sample quantiles and density-based summaries require more care.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. For hypothetical variance draws \(1,4,9\), calculate the mean variance and the mean standard deviation. Is the square root of the mean variance the mean standard deviation?
  2. If the generalized-inverse posterior median variance is \(2.25\) squared units, what is the posterior median standard deviation?
  3. A 90% equal-tail interval for a variance is \([0.16,6.25]\) squared units. What is the corresponding interval for its standard deviation?
  4. Why can a CDF value at a quantile exceed, rather than equal, the quantile probability?
  5. With draws \(1\) and \(4\), why might an interpolated sample median fail to transform into the interpolated median of the square-root draws?

Solutions. (1) The mean variance is \((1+4+9)/3=14/3\approx4.667\) squared units. The standard-deviation draws are \(1,2,3\), so their mean is \(6/3=2\) units. The square root of the mean variance is \(\sqrt{14/3}\approx2.160\), not \(2\). (2) The median standard deviation is \(\sqrt{2.25}=1.5\) units, by the generalized-inverse quantile transformation. (3) Take square roots of the endpoints: \([\sqrt{0.16},\sqrt{6.25}]=[0.4,2.5]\) units. (4) A CDF can jump at an atom, and the generalized inverse selects the first value where it reaches or exceeds the specified probability. (5) Linear interpolation gives a median of \(2.5\) on the variance scale, whose square root is about \(1.581\); the transformed draws \(1,2\) have interpolated median \(1.5\). The interpolation rule does not commute with the nonlinear square-root transformation.

Clinical Biostats