Chapter 12

Latent Variable Methods for Ordinal Data

Many measurements in the social and biomedical sciences are ordinal rather than truly metric: education level (no degree << high school << associate’s << bachelor’s << graduate), survey agreement scales (11 to 55), or binned income brackets. Treating “bachelor’s degree = 4” as twice “high school = 2” in a normal linear model imposes arbitrary arithmetic distances that do not exist in the data! Chapter 12 shows how latent Gaussian variables let us bring all of our multivariate normal and regression machinery to ordinal, skewed, and mixed discrete–continuous datasets without forcing any parametric assumption on the marginal scales.Peter D. Hoff. A First Course in Bayesian Statistical Methods. Springer Texts in Statistics. Springer, New York, 2009. ISBN 978-0-387-92299-7. doi: 10.1007/978-0-387-92407-6

12.1Ordered Probit Regression and Identifiability

Consider Hoff’s 1994 General Social Survey example relating a respondent’s highest degree DEGi∈{1,2,3,4,5}\text{DEG}_i \in \{1, 2, 3, 4, 5\} to their number of children CHILDi\text{CHILD}_i and parent’s education indicator PDEGi\text{PDEG}_i. An ordered probit regressionJames H. Albert and Siddhartha Chib. Bayesian Analysis of Binary and Polychotomous Response Data. Journal of the American Statistical Association, 88(422):669–679, 1993 posits an unobserved continuous latent score ZiZ_i that follows a linear regression, together with ordered cutpoints −∞=g0<g1<⋯<gK−1<gK=+∞-\infty = g_0 < g_1 < \dots < g_{K-1} < g_K = +\infty mapping ZiZ_i onto the observed ordinal categories:

Zi=𝜷T𝐱i+ϵi,ϵi∼i.i.d.𝒩(0,1),Yi=k  ⟺  gk−1<Zi≤gk(k=1,…,K). Z_i = \boldsymbol{\beta}^T \mathbf{x}_i + \epsilon_i, \qquad \epsilon_i \stackrel{\text{i.i.d.}}{\sim} \mathcal{N}(0, 1), \qquad Y_i = k \iff g_{k-1} < Z_i \le g_k \quad (k = 1, \dots, K). (12.1)

Hence Pr⁡(Yi≤k∣𝐱i,𝜷,𝐠)=Φ(gk−𝜷T𝐱i)\Pr(Y_i \le k \mid \mathbf{x}_i, \boldsymbol{\beta}, \mathbf{g}) = \Phi(g_k - \boldsymbol{\beta}^T\mathbf{x}_i) (Figure 12.1, left panel).

Remark 12.1 (Why sigma^2 = 1 and the intercept is omitted). Notice two deliberate constraints in (12.1): there is no intercept in 𝜷T𝐱i\boldsymbol{\beta}^T\mathbf{x}_i (with 𝐗\mathbf{X} full-rank and its column space not containing the constant vector 𝟏\mathbf{1}), and the error variance is fixed at σ2=1\sigma^2 = 1. Why? Because shifting every ZiZ_i and every threshold gkg_k by +c+c leaves every inequality gk−1<Zi≤gkg_{k-1} < Z_i \le g_k unchanged (location non-identifiability), and multiplying both ZiZ_i and 𝐠\mathbf{g} by any a>0a > 0 likewise leaves every category probability unchanged (scale non-identifiability)! Fixing the intercept to 00 and σ2=1\sigma^2 = 1 makes (𝜷,𝐠)(\boldsymbol{\beta}, \mathbf{g}) uniquely identifiable.

12.1.1Data-Augmentation Gibbs Sampler (Albert & Chib)

Direct likelihood inference over (𝜷,𝐠)(\boldsymbol{\beta}, \mathbf{g}) involves awkward products of differences Φ(gyi−𝜷T𝐱i)−Φ(gyi−1−𝜷T𝐱i)\Phi(g_{y_i} - \boldsymbol{\beta}^T\mathbf{x}_i) - \Phi(g_{y_i - 1} - \boldsymbol{\beta}^T\mathbf{x}_i). Conditioning on the latent vector 𝐳=(Z1,…,Zn)T\mathbf{z} = (Z_1, \dots, Z_n)^T restores instant normality! Under 𝜷∼𝒩p(𝟎,Σ0)\boldsymbol{\beta} \sim \mathcal{N}_p(\mathbf{0}, \Sigma_0) and ordered normal priors on g1,…,gK−1g_1, \dots, g_{K-1}, the three full conditionals are:

  1. Regression coefficients 𝜷∣𝐳,𝐗\boldsymbol{\beta} \mid \mathbf{z}, \mathbf{X}: standard Chapter 9 normal linear regression with known variance σ2=1\sigma^2 = 1:

    𝜷∣𝐳,𝐗∼𝒩p(V𝐗T𝐳,  V),V=(Σ0−1+𝐗T𝐗)−1. \boldsymbol{\beta} \mid \mathbf{z}, \mathbf{X} \sim \mathcal{N}_p\bigl(V \mathbf{X}^T \mathbf{z},\; V\bigr), \qquad V = (\Sigma_0^{-1} + \mathbf{X}^T \mathbf{X})^{-1}. (12.2)
  2. Latent variables Zi∣yi,𝐱i,𝜷,𝐠Z_i \mid y_i, \mathbf{x}_i, \boldsymbol{\beta}, \mathbf{g}: independent truncated normal draws 𝒩(𝜷T𝐱i,1)\mathcal{N}(\boldsymbol{\beta}^T \mathbf{x}_i, 1) restricted to (gyi−1, gyi)(g_{y_i - 1},\, g_{y_i}), sampled cleanly via the inverse-CDF method (Appendix B).

  3. Thresholds gk∣𝐲,𝐳,𝐠−kg_k \mid \mathbf{y}, \mathbf{z}, \mathbf{g}_{-k}: truncated normal on (ak,bk)(a_k, b_k), where

    ak=max⁡{gk−1,  max⁡i: yi=kZi},bk=min⁡{gk+1,  min⁡i: yi=k+1Zi}. a_k = \max\bigl\{g_{k-1},\; \max_{i:\, y_i = k} Z_i\bigr\}, \qquad b_k = \min\bigl\{g_{k+1},\; \min_{i:\, y_i = k + 1} Z_i\bigr\}. (12.3)

Look closely at (12.3): when nn is large, the gap between max⁡yi=kZi\max_{y_i = k} Z_i and min⁡yi=k+1Zi\min_{y_i = k+1} Z_i shrinks to O(1/n)O(1/n)! That traps each threshold gkg_k inside a microscopic corridor, causing excruciatingly slow MCMC mixing between 𝐠\mathbf{g}, 𝐳\mathbf{z}, and 𝜷\boldsymbol{\beta}.

Two panels: Ordered probit latent normal density partitioned by thresholds g1 through g4 into five ordinal categories Y equals 1 through 5; and a Gaussian copula scatter plot with latent correlation C12 equals 0.68 generating an ordinal Y1 and right-skewed continuous Y2 with rising group medians
Figure 12.1: Left: ordered probit maps a continuous latent regression score Zi∼𝒩(𝜷T𝐱i,1)Z_i \sim \mathcal{N}(\boldsymbol{\beta}^T\mathbf{x}_i, 1) into ordinal categories via thresholds g1,…,g4g_1, \dots, g_4. Right: a Gaussian copula (C12=0.68C_{12} = 0.68) cleanly captures strong monotone association between an ordinal variable Y1Y_1 and a skewed variable Y2Y_2 without forcing normality on either margin.

12.2Pettitt’s Rank Likelihood: Eliminating the Thresholds

How do we eliminate the prior on 𝐠\mathbf{g} and the tight 𝐠\mathbf{g}–𝐳\mathbf{z} coupling—and even handle continuous non-normal responses where the number of distinct values KK is huge? Suppose Yi=g(Zi)Y_i = g(Z_i) for an unknown non-decreasing transformation gg. Even without knowing gg, observing 𝐲=(y1,…,yn)\mathbf{y} = (y_1, \dots, y_n) tells us an exact order event on the latent vector 𝐳\mathbf{z}:

𝐳∈R(𝐲)≡{𝐳∈ℝn:yi<yj  ⟹  zi<zj for all i,j}. \mathbf{z} \in R(\mathbf{y}) \equiv \bigl\{\mathbf{z} \in \mathbb{R}^n : y_i < y_j \implies z_i < z_j \text{ for all } i, j\bigr\}. (12.4)

The rank likelihoodAnthony N. Pettitt. Inference for the Linear Model Using a Likelihood Based on Ranks. Journal of the Royal Statistical Society, Series B, 44(2):234–243, 1982 uses the probability of the event {𝐙∈R(𝐲)}\{\mathbf{Z} \in R(\mathbf{y})\}, bypassing gg (and all thresholds gkg_k) entirely:

p(𝐙∈R(𝐲)∣𝐗,𝜷)=∫R(𝐲)p(𝐳∣𝐗,𝜷) d𝐳. p\bigl(\mathbf{Z} \in R(\mathbf{y}) \mid \mathbf{X}, \boldsymbol{\beta}\bigr) = \int_{R(\mathbf{y})} p(\mathbf{z} \mid \mathbf{X}, \boldsymbol{\beta})\,d\mathbf{z}. (12.5)

Because R(𝐲)R(\mathbf{y}) depends only on the ordering of 𝐲\mathbf{y} and not on any numerical coding of categories or parametric form of gg, inference for 𝜷\boldsymbol{\beta} is completely invariant to strictly increasing transformations of YY! (Note that when nn is large and KK is small, each ZiZ_i is still confined between neighboring categories, so convergence diagnostics remain essential.) Gibbs sampling under (12.5) requires only two blocks:

Algorithm 12.2 (Rank-Likelihood Regression Gibbs Sampler). Initialize 𝐳(0)∈R(𝐲)\mathbf{z}^{(0)} \in R(\mathbf{y}) (e.g., normal scores Φ−1(rank⁡(yi)n+1)\Phi^{-1}\bigl(\frac{\operatorname{rank}(y_i)}{n+1}\bigr)) and 𝜷(0)\boldsymbol{\beta}^{(0)}. For s=1,…,Ss = 1, \dots, S:

  1. Update 𝜷(s)\boldsymbol{\beta}^{(s)} from the normal regression conditional (12.2) given 𝐳(s−1)\mathbf{z}^{(s-1)}.

  2. Update Zi(s)Z_i^{(s)} sequentially for i=1,…,ni = 1, \dots, n: draw Zi(s)Z_i^{(s)} from 𝒩(𝜷(s)T𝐱i,1)\mathcal{N}(\boldsymbol{\beta}^{(s)T}\mathbf{x}_i, 1) truncated to the order-preserving interval (ai,bi)(a_i, b_i), where

    ai=max⁡{zj:yj<yi},bi=min⁡{zj:yj>yi} a_i = \max\{z_j : y_j < y_i\}, \qquad b_i = \min\{z_j : y_j > y_i\}

    (with ai=−∞a_i = -\infty if yiy_i is minimal, and bi=+∞b_i = +\infty if yiy_i is maximal).

12.3Semiparametric Gaussian Copula Models

Now elevate the exact same idea from regression to multivariate mixed data: suppose each respondent i=1,…,ni = 1, \dots, n has a pp-dimensional vector 𝐘i=(Yi,1,…,Yi,p)\mathbf{Y}_i = (Y_{i,1}, \dots, Y_{i,p}) mixing binary, ordinal, count, and skewed continuous variables (such as Hoff’s 1994 GSS dataset of 7 variables: INCOME, DEG, CHILD, PDEG, AGE, PINC, FEMALE).

By Sklar’s theoremAbe Sklar. Fonctions de répartition à nn dimensions et leurs marges. Publications de l’Institut de Statistique de l’Université de Paris, 8:229–231, 1959, any joint distribution with marginal CDFs F1,…,FpF_1, \dots, F_p can be decomposed into its marginals and a dependence function (a copula). The Gaussian copula models the dependence through a latent multivariate normal vector with unit variances and correlation matrix CC:

𝐙1,…,𝐙n∣C∼i.i.d.𝒩p(𝟎,C),Yi,j=Fj−1 ⁣(Φ(Zi,j)),j=1,…,p, \mathbf{Z}_1, \dots, \mathbf{Z}_n \mid C \stackrel{\text{i.i.d.}}{\sim} \mathcal{N}_p(\mathbf{0}, C), \qquad Y_{i,j} = F_j^{-1}\!\bigl(\Phi(Z_{i,j})\bigr), \qquad j = 1, \dots, p, (12.6)

where Fj−1(u)=inf⁡{y:Fj(y)≥u}F_j^{-1}(u) = \inf\{y : F_j(y) \ge u\} is the generalized inverse of the unknown marginal CDF FjF_j (Figure 12.1, right panel).Subtlety of Sklar’s theorem for discrete margins: when all FjF_j are continuous, the copula CC is unique. When some coordinates YjY_j are discrete or ordinal, the copula is uniquely determined only on the Cartesian product of the ranges of FjF_j; the rank-likelihood posterior over CC integrates coherently over all latent orderings compatible with the observed ties, identifying the latent Gaussian correlation structure cleanly.Peter D. Hoff. Extending the Rank Likelihood for Semiparametric Copula Estimation. The Annals of Applied Statistics, 1(1):265–283, 2007

12.3.1Extended Rank Likelihood and Parameter Expansion

Applying the rank likelihood column by column defines the order constraint 𝐙∈R(𝐘)\mathbf{Z} \in R(\mathbf{Y}), where within every column j=1,…,pj = 1, \dots, p, yi1,j<yi2,j  ⟹  zi1,j<zi2,jy_{i_1, j} < y_{i_2, j} \implies z_{i_1, j} < z_{i_2, j}. Look at what happens automatically when an entry yi,jy_{i,j} is **missing at random (MAR)**Roderick J. A. Little and Donald B. Rubin. Statistical Analysis with Missing Data. John Wiley & Sons, Hoboken, NJ, second edition, 2002: it imposes no ordering constraint on Zi,jZ_{i,j}, so (ai,j,bi,j)=(−∞,+∞)(a_{i,j}, b_{i,j}) = (-\infty, +\infty)—meaning we simply draw Zi,jZ_{i,j} from its unconstrained conditional normal distribution given 𝐙i,−j\mathbf{Z}_{i,-j}! Missing data require literally zero extra machinery!

One obstacle remains: sampling a correlation matrix CC directly (subject to Cj,j=1C_{j,j} = 1 for all jj) has no conjugate prior. HoffPeter D. Hoff. Extending the Rank Likelihood for Semiparametric Copula Estimation. The Annals of Applied Statistics, 1(1):265–283, 2007 resolves this with parameter expansionJun S. Liu and Ying Nian Wu. Parameter Expansion for Data Augmentation. Journal of the American Statistical Association, 94(448):1264–1274, 1999:

  1. Work with an unconstrained covariance matrix Σ∼inverse-Wishart⁡(ν0,S0−1)\Sigma \sim \operatorname{inverse-Wishart}(\nu_0, S_0^{-1}) (for which Σ∣𝐙\Sigma \mid \mathbf{Z} is conjugate!) and treat Σ\Sigma—not CC—as the Markov chain state, placing on CC the prior induced through the correlation projection C=h(Σ)C = h(\Sigma) where Cj,k=Σj,k/Σj,jΣk,kC_{j,k} = \Sigma_{j,k} / \sqrt{\Sigma_{j,j}\Sigma_{k,k}}.
  2. Why is this valid? Because rescaling column jj of 𝐙\mathbf{Z} by any positive standard deviation dj=Σj,jd_j = \sqrt{\Sigma_{j,j}} leaves the ordering event R(𝐘)R(\mathbf{Y}) strictly invariant! Running the Gibbs sampler on the expanded pair (𝐙,Σ)(\mathbf{Z}, \Sigma) with 𝐙i∣Σ∼𝒩p(𝟎,Σ)\mathbf{Z}_i \mid \Sigma \sim \mathcal{N}_p(\mathbf{0}, \Sigma) preserves the exact induced posterior of C=h(Σ)C = h(\Sigma), which we simply record as output at every scan!

Algorithm 12.3 (Parameter-Expanded Gibbs Sampler for the Gaussian Copula). Initialize 𝐙(0)∈R(𝐘)\mathbf{Z}^{(0)} \in R(\mathbf{Y}) (column-wise normal scores, 00 for missing entries) and Σ(0)=Ip\Sigma^{(0)} = I_p. For s=1,…,Ss = 1, \dots, S:

  1. Update latent matrix 𝐙\mathbf{Z} given Σ(s−1)\Sigma^{(s-1)}: for each column j=1,…,pj = 1, \dots, p, compute the conditional regression weights 𝐰j=Σ−j,−j−1Σ−j,j\mathbf{w}_j = \Sigma_{-j,-j}^{-1} \Sigma_{-j,j} and conditional variance vj=Σj,j−Σj,−jΣ−j,−j−1Σ−j,jv_j = \Sigma_{j,j} - \Sigma_{j,-j} \Sigma_{-j,-j}^{-1} \Sigma_{-j,j} from Σ=Σ(s−1)\Sigma = \Sigma^{(s-1)}. For each observation i=1,…,ni = 1, \dots, n, set μi,j=𝐙i,−j𝐰j\mu_{i,j} = \mathbf{Z}_{i,-j}\mathbf{w}_j:
    • if yi,jy_{i,j} is observed, draw Zi,jZ_{i,j} from 𝒩(μi,j,vj)\mathcal{N}(\mu_{i,j}, v_j) truncated to (max⁡k: yk,j<yi,jZk,j,  min⁡k: yk,j>yi,jZk,j)(\max_{k:\, y_{k,j} < y_{i,j}} Z_{k,j},\; \min_{k:\, y_{k,j} > y_{i,j}} Z_{k,j});
    • if yi,jy_{i,j} is missing, draw Zi,j∼𝒩(μi,j,vj)Z_{i,j} \sim \mathcal{N}(\mu_{i,j}, v_j) unconstrained.
  2. Parameter-expanded covariance draw: draw Σ(s)∼inverse-Wishart⁡(ν0+n, (S0+𝐙T𝐙)−1)\Sigma^{(s)} \sim \operatorname{inverse-Wishart}\bigl(\nu_0 + n,\, (S_0 + \mathbf{Z}^T \mathbf{Z})^{-1}\bigr) and record the projected correlation matrix Cj,k(s)=Σj,k(s)/Σj,j(s)Σk,k(s)C^{(s)}_{j,k} = \Sigma^{(s)}_{j,k} / \sqrt{\Sigma^{(s)}_{j,j}\Sigma^{(s)}_{k,k}} as output (keeping Σ(s)\Sigma^{(s)} as the chain state for the next scan).Watch for a variable-naming typo in Hoff’s R code on p. 220, which defines the conditional regression-weight vector Sz <- Sigma[j,-j] %*% solve(Sigma[-j,-j]) on line 1 and then references Sjc on lines 2–3; see Appendix C.

12.3.2Partial Regression and Latent Conditional Independence Graphs

Once we have posterior draws C(1),…,C(S)C^{(1)}, \dots, C^{(S)} from Algorithm 12.3, every tool from Chapter 7 carries over intact to arbitrary mixed ordinal data! In particular, computing the partial regression coefficients 𝜷j∣−j(s)=(C−j,−j(s))−1C−j,j(s)\boldsymbol{\beta}_{j \mid -j}^{(s)} = (C_{-j,-j}^{(s)})^{-1} C_{-j,j}^{(s)} and the precision matrix Ω(s)=(C(s))−1\Omega^{(s)} = (C^{(s)})^{-1} at each iteration reveals the latent Gaussian graphical modelSteffen L. Lauritzen. Graphical Models. Oxford University Press, New York, 1996: a zero entry Ωj,k=0\Omega_{j,k} = 0 means ZjZ_j and ZkZ_k are conditionally independent given all remaining latent variables (note that this transfers directly to conditional independence of the observables YjY_j and YkY_k given 𝐘−{j,k}\mathbf{Y}_{-\{j,k\}} only when all margins are continuous, since coarse discrete margins carry less conditioning information than the latent scores). In Hoff’s 1994 GSS analysis, marginal correlations link almost every pair of variables, whereas the partial coefficients isolate direct pathways—showing, for example, that respondent income depends strongly on DEG, AGE, and FEMALE, while parent’s education PDEG acts largely indirectly through the respondent’s own degree DEG!

import numpy as np
from scipy import stats

# Parameter-expanded Gaussian copula Gibbs sampler on mixed ordinal + skewed data
rng = np.random.default_rng(12)
n, p = 150, 3
C_true = np.array([[1.0, 0.65, 0.30], [0.65, 1.0, 0.50], [0.30, 0.50, 1.0]])
Z_true = rng.multivariate_normal(np.zeros(p), C_true, size=n)

# Create mixed non-normal observables: Y0 ordinal (1..5), Y1 skewed exp, Y2 binary (0/1)
Y = np.empty((n, p))
Y[:, 0] = np.digitize(stats.norm.cdf(Z_true[:, 0]), [0.15, 0.40, 0.70, 0.88]) + 1
Y[:, 1] = np.exp(0.7 * Z_true[:, 1])
Y[:, 2] = (Z_true[:, 2] > 0.2).astype(float)
Y[rng.uniform(size=(n, p)) < 0.08] = np.nan  # inject 8% MCAR missing entries

# Initialize Z with column-wise normal scores (0 for missing) and Sigma = I_p
Z = np.zeros((n, p))
for j in range(p):
    obs = ~np.isnan(Y[:, j])
    ranks = stats.rankdata(Y[obs, j])
    Z[obs, j] = stats.norm.ppf(ranks / (obs.sum() + 1.0))

nu0, S0 = p + 2.0, np.eye(p)
Sig = np.eye(p)  # keep expanded Sigma as the Markov chain state!
S_iter = 600
C_draws = np.empty((S_iter, p, p))

for s in range(S_iter):
    # 1. Update Z column by column given Sigma and order constraints R(Y)
    for j in range(p):
        oth = [k for k in range(p) if k != j]
        w = np.linalg.solve(Sig[np.ix_(oth, oth)], Sig[oth, j])
        sd = np.sqrt(max(Sig[j, j] - float(Sig[j, oth] @ w), 1e-8))
        mu = Z[:, oth] @ w
        yj = Y[:, j]
        obs_vals = np.unique(yj[~np.isnan(yj)])
        for val in obs_vals:
            idx = np.where(yj == val)[0]
            lo_mask = (~np.isnan(yj)) & (yj < val)
            hi_mask = (~np.isnan(yj)) & (yj > val)
            a = Z[lo_mask, j].max() if np.any(lo_mask) else -np.inf
            b = Z[hi_mask, j].min() if np.any(hi_mask) else np.inf
            ua = stats.norm.cdf((a - mu[idx]) / sd)
            ub = stats.norm.cdf((b - mu[idx]) / sd)
            u = rng.uniform(ua, np.maximum(ub, ua + 1e-12))
            draw = mu[idx] + sd * stats.norm.ppf(np.clip(u, 1e-12, 1 - 1e-12))
            Z[idx, j] = np.clip(draw, a, b)
        mis = np.where(np.isnan(yj))[0]
        if len(mis):
            Z[mis, j] = rng.normal(mu[mis], sd)
    # 2. Parameter-expanded Inverse-Wishart draw; record projected C = h(Sigma)
    Sig = stats.invwishart.rvs(df=nu0 + n, scale=S0 + Z.T @ Z, random_state=rng)
    d = np.sqrt(np.diag(Sig))
    C_draws[s] = Sig / np.outer(d, d)

print("True C:\n", np.round(C_true, 2))
print("Posterior E[C | Y]:\n", np.round(C_draws[150:].mean(axis=0), 2))

12.4Modern Developments: Copula Graphs, Exact Probit, and Efficiency

12.4.1Gaussian Copula Graphical Models

Section 12.3.2 read a latent graph off posterior draws of Ω(s)\Omega^{(s)}, but the inverse-Wishart draw of Algorithm 12.3 never yields an entry exactly equal to zero; a copula graphical model makes the graph GG itself a parameter.Beyond Hoff (2009). This material is not in Hoff’s book; Dobra and Lenkoski (2011) and Mohammadi et al. (2017) join Hoff’s extended rank likelihood to a prior on sparse precision matrices. Let Ω=Σ−1\Omega = \Sigma^{-1} be the expanded precision and PGP_G the positive definite matrices with Ωj,k=0\Omega_{j,k} = 0 for every missing edge. The GG-Wishart prior givesAdrian Dobra and Alex Lenkoski. Copula Gaussian graphical models and their application to modeling functional disability data. The Annals of Applied Statistics, 5(2A):969–993, 2011. doi: 10.1214/10-AOAS397

p(Ω∣G)=∣Ω∣(δ−2)/2IG(δ,S0) e−tr⁡(ΩS0)/2 𝟏(Ω∈PG),Ω∣𝐙,G∼WG(δ+n, S0+𝐙T𝐙),p(G∣𝐙)∝p(G) IG(δ+n, S0+𝐙T𝐙)IG(δ,S0). \begin{aligned} p(\Omega \mid G) &= \frac{\lvert\Omega\rvert^{(\delta - 2)/2}}{I_G(\delta, S_0)}\,e^{-\operatorname{tr}(\Omega S_0)/2}\,\mathbf{1}(\Omega \in P_G), \qquad \Omega \mid \mathbf{Z}, G \sim W_G(\delta + n,\, S_0 + \mathbf{Z}^T\mathbf{Z}), \\ p(G \mid \mathbf{Z}) &\propto p(G)\,\frac{I_G(\delta + n,\, S_0 + \mathbf{Z}^T\mathbf{Z})}{I_G(\delta, S_0)}. \end{aligned} (12.7)

Why it holds. The normal likelihood multiplies the prior by ∣Ω∣n/2e−tr⁡(Ω𝐙T𝐙)/2\lvert\Omega\rvert^{n/2}e^{-\operatorname{tr}(\Omega\mathbf{Z}^T\mathbf{Z})/2}, so (δ,S0)(\delta, S_0) simply updates, and the ratio of normalizers is the marginal likelihood of GG. For the complete graph and δ=ν0−p+1\delta = \nu_0 - p + 1 it is exactly Hoff’s Step 2. Parameter expansion survives because C−1=ΔΩΔC^{-1} = \Delta\Omega\Delta with Δ=diag⁡(Σj,j)\Delta = \operatorname{diag}(\sqrt{\Sigma_{j,j}}): rescaling never creates or destroys a zero. The 𝐙\mathbf{Z} update is untouched. As IGI_G is intractable for general graphs, GG and Ω\Omega are explored jointly, by reversible jumpAdrian Dobra and Alex Lenkoski. Copula Gaussian graphical models and their application to modeling functional disability data. The Annals of Applied Statistics, 5(2A):969–993, 2011. doi: 10.1214/10-AOAS397 or by a birth–death process on edges.Abdolreza Mohammadi, Fentaw Abegaz, Edwin R. van den Heuvel, and Ernst C. Wit. Bayesian Modelling of Dupuytren Disease by Using Gaussian Copula Graphical Models. Journal of the Royal Statistical Society Series C: Applied Statistics, 66(3):629–645, 2017. doi: 10.1111/rssc.12171

When to use it. Use it when edge probabilities Pr⁡(Ωj,k≠0∣𝐘)\Pr(\Omega_{j,k} \ne 0 \mid \mathbf{Y}) are the question or pp is large relative to nn. Keep Hoff’s inverse-Wishart when a few partial coefficients with intervals suffice. Edges describe the latent scores, with the caution of Section 12.3.2 for discrete margins.

12.4.2Exact i.i.d. Sampling for Binary Probit Regression

With K=2K = 2 categories, the slow coupling behind (12.3) can be removed altogether: the posterior of 𝜷\boldsymbol{\beta} is a known distribution, the unified skew-normal, and can be sampled without a Markov chain.Beyond Hoff (2009). This material is not in Hoff’s book; Durante (2019) proved this conjugacy, and Botev (2017) supplies the truncated-normal sampler that makes it practical, replacing Albert–Chib Gibbs. Code yi∈{0,1}y_i \in \{0, 1\} for {Yi=2}\{Y_i = 2\}, and let XX have rows (𝐱iT,−1)(\mathbf{x}_i^T, -1) so that the last entry of 𝜷\boldsymbol{\beta} is the single threshold g1g_1. With prior 𝜷∼𝒩(𝟎,Σ0)\boldsymbol{\beta} \sim \mathcal{N}(\mathbf{0}, \Sigma_0) on the augmented vector, set D=diag⁡(2𝐲−𝟏)XD = \operatorname{diag}(2\mathbf{y} - \mathbf{1})X and S=In+DΣ0DTS = I_n + D\Sigma_0D^T. ThenDaniele Durante. Conjugate Bayes for probit regression via unified skew-normal distributions. Biometrika, 106(4):765–779, 2019. doi: 10.1093/biomet/asz034

𝜷∣𝐲=dΣ0DTS−1𝐓+𝐕,𝐓∼𝒩n(𝟎,S) given 𝐓>𝟎,𝐕∼𝒩(𝟎, Σ0−Σ0DTS−1DΣ0) independent of 𝐓,p(𝐲)=Φn(𝟎;S), \begin{aligned} \boldsymbol{\beta} \mid \mathbf{y} &\stackrel{d}{=} \Sigma_0D^TS^{-1}\mathbf{T} + \mathbf{V}, \qquad \mathbf{T} \sim \mathcal{N}_n(\mathbf{0}, S) \text{ given } \mathbf{T} > \mathbf{0}, \\ \mathbf{V} &\sim \mathcal{N}\bigl(\mathbf{0},\, \Sigma_0 - \Sigma_0D^TS^{-1}D\Sigma_0\bigr) \text{ independent of } \mathbf{T}, \qquad p(\mathbf{y}) = \Phi_n(\mathbf{0}; S), \end{aligned} (12.8)

where Φn(⋅ ;S)\Phi_n(\cdot\,; S) is the 𝒩n(𝟎,S)\mathcal{N}_n(\mathbf{0}, S) distribution function.

Why it holds. Let 𝐓=D𝜷+𝝐\mathbf{T} = D\boldsymbol{\beta} + \boldsymbol{\epsilon} with 𝝐∼𝒩n(𝟎,In)\boldsymbol{\epsilon} \sim \mathcal{N}_n(\mathbf{0}, I_n). Given 𝜷\boldsymbol{\beta}, Pr⁡(𝐓>𝟎)=∏iΦ((2yi−1)Xi𝜷)\Pr(\mathbf{T} > \mathbf{0}) = \prod_i \Phi((2y_i - 1)X_i\boldsymbol{\beta}) is the probit likelihood, so conditioning on {𝐓>𝟎}\{\mathbf{T} > \mathbf{0}\} is conditioning on the data. As (𝜷,𝐓)(\boldsymbol{\beta}, \mathbf{T}) is jointly normal, regressing 𝜷\boldsymbol{\beta} on 𝐓\mathbf{T} gives both terms, and symmetry gives p(𝐲)p(\mathbf{y}). Check: one observation y=1y = 1 with X=Σ0=1X = \Sigma_0 = 1 has S=2S = 2, p(y)=1/2p(y) = 1/2, and posterior mean 1222/π=1/π≈0.564\frac{1}{2}\sqrt{2}\sqrt{2/\pi} = 1/\sqrt{\pi} \approx 0.564. Truncated normals are drawn exactly by accept–reject with minimax exponential tilting.Z. I. Botev. The Normal Law Under Linear Restrictions: Simulation and Estimation via Minimax Tilting. Journal of the Royal Statistical Society Series B: Statistical Methodology, 79(1):125–148, 2017. doi: 10.1111/rssb.12162

When to use it. Use it for small to moderate nn, any pp (the cost sits in an nn-dimensional truncated normal), and for model comparison through p(𝐲)p(\mathbf{y}), where only Φn\Phi_n must be estimated. Keep the Gibbs sampler of Section 12.1.1 for large nn, or for K>2K > 2 with unknown thresholds.

12.4.3Efficiency of the Rank Likelihood and Margins under MAR

The rank likelihood (12.5) and its copula extension discard everything but order, which raises two questions left open above: how much information is lost about CC, and how can we predict on the original scale without the margins FjF_j?Beyond Hoff (2009). This material is not in Hoff’s book; Hoff, Niu, and Wellner (2014) settle the first question for continuous margins, and Feldman and Kowal (2024) address the second for mixed and missing data. Let C=C(𝝑)C = C(\boldsymbol{\vartheta}) be a smoothly parameterized correlation matrix and LRL_R the probability of the observed ranks. For continuous margins,Peter D. Hoff, Xiaoyue Niu, and Jon A. Wellner. Information bounds for Gaussian copulas. Bernoulli, 20(2):604–622, 2014. doi: 10.3150/12-BEJ499

log⁡LR(𝝑+𝐡/n)LR(𝝑)→dnormal⁡ ⁣(−12𝐡TI∗𝐡,  𝐡TI∗𝐡),F̃j(x)=Φ ⁣(max⁡{Zi,j:yi,j≤x}Σj,j), \log\frac{L_R(\boldsymbol{\vartheta} + \mathbf{h}/\sqrt{n})}{L_R(\boldsymbol{\vartheta})} \xrightarrow{d} \operatorname{normal}\!\left(-\frac{1}{2}\mathbf{h}^TI^*\mathbf{h},\; \mathbf{h}^TI^*\mathbf{h}\right), \qquad \widetilde{F}_j(x) = \Phi\!\left(\frac{\max\{Z_{i,j} : y_{i,j} \le x\}}{\sqrt{\Sigma_{j,j}}}\right), (12.9)

the second formula being evaluated at each draw of Algorithm 12.3, over observed yi,jy_{i,j} and with value 00 below the smallest of them.

Why it holds. The limit is that of the likelihood ratio in a suitably chosen multivariate normal model, so the information bound for rank-based estimators equals that for the full data, and the normal model is least favorable. For p=2p = 2, I∗(ρ)=(1−ρ2)−2I^*(\rho) = (1 - \rho^2)^{-2}, the information about a normal correlation with unknown variances: asymptotically, ignorance of the margins costs no more than ignorance of two variances. For the margins, {Yi,j≤x}\{Y_{i,j} \le x\} is the event that Zi,jZ_{i,j} lies below a latent cutpoint, which the largest latent score compatible with y≤xy \le x locates. Under missing at random the empirical distribution of the observed yi,jy_{i,j} is biased in general, while this estimate inherits the correction made by the joint latent model. Feldman and Kowal use it with a mixture copula and prove posterior consistency for the margins and copula parameters under MAR and their regularity conditions;Joseph Feldman and Daniel R. Kowal. Nonparametric Copula Models for Multivariate, Mixed, and Missing Data. Journal of Machine Learning Research, 25(164):1–50, 2024 neither it nor Hoff’s algorithm is justified under MNAR, where missingness depends on the unseen value itself.

When to use it. For CC alone, use Hoff’s rank likelihood: with continuous margins the ranks forgo no first-order information (ties lie outside the theorem). Add the margins for imputation or prediction, and the mixture when dependence is visibly nonlinear.

12.4.4Computational & Symbolic Check

For one observation with x=y=Σ0=1x = y = \Sigma_0 = 1, the representation (12.8) reads β=12T+V\beta = \frac{1}{2}T + V, where T∼𝒩(0,2)T \sim \mathcal{N}(0, 2) given T>0T > 0 and V∼𝒩(0,12)V \sim \mathcal{N}(0, \frac{1}{2}). The script compares its exact i.i.d. draws with quadrature against the posterior, which is proportional to Φ(β)ϕ(β)\Phi(\beta)\phi(\beta).Beyond Hoff (2009). This computational check and its Wolfram symbolic counterpart below verify the modern methods in this section and are not in Hoff’s book.

import math
import numpy as np
from scipy import integrate, stats

# 1. Quadrature: unnormalized posterior Phi(b) phi(b)
def moment(r):
    f = lambda b: b ** r * stats.norm.cdf(b) * stats.norm.pdf(b)
    return integrate.quad(f, -np.inf, np.inf)[0]
py = moment(0)
mean = moment(1) / py
print(f"p(y)={py:.6f}, mean={mean:.6f}, var={moment(2) / py - mean ** 2:.6f}")
print(f"exact: 0.5, {1 / math.sqrt(math.pi):.6f}, {1 - 1 / math.pi:.6f}")
# 2. Unified skew-normal: i.i.d. draws, no Markov chain
rng = np.random.default_rng(121)
T = math.sqrt(2.0) * np.abs(rng.normal(size=200_000))            # N(0,2) given T > 0
beta = 0.5 * T + math.sqrt(0.5) * rng.normal(size=T.size)
print(f"SUN draws: mean={beta.mean():.4f}, var={beta.var():.4f}")
Integrate Φ(β)ϕ(β)\Phi(\beta)\phi(\beta) directly, with Φ(β)=12erfc⁡(−β/2)\Phi(\beta) = \tfrac12\operatorname{erfc}(-\beta/\sqrt{2}): the evidence p(y=1)p(y = 1).
// Exact binary probit posterior, n = x = y = Sigma0 = 1: evidence and posterior mean
const pyInt = await show`Integrate[1/2*Erfc[-b/Sqrt[2]]*Exp[-b^2/2]/Sqrt[2*Pi], {b, -Infinity, Infinity}]`
p(y=1)=∫Φ(β) ϕ(β) dβ=12 p(y = 1) = \int\Phi(\beta)\,\phi(\beta)\,d\beta = \frac{1}{2} Integrate β Φ(β)ϕ(β)\beta\,\Phi(\beta)\phi(\beta): the unnormalized first moment of the posterior.
const numInt = await show`Integrate[b*1/2*Erfc[-b/Sqrt[2]]*Exp[-b^2/2]/Sqrt[2*Pi], {b, -Infinity, Infinity}]`
∫β Φ(β) ϕ(β) dβ=12π \int\beta\,\Phi(\beta)\,\phi(\beta)\,d\beta = \frac{1}{2 \sqrt{\pi}} Take the ratio of the two integrals: the exact posterior mean.
const meanPost = await show`FullSimplify[(${numInt}) / (${pyInt})]`
𝔼[β∣y=1]=1π \mathbb{E}[\beta \mid y = 1] = \frac{1}{\sqrt{\pi}} Compute 12 𝔼[T∣T>0]\tfrac12\,\mathbb{E}[T \mid T > 0] for T∼𝒩(0,2)T \sim \mathcal{N}(0, 2) from the unified skew-normal formula.
const meanSun = await show`FullSimplify[1/2*Integrate[t*Exp[-t^2/4]/Sqrt[4*Pi], {t, 0, Infinity}]
  / Integrate[Exp[-t^2/4]/Sqrt[4*Pi], {t, 0, Infinity}]]`
12 𝔼[T∣T>0]=1π \frac{1}{2}\,\mathbb{E}[T \mid T > 0] = \frac{1}{\sqrt{\pi}} Subtract the two derivations of the posterior mean, and instantiate the mean and variance (𝔼[β2∣y]=1\mathbb{E}[\beta^2 \mid y] = 1) for the Python output.
await show`{FullSimplify[(${meanPost}) - (${meanSun})], N[${meanPost}], N[1 - (${meanPost})^2]}`
(𝔼[β∣y]−12 𝔼[T∣T>0],  𝔼[β∣y],  Var⁡[β∣y])={0,0.56419,0.68169} \begin{aligned} &\left(\mathbb{E}[\beta \mid y] - \tfrac{1}{2}\,\mathbb{E}[T \mid T > 0],\; \mathbb{E}[\beta \mid y],\; \operatorname{Var}[\beta \mid y]\right) \\ &= \{0,0.56419,0.68169\} \end{aligned}

12.5Symbolic Check in Wolfram Language

Verifies ordered-probit shift/scale invariance symbolically in wolfram-ws-bridge JavaScript mode, derives both the precision entry Ω1,3\Omega_{1,3} and the symbolic partial correlation ρ13∣2=−Ω1,3/Ω1,1Ω3,3\rho_{13 \mid 2} = -\Omega_{1,3}/\sqrt{\Omega_{1,1}\Omega_{3,3}} for a general 3×33 \times 3 Gaussian copula correlation matrix, solves Ω1,3=0\Omega_{1,3} = 0, and contrasts exact conditional independence (C1,3=0.325C_{1,3} = 0.325) against the Python simulation (C1,3=0.30C_{1,3} = 0.30).

Verify symbolically that simultaneous affine shifts and positive rescalings leave ordered-probit cell probabilities unchanged.
// Chapter 12: Symbolic ordered-probit invariance & 3-variable Gaussian copula partial correlation
await show`Assuming[a > 0, Simplify[
  1/2*Erfc[-((a*g + c) - (a*eta + c))/(a*Sqrt[2])] - 1/2*Erfc[-(g - eta)/Sqrt[2]]]]`
Φ ⁣((ag+c)−(aη+c)a)−Φ(g−η)=0 \Phi\!\left(\frac{(ag+c)-(a\eta+c)}{a}\right) - \Phi(g - \eta) = 0 Invert the symbolic 3×33 \times 3 copula correlation matrix CC to obtain the latent precision Ω=C−1\Omega = C^{-1} (adjugate over determinant).
// Latent precision Omega_{1,3}, partial correlation rho_{13|2}, and conditional-independence condition
const C3 = [[1, W.r12, W.r13], [W.r12, 1, W.r23], [W.r13, W.r23, 1]]
const Om = await show`Inverse[${C3}]`
Ω=C−1=11−r122−r132−r232+2r12r13r23×(1−r232r13r23−r12r12r23−r13r13r23−r121−r132r12r13−r23r12r23−r13r12r13−r231−r122) \begin{aligned} &\Omega = C^{-1} = \frac{1}{1-r_{12}^2-r_{13}^2-r_{23}^2+2 r_{12} r_{13} r_{23}} \\ &\quad \times \left( \begin{array}{ccc} 1-r_{23}^2 & r_{13} r_{23}-r_{12} & r_{12} r_{23}-r_{13} \\ r_{13} r_{23}-r_{12} & 1-r_{13}^2 & r_{12} r_{13}-r_{23} \\ r_{12} r_{23}-r_{13} & r_{12} r_{13}-r_{23} & 1-r_{12}^2 \\ \end{array} \right) \end{aligned} Factor its (1,3)(1,3) entry into the closed-form precision Ω1,3\Omega_{1,3}.
const omega13 = await show`Factor[${Om}[[1, 3]]]`
Ω1,3=r13−r12r23−1+r122+r132−2r12r13r23+r232 \Omega_{1,3} = \frac{r_{13} -r_{12} r_{23}}{-1+r_{12}^2+r_{13}^2-2 r_{12} r_{13} r_{23} +r_{23}^2} Convert −Ω1,3/Ω1,1Ω3,3-\Omega_{1,3}/\sqrt{\Omega_{1,1}\Omega_{3,3}} into the symbolic partial correlation ρ13∣2\rho_{13\mid 2}.
const pcorr13 = await show`Assuming[-1 < r12 < 1 && -1 < r23 < 1,
  FullSimplify[-${Om}[[1, 3]] / Sqrt[${Om}[[1, 1]] * ${Om}[[3, 3]]]]]`
ρ13∣2=−Ω1,3Ω1,1Ω3,3=−r13+r12r23(−1+r122)(−1+r232)(−1+r122+r132−2r12r13r23+r232)2(−1+r122+r132−2r12r13r23+r232) \begin{aligned} &\rho_{13 \mid 2} = -\frac{\Omega_{1,3}}{\sqrt{\Omega_{1,1}\Omega_{3,3}}} \\ &= \frac{-r_{13} +r_{12} r_{23}}{\sqrt{\frac{\left(-1+r_{12}^2\right) \left(-1+r_{23}^2\right)}{\left(-1+r_{12}^2+r_{13}^2-2 r_{12} r_{13} r_{23} +r_{23}^2\right)^2}} \left(-1+r_{12}^2+r_{13}^2-2 r_{12} r_{13} r_{23} +r_{23}^2\right)} \end{aligned} Solve Ω1,3=0\Omega_{1,3} = 0 for r13r_{13} to recover the conditional-independence condition r13=r12r23r_{13} = r_{12} r_{23}.
await show`r13 /. First[Solve[${omega13} == 0, r13]]`
r13∣Ω1,3=0=r12r23 r_{13}\big|_{\Omega_{1,3}=0} = r_{12} r_{23} Instantiate Ω1,3\Omega_{1,3} at exact conditional independence (0.3250.325) and at Chapter 12’s Python value (0.300.30).
// Instantiate at (r12, r23) = (0.65, 0.50): r13 = 0.325 (exact CI) vs. Ch. 12 Python (r13 = 0.30)
await show`{${omega13} /. {r12 -> 13/20, r23 -> 1/2, r13 -> 13/40},
  N[${omega13} /. {r12 -> 13/20, r23 -> 1/2, r13 -> 3/10}],
  N[${pcorr13} /. {r12 -> 13/20, r23 -> 1/2, r13 -> 3/10}]}`
(Ω1,3(0.325),  Ω1,3(0.30),  ρ13∣2(0.30))={0,0.0578035,−0.0379869} \begin{aligned} &\bigl(\Omega_{1,3}(0.325),\; \Omega_{1,3}(0.30),\; \rho_{13\mid 2}(0.30)\bigr) \\ &= \{0,0.0578035,-0.0379869\} \end{aligned}

12.6Exercises

Exercise 12.4. Verify numerically using the Gaussian copula script above that replacing column Y1Y_1 with Y1′=log⁡(Y1)Y_1' = \log(Y_1) or Y1′′=Y13Y_1'' = Y_1^3 leaves the posterior distribution of CC completely unchanged (up to Monte Carlo variation). Explain why this invariance fails for the standard multivariate normal model of Chapter 7.

Symbolic Solution & InstantiationIntegrate z evzz\,e^{\sqrt{v}z} against ϕ(z)\phi(z) to derive the exact Pearson correlation attenuation under h(Z1)=evZ1h(Z_1) = e^{\sqrt{v}Z_1}.
// Ex 12.1: Rank invariance vs. Pearson correlation distortion under nonlinear h(Z_1) = exp(sqrt(v)*Z_1)
const corrExp = await show`Assuming[v > 0, FullSimplify[
  rho * Integrate[z*Exp[Sqrt[v]*z]*Exp[-z^2/2]/Sqrt[2*Pi], {z, -Infinity, Infinity}] /
  Sqrt[Integrate[Exp[2*Sqrt[v]*z]*Exp[-z^2/2]/Sqrt[2*Pi], {z, -Infinity, Infinity}] - Exp[v]]]]`
Corr⁡ ⁣(ev Z1,  Z2)=ρv−1+ev \operatorname{Corr}\!\left(e^{\sqrt{v}\,Z_1},\; Z_2\right) = \rho \sqrt{\frac{v}{-1+e^v}} Evaluate the attenuation factor at v=1v = 1, showing Pearson correlation drops to 0.763 ρ0.763\,\rho while ranks stay invariant.
await show`N[${corrExp} /. {rho -> 1, v -> 1}]`
Corr⁡ ⁣(ev Z1,  Z2)∣ρ=1,  v=1=0.762874 \left.\operatorname{Corr}\!\left(e^{\sqrt{v}\,Z_1},\; Z_2\right)\right|_{\rho=1,\; v=1} = 0.762874

Exercise 12.5. Simulate n=200n = 200 observations from an ordered probit model with K=5K = 5 categories and 𝜷=(0.8,−0.5)T\boldsymbol{\beta} = (0.8, -0.5)^T. Compare the lag-1 autocorrelation and effective sample size SeffS_{\text{eff}} of β1\beta_1 under (a) the Albert–Chib threshold Gibbs sampler (12.3) and (b) the rank-likelihood Gibbs sampler Algorithm 12.2.

Symbolic Solution & InstantiationWrite the length-biased expected corridor width 2/(n ϕ(g))2/(n\,\phi(g)) trapping an Albert–Chib threshold.
// Ex 12.2: Length-biased threshold corridor width 2 / (n * phi(g)) trapping Albert-Chib thresholds (marginal Z ~ N(0,1))
const gapSym = await show`2 / (n * Exp[-g^2/2] / Sqrt[2*Pi])`
𝔼 ⁣[Zhi−Zlo]=2eg222πn \begin{aligned} &\mathbb{E}\!\left[Z_{\text{hi}} - Z_{\text{lo}}\right] \\ &= \frac{2 e^{\frac{g^2}{2}} \sqrt{2 \pi}}{n} \end{aligned} Instantiate the expected corridor width at n=200n = 200 for g=0g = 0 (0.0250.025) and g=1g = 1 (0.0410.041).
await show`N[{${gapSym} /. {n -> 200, g -> 0}, ${gapSym} /. {n -> 200, g -> 1}}]`
(𝔼[Zhi−Zlo]g=0,  𝔼[Zhi−Zlo]g=1)n=200={0.0250663,0.0413273} \begin{aligned} &\bigl(\mathbb{E}[Z_{\text{hi}} - Z_{\text{lo}}]_{g=0},\; \mathbb{E}[Z_{\text{hi}} - Z_{\text{lo}}]_{g=1}\bigr)_{n=200} \\ &= \{0.0250663,0.0413273\} \end{aligned}

Exercise 12.6. In the copula script above, construct a 3-variable precision matrix Ω\Omega with Ω1,3=0\Omega_{1,3} = 0 (so Z1⊥Z3∣Z2Z_1 \perp Z_3 \mid Z_2 even though C1,3>0C_{1,3} > 0). Run Algorithm 12.3, compute the posterior 95% credible intervals of C1,3C_{1,3} and Ω1,3=(C−1)1,3\Omega_{1,3} = (C^{-1})_{1,3}, and verify that the copula accurately distinguishes marginal correlation from conditional independence!

Symbolic Solution & InstantiationInvert a 3×33 \times 3 tridiagonal precision matrix Ω\Omega (Ω1,3=0\Omega_{1,3} = 0) to obtain the latent covariance Σ=Ω−1\Sigma = \Omega^{-1}.
// Ex 12.3: Constructing a 3-variable Gaussian copula C from a tridiagonal precision Omega (Omega_{1,3} = 0)
const Om = [[W.a, W.Minus(W.b), 0], [W.Minus(W.b), W.a, W.Minus(W.b)], [0, W.Minus(W.b), W.a]]
const Sig = await show`Inverse[${Om}]`
Σ=Ω−1=1a(a2−2b2)(a2−b2abb2aba2abb2aba2−b2) \Sigma = \Omega^{-1} = \frac{1}{a (a^2-2 b^2)} \left( \begin{array}{ccc} a^2-b^2 & a b & b^2 \\ a b & a^2 & a b \\ b^2 & a b & a^2-b^2 \\ \end{array} \right) Normalize Σ12\Sigma_{12} by Σ11Σ22\sqrt{\Sigma_{11}\Sigma_{22}} to get the marginal correlation C12C_{12}.
const c12 = await show`Assuming[a > 0 && b > 0 && a^2 > 2*b^2, FullSimplify[${Sig}[[1, 2]] / Sqrt[${Sig}[[1, 1]]*${Sig}[[2, 2]]]]]`
C12=Σ12Σ11Σ22=b(a−b)(a+b) C_{12} = \frac{\Sigma_{12}}{\sqrt{\Sigma_{11}\Sigma_{22}}} = \frac{b}{\sqrt{(a-b) (a+b)}} Compute the marginal correlation C13=b2/(a2−b2)=C122C_{13} = b^2/(a^2 - b^2) = C_{12}^2, nonzero despite conditional independence.
const c13 = await show`Assuming[a > 0 && b > 0 && a^2 > 2*b^2, FullSimplify[${Sig}[[1, 3]] / Sqrt[${Sig}[[1, 1]]*${Sig}[[3, 3]]]]]`
C13=Σ13Σ11Σ33=b2a2−b2 C_{13} = \frac{\Sigma_{13}}{\sqrt{\Sigma_{11}\Sigma_{33}}} = \frac{b^2}{a^2-b^2} Instantiate (C12,C13)(C_{12}, C_{13}) at a=2,b=1a = 2, b = 1 to verify C13=1/3=(1/3)2C_{13} = 1/3 = (1/\sqrt{3})^2.
await show`N[{${c12}, ${c13}} /. {a -> 2, b -> 1}]`
(C12,  C13)a=2,  b=1={0.57735,0.333333} \bigl(C_{12},\; C_{13}\bigr)_{a=2,\; b=1} = \{0.57735,0.333333\}