1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Generating correlated normals

  1. May 20, 2017 #1
    1. The problem statement, all variables and given/known data
    Given correlation matrix
    $$M = \begin{bmatrix}
    1 & .3 & .5 \\
    .3 & 1 & .2 \\
    .5 & .2 & 1 \\
    And 3 independent standard normals $$N_1, N_2, N_3$$
    using cholesky decomposition
    A) get the correlated standard normals

    B) and if you want to transform them such that A ~ N(0,2), B~N(2,8), C~N(4,9) what is it?
    2. Relevant equations
    Cholesky decomposition: $$M = Z*Z^T$$ where Z is a lower triangular matrix.

    3. The attempt at a solution
    A) the correlated standard normals I get are
    $$ A = N_1 \\
    B = 0.3 N_1 + \sqrt{.91}N_2 \\
    C = 0.2 N_1 + 0.05241 N_2 + 0.86444N_3 $$
    Is this correct?

    B) do I simply add the mean and scale the variance? Ie. for C, I get $$C = 4 + \sqrt{\frac{9}{.79}}C_0$$ where $$C_0$$ is the untransformed variable ~N(0, 0.79). Please check if my reasoning is correct.
  2. jcsd
  3. May 20, 2017 #2


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    For (A) I get a different answer to you, although I entered the mtx in a rush so may have mistyped. What did you get for the Z matrix?

    For (B) the variance scaling is simply by the given variances, ie 2, 8 and 9, since the random variable being scaled is standard normal. Why do you think the untransformed variable is N(0,0.79)? From part (A) the new variables created by the Cholesky multiplication were supposed to be standard normals.
  4. May 21, 2017 #3
    EDIT_I noticed that I copied down the equation for C incorrectly because I looked up the incorrect Z_3,1. After the revision, I did get C~N(0,1).

    Thanks for the help!
    The Z matrix I got was
    $$Z = \begin{bmatrix}
    1 & 0 & 0 \\
    .3 & \sqrt{.91} & 0 \\
    .5 & .05241 & .86444 \\

    Using the relation Y = Z*N where Z is as above and N is the column vector of standard normals, I get for Y is a column vector of correlated normals with row 1 being A, row 2 being B, and row 3 being C.

    When I write out Y, it is the above part A answer.

    I try to figure out what is E[C] and Var[C]. For E[C] I use linearity of expectation to get $$E[C] = 0.5 E[N_1] + 0.05241E[N_2] + 0.86444E[N_3]$$ and since E[N_i] = 0, E[C] = 0

    To get Var[C] I use the bilinearity of variance and independence of N_i's so $$Var[C] = 0.5^2 Var[N_1] + 0.05241^2[VarN_2] + 0.86444^2Var[N_3]$$ and since Var[N_i] = 1, the variance is basically the sum of the squared constants, which is 1.

    Thus I get that C is ~N(0,1), what I call untransformed

    When we transform this to be ~N(4,9), what I though to do is to add 4 to it and apply a sqrt factor to scale the variance to be 9. Since we already have variance 1, and if we want to take it out of the parentheses it must be sqrt, we need a factor of $$\sqrt{9}$$

    Not sure if this is correct but it's what makes sense to me right now.
    Last edited: May 21, 2017
  5. May 21, 2017 #4


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    @fignewtons Yes that all looks correct. Make sure the multiplication by ##\sqrt 9## is done before adding 4.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted