3
$\begingroup$

I have a 4D normal distribution and I need to generate samples following the distribution of the normal but with 2 of the dimensions statics. Like taking a 2D slice of the distribution and using that to generate de samples. Is there any method to do this simple or efficient?

For example: If the first two dimensions are 4 and 45 I want to get samples like (4, 45, 12,8), (4, 45, 25, 74)...

$\endgroup$
  • 4
    $\begingroup$ Your "slice" is merely a bivariate (2D) normal distribution, which you would sample in any of the standard ways. Indeed, it's part of (one standard) definition of the multivariate Normal distributions that all such slices (linear combinations) are also Normally distributed. $\endgroup$ – whuber Sep 18 '17 at 16:07
  • $\begingroup$ @whuber: Yes! I was looking for a way of getting that bivariate normal distribution but I didn't find the method to do it. $\endgroup$ – Adrian Alejandre Sep 19 '17 at 7:51
  • $\begingroup$ You have the mean and variance-covariance matrix for the 4-variate distribution? $\endgroup$ – Glen_b Oct 1 '17 at 3:34
1
$\begingroup$

What you need is the conditional distribution of the remaining elements, given the elements held fixed. When the original joint distribution is Gaussian, the conditional distributions are Gaussian as well, so easy to sample from.

Let $X$ be a $d$-dimensional Gaussian random vector with mean $\mu$ and covariance matrix $C$. Suppose it's partitioned as $X = \begin{bmatrix} X_a \\ X_b \end{bmatrix}$, where $X_a$ contains the first $k$ dimensions and $X_b$ contains the remaining $d-k$ dimensions. The mean and covariance are partitioned in the same way:

$$\mu = \begin{bmatrix} \mu_a \\ \mu_b \end{bmatrix} \quad \quad C = \begin{bmatrix} C_{aa} & C_{ab} \\ C_{ba} & C_{bb} \end{bmatrix}$$

Given that $X_b$ takes a particular value $x_b$, the conditional distribution of $X_a$ is Gaussian:

$$(X_a \mid X_b=x_b) \sim \mathcal{N}(\tilde{\mu}, \tilde{C})$$

with mean and covariance matrix:

$$\tilde{\mu} = \mu_a + C_{ab} C_{bb}^{-1} (x_b-\mu_b)$$

$$\tilde{C} = C_{aa} - C_{ab} C_{bb}^{-1} C_{ba}$$

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ The question concerns marginal distributions rather than conditional distributions. $\endgroup$ – whuber Nov 24 '19 at 14:43
  • $\begingroup$ @whuber The examples seems to suggest otherwise $\endgroup$ – Jarle Tufto Dec 30 '19 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.