I have a question about Gibbs sampling for generating samples. The Gibbs sampling algorithm is often stated.
- $x^0 = (x_1^0, x_2^0, \ldots, x_n^0)$ //initialize random values
- for $t=1$ in $T$ //iterate to generat T samples
- $x_1^t \sim P(X_1 | x_2^{t-1}, x_3^{t-1}, \ldots, x_n^{t-1})$ //compute univariate conditional probability
- $x_2^t \sim P(X_2 | x_1^{t}, x_3^{t-1}, \ldots, x_n^{t-1})$
- $\vdots$
- $x_n^t \sim P(X_n | x_1^t, x_2^t, \ldots, x_{n-1}^{t})$
How do we actually compute the univariate conditional probability
? If we assume a multivariate gaussian probability distribution for the variables, would this not be an expensive operation?
For example, if we wanted to compute the univariate conditional probability for $x_1$, that is defined by the following.
$ \begin{eqnarray*} x_1^t & = & P(X_1 | x_2^{t-1}, x_3^{t-1}, \ldots, x_n^{t-1}) & = & f(x_2,\ldots,x_n) & = & \frac{1}{\sqrt{(2\pi)^{n-1}|\boldsymbol\Sigma|}} \exp\left(-\frac{1}{2}({\mathbf x}-{\boldsymbol\mu})^\mathrm{T}{\boldsymbol\Sigma}^{-1}({\mathbf x}-{\boldsymbol\mu}) \right) \end{eqnarray*} $
Now, $\Sigma$ is the covariance matrix between $X_2, \ldots, X_n$ (if I understand correctly, it does not include covariance with $X_1$). This covariance matrix will be different for each $X_i$ (it will always be between the variables in the set, $X \setminus X_i$.
And then I also noticed $|\boldsymbol\Sigma|$, which is the determinant of the covariance matrix. If I understand correctly, this determinant too have to be computed for each $\Sigma$ associated with a $X_i$.
Is my understanding about the covariance matrix and its determinant being unique for each $X_i$?
Lastly, when I am computing the univariate conditional probability (e.g. using a multivariate gaussian distribution), I get back a value $x_i^t$, which is the value for $X_i$ in the next iteration. But what I have a problem understanding is that $x_i^t$ is a probability of $X_i$ and not a value. It doesn't seem that $x_i^t$ will be in the domain of $X_i$ since it is a probability value in the space [0, 1], and $X_i$ might have a domain $[\infty,-\infty]$.
Am I misunderstanding Gibbs sampling for variables with a multivariate gaussian distribution with respect the covariance matrix and univariate conditional probability
?
If I understand correctly, for $\Sigma$, I suppose I can compute it once for $X_1, \ldots, X_n$ and then create the $\Sigma_i$ and pre-compute $|\Sigma_i|$ once.