Search code examples
matlabprobabilitynormal-distribution

Define sigma in mvncdf function in Matlab


So for 2 rho coefficients we have:

   p = mvncdf([X1, X2], [0, 0], [1 rho; rho 1])

But for 3 rho coefficients I am not sure how to define the sigma: I have X1, X2, and X3, with mean zero [0, 0, 0] and rho coefficients

rho_112, rho_113 and rho_123

how do I define it in the function:

   p = mvncdf([X1, X2, X3], [0, 0, 0], [1 rho; rho 1])

Also very curious why we sometimes need a minus before the rho

Rho in this case is: enter image description here How to compute lower tail probability for the Bivariate Normal Distribution


Solution

  • You should be aware that the density function for a multivariate normal distribution is: formula

    Hence, when mu, it would be:

    formula

    On other hand, as formula is the correlation coefficient between f and f, we can write the covarience matrix like the following:

    enter image description here

    As f for all f, we can write the covariance matrix like the following:

    enter image description here

    Therefore, for a three dimensional distribution, you can have:

    p = mvncdf([X1, X2, X3], [0, 0, 0], [1 rho12 roh13; rho21 1 rho23; rho31 rho32 1])
    

    Notice that f is not useful here. It is a correlation between three variables, but the covariance matrix just needs mutual covariances.