Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Generating multivariate normal vectors under constraints

  1. Sep 1, 2011 #1
    Hello all,

    I wonder if anybody knows of a way of generating a random normal vector (i.e. a variate from a multivariate normal distribituion) in which one or more of the vector's values are fixed?. For example, I may want to choose a random vector from a four-dimensional multivariate normal distribution constrained such that the second element of the random vector is equal to 0.1 and the third element is equal to 0.3; so I just want to pick values for the first and last element subject to these constraints).

    In order to generate a completely random vector I have been using the method described on the http://en.wikipedia.org/wiki/Multivariate_normal_distribution#Drawing_values_from_the_distribution", that is, obtaining the dot product of the cholesky decomposition of the covariance matrix of the distribution and a vector of independent standard normal variates. I gather there may be a way of reverse engineering this, and working out what values in the vector "Z" are necessary to obtain the desired constrained output. But I can't find a way to do it!

    I'd very much appreciate any help or suggestions.

    Best wishes,

    Last edited by a moderator: Apr 26, 2017
  2. jcsd
  3. Sep 1, 2011 #2


    User Avatar
    Science Advisor

    Since you are fixing 2 coordinates, you need to generate a 2 dimensional vector?
  4. Sep 1, 2011 #3
    That's right, though number of fixed coordinates will vary as will the size of the vector. The unfixed coordinates should have a probability distribution conditioned on the fixed values, if that makes sense.

    Another way to put it: Suppose we have a two dimensional normal distribution with covariance matrix {{1,0.99},{0.99,1}}. I know how to draw random vectors {x,y} from this distribution. But let's suppose that the first element in the random vector (x) must be fixed at some constant value. In that case I don't need to draw random vectors from the distribution, I Just need to pick random y's. Since the correlation coefficient here is 0.99, my y's should be clustered around the value of x. If the correlation coefficient were lower, my y's would have more variability. I hope that makes sense!

  5. Sep 2, 2011 #4
    What you're looking for would be the conditional distribution of the multivariate normal, which is itself multivariate normal and can be expressed in terms of the Schur complement.

    Keep in mind numerical issues that might come up if dealing with ill-conditioned covariance matrices like the one you just described.
  6. Sep 2, 2011 #5
    Thanks bpet, I'll look into that. The real-life covariance matrices won't be as extreme as that one, which was just given as an example. So hopefully I can get it working.

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook