From a Gaussian Target to Conditional Updates
A Gibbs sampler replaces a difficult joint draw with a sequence of draws from conditional distributions. For a bivariate Gaussian target, both conditional distributions can be found explicitly, so the algorithm is simple to implement. Yet the draws within its output sequence are not independent: the target correlation determines how much information one coordinate carries into the next sweep.
Let \((\Omega,\mathcal{F},\mathbb{P})\) be a probability space, and consider a target random vector \((X,Y)\) with a nondegenerate bivariate normal distribution. Write its mean vector as \((\mu_x,\mu_y)\), its standard deviations as \(\sigma_x>0,\sigma_y>0\), and its correlation as \(\rho\), where \(|\rho|<1\). The strict inequality ensures that the covariance matrix is positive definite. Define the standardized coordinates \(z_x=(x-\mu_x)/\sigma_x\) and \(z_y=(y-\mu_y)/\sigma_y\). The joint density is proportional to
To condition on \(Y=y\), regard \(z_y\) as fixed and complete the square in \(z_x\). The identity \(z_x^2-2\rho z_xz_y+z_y^2=(z_x-\rho z_y)^2+(1-\rho^2)z_y^2\) shows that the terms depending on \(x\) have the kernel of a normal density with mean \(\rho z_y\) and variance \(1-\rho^2\) on the standardized scale. Conditioning on \(X=x\) and completing the square in \(z_y\) gives the other conditional.
Both conditional variances are positive under the stated assumption. In a Gibbs sweep, first draw \(X_{n+1}\) from the conditional distribution given the current \(Y_n\), then draw \(Y_{n+1}\) given the newly updated \(X_{n+1}\). The order matters when writing the updates: the second draw conditions on \(X_{n+1}\), not \(X_n\).
Worked Example: Conditional Distributions with Unequal Scales
Suppose the target has mean \((2,-1)\), standard deviations \(\sigma_x=3\) and \(\sigma_y=2\), and correlation \(\rho=\tfrac12\). Its covariance matrix is \(\begin{bmatrix}9&3\\3&4\end{bmatrix}\): the off-diagonal entry is \(\rho\sigma_x\sigma_y=\tfrac12\cdot3\cdot2=3\). Its determinant is \(9\cdot4-3\cdot3=27>0\), consistent with a nondegenerate bivariate normal.
For \(X\mid Y=y\), the conditional mean is \(2+\tfrac12\cdot\tfrac32(y+1)=2+\tfrac34(y+1)\), and its variance is \(3^2(1-\tfrac14)=9\cdot\tfrac34=\tfrac{27}{4}\). For \(Y\mid X=x\), the mean is \(-1+\tfrac12\cdot\tfrac23(x-2)=-1+\tfrac13(x-2)\), and the variance is \(2^2(1-\tfrac14)=4\cdot\tfrac34=3\).
Check: At the target mean values \(y=-1\) and \(x=2\), the conditional means are \(2+\tfrac34(0)=2\) and \(-1+\tfrac13(0)=-1\). The conditional variances \(\tfrac{27}{4}\) and \(3\) also equal \(\sigma_x^2(1-\rho^2)=9\cdot\tfrac34\) and \(\sigma_y^2(1-\rho^2)=4\cdot\tfrac34\), respectively.
The Systematic Gibbs Sampler
For a direct implementation, use two sequences \((Z_n)_{n\ge1}\) and \((W_n)_{n\ge1}\) of independent standard normal random variables, with all these variables independent of the initial state \((X_0,Y_0)\). The process \((X_n,Y_n)_{n\ge0}\) has state space \(S=\mathbb{R}^2\) and discrete time \(n\). For each \(n\ge0\), make one complete sweep using
These equations implement the two conditional normal draws because a normal variable with mean \(m\) and variance \(v\) can be generated as \(m+\sqrt{v}\,Z\) for a standard normal \(Z\). Fresh independent noise is used for each update. The state after the second update is \((X_{n+1},Y_{n+1})\).
Proof. Let \(f(x,y)\) be the joint target density, \(f_Y(y)\) its \(Y\)-marginal density, and \(f_{X\mid Y}(x\mid y)\) its conditional density. The factorization \(f(x,y)=f_Y(y)f_{X\mid Y}(x\mid y)\) follows from the definition of conditional density. If the initial pair has density \(f\), then after replacing \(X\) by a draw from its conditional distribution given the retained value \(Y=y\), the density of the pair is \(f_Y(y)f_{X\mid Y}(x\mid y)=f(x,y)\). Thus the \(X\)-update preserves the joint target. The same argument with \(X\) retained and \(Y\) replaced uses \(f(x,y)=f_X(x)f_{Y\mid X}(y\mid x)\), so the \(Y\)-update also preserves it. Applying these two preserving updates in sequence leaves the density equal to \(f\). \(\square\)
This result says that the target is invariant: if the sampler starts with the target distribution, each complete-sweep state has that distribution. It does not say that successive states are independent. The dependence can be calculated directly from the update equations.
Worked Example: One Complete Sweep with Exact Values
Take a standard bivariate normal target with \(\mu_x=\mu_y=0\), \(\sigma_x=\sigma_y=1\), and \(\rho=\tfrac35\). Its covariance matrix is \(\begin{bmatrix}1&\tfrac35\\\tfrac35&1\end{bmatrix}\), with determinant \(1-\tfrac9{25}=\tfrac{16}{25}>0\). Both conditional distributions have variance \(1-\tfrac9{25}=\tfrac{16}{25}\), so the updates are \(X_{n+1}=\tfrac35Y_n+\tfrac45Z_{n+1}\) and \(Y_{n+1}=\tfrac35X_{n+1}+\tfrac45W_{n+1}\).
Suppose the current value is \(Y_n=1\), and this particular sweep uses \(Z_{n+1}=\tfrac12\) and \(W_{n+1}=-\tfrac12\). The first update gives \(X_{n+1}=\tfrac35\cdot1+\tfrac45\cdot\tfrac12=\tfrac35+\tfrac25=1\). The second gives \(Y_{n+1}=\tfrac35\cdot1+\tfrac45(-\tfrac12)=\tfrac35-\tfrac25=\tfrac15\).
Check: Substituting these same noise values into the combined recurrence derived below gives \(Y_{n+1}=\tfrac9{25}\cdot1+\tfrac45(\tfrac35\cdot\tfrac12-\tfrac12)=\tfrac9{25}+\tfrac45(-\tfrac15)=\tfrac9{25}-\tfrac4{25}=\tfrac15\), matching the two conditional updates.
Dependence Across Sweeps
For clarity, now consider the standard bivariate normal target with zero means and unit variances, retaining \(|\rho|<1\). In this case the sweep equations are \(X_{n+1}=\rho Y_n+\sqrt{1-\rho^2}Z_{n+1}\) and \(Y_{n+1}=\rho X_{n+1}+\sqrt{1-\rho^2}W_{n+1}\). Let \(\mathcal{F}_n\) be the sigma-field generated by \((X_0,Y_0)\) and all the noises \(Z_1,W_1,\ldots,Z_n,W_n\). The current state is measurable with respect to \(\mathcal{F}_n\), and \(Z_{n+1},W_{n+1}\) are independent of \(\mathcal{F}_n\) and of each other.
Substitution of the first update into the second gives
The combined noise is independent of \(\mathcal{F}_n\), has mean zero, and has variance \((1-\rho^2)(\rho^2+1)=1-\rho^4\). Consequently this coordinate itself follows a one-dimensional autoregression: its next value depends on its current value and a fresh independent normal innovation. In particular, the conditional-mean recursion can be iterated legitimately; the independence of the fresh noise from the full history supplies the needed conditioning step.
Proof. Write \(\varepsilon_{n+1}=\sqrt{1-\rho^2}(\rho Z_{n+1}+W_{n+1})\). The independence and zero mean just established give \(\mathbb{E}[\varepsilon_{n+1}\mid\mathcal{F}_n]=0\), so the recurrence implies \(\mathbb{E}[Y_{n+1}\mid\mathcal{F}_n]=\rho^2Y_n\). To iterate, suppose \(\mathbb{E}[Y_{n+k}\mid\mathcal{F}_n]=\rho^{2k}Y_n\). The recurrence at time \(n+k\), together with the independence and zero conditional mean of \(\varepsilon_{n+k+1}\) given \(\mathcal{F}_{n+k}\), gives \(\mathbb{E}[Y_{n+k+1}\mid\mathcal{F}_{n+k}]=\rho^2Y_{n+k}\). Taking conditional expectation given \(\mathcal{F}_n\) and using the tower property yields \(\mathbb{E}[Y_{n+k+1}\mid\mathcal{F}_n]=\rho^2\mathbb{E}[Y_{n+k}\mid\mathcal{F}_n]=\rho^{2(k+1)}Y_n\). The identity holds at \(k=0\), so induction proves the conditional-mean formula for every \(k\). If the chain is initialized in the target, invariance gives \(\mathbb{E}Y_n=0\) and \(\operatorname{Var}(Y_n)=1\) at every sweep. Multiplying the conditional-mean identity by \(Y_n\) and taking expectations gives \(\operatorname{Cov}(Y_{n+k},Y_n)=\rho^{2k}\mathbb{E}[Y_n^2]=\rho^{2k}\). Division by the two standard deviations, both equal to \(1\), gives the stated correlation. \(\square\)
Worked Example: Correlations When the Target Correlation Is One Half
Set \(\rho=\tfrac12\). The full-sweep recurrence is \(Y_{n+1}=\tfrac14Y_n+\varepsilon_{n+1}\). Its innovation variance is \(1-\rho^4=1-\tfrac1{16}=\tfrac{15}{16}\); this also follows directly from \((1-\rho^2)(1+\rho^2)=\tfrac34\cdot\tfrac54=\tfrac{15}{16}\). If the chain starts in the target, \(\operatorname{Var}(Y_n)=1\). The lag-one correlation is \(\tfrac14\), and the lag-two correlation is \((\tfrac14)^2=\tfrac1{16}\).
Check: The lag-one covariance from the recurrence is \(\operatorname{Cov}(\tfrac14Y_n+\varepsilon_{n+1},Y_n)=\tfrac14\operatorname{Var}(Y_n)+0=\tfrac14\), because the innovation is independent of the past and has mean zero. Applying the recurrence once more gives lag-two covariance \(\tfrac14\cdot\tfrac14=\tfrac1{16}\); the new innovation again has zero covariance with \(Y_n\). These equal the correlations because both marginal variances are \(1\).
Interpreting the Dependence and Avoiding a Common Error
The parameter \(\rho\) describes the correlation between \(X\) and \(Y\) in a single target draw. By contrast, \(\rho^2\) is the coefficient governing the dependence from one completed sweep to the next for the \(Y\)-coordinate in this update order. Its lag-\(k\) correlation is \(\rho^{2k}\) when the chain is stationary. Thus a target with \(\rho\) close to \(1\) or \(-1\) produces a coordinate that changes slowly across sweeps: in either case \(\rho^2\) is close to \(1\). When \(\rho=0\), the recurrence has no dependence on \(Y_n\), and successive \(Y\)-values are independent under stationary initialization.
Common mistake. It is incorrect to assert that the lag-one correlation of \(Y\) is \(\rho\) just because each conditional mean contains the coefficient \(\rho\). For example, if \(\rho=\tfrac12\), the two updates give \(X_{n+1}=\tfrac12Y_n+\sqrt{\tfrac34}Z_{n+1}\) and \(Y_{n+1}=\tfrac12X_{n+1}+\sqrt{\tfrac34}W_{n+1}\). Substitution makes the coefficient of \(Y_n\) equal to \(\tfrac12\cdot\tfrac12=\tfrac14\), not \(\tfrac12\). The independent noise has zero covariance with \(Y_n\), so the stationary lag-one correlation is \(\tfrac14\). The first \(\rho\) transmits \(Y_n\)'s information to \(X_{n+1}\); the second transmits that information back to \(Y_{n+1}\).
The two conditional formulas, the order of updates, and the fresh-noise independence together determine the sampler's dependence. In particular, the one-step conditional mean alone is not enough to justify iterating a conditional-mean formula: here the explicit autoregressive representation and independence from \(\mathcal{F}_n\) provide that justification. The formulas require a nondegenerate target with \(|\rho|<1\); at \(|\rho|=1\), the covariance matrix is singular and the stated positive-variance conditional updates do not apply.
Check Your Understanding
Use the conditional formulas and the full-sweep recurrence to answer the following.
- For a bivariate normal with \(\mu_x=1,\mu_y=2,\sigma_x=2,\sigma_y=1,\rho=-\tfrac12\), find the mean and variance of \(X\mid Y=3\).
- For the standard bivariate normal Gibbs sampler with \(\rho=\tfrac23\), what is the coefficient of \(Y_n\) in the recurrence for \(Y_{n+1}\), and what is its stationary lag-one correlation?
- Explain why the second update in a sweep conditions on \(X_{n+1}\), rather than on \(X_n\).
- For \(\rho=0\), state the variance of the full-sweep innovation and the lag-one correlation of \(Y\) under stationary initialization.
- Identify the independence fact needed to iterate the conditional-mean relation across multiple sweeps.