Integration of multivariate normal cumulative distribution function

2 views (last 30 days)
Hi everyone, I need to calculate integral of Multivariate normal cumulative distribution function in 3D dimension (double integral). My limits are 0<x1<5 and 0<x2<x1+4. I tried to solve it this way:
fun= @(a,b)(mvncdf(a+b*0.0137,m1,cov1))+(mvncdf(a+b*0.5,m2,cov1));
result=dblquad(fun,1,5,1,5)
Obviosly, it is an incorrect solution.
Maybe you have an idea how to solve it?
I would appreciate your help

Accepted Answer

Tom Lane
Tom Lane on 8 Oct 2012
I assume you really want to integrate the cdf, rather than compute the cdf which is the integral of the pdf.
The dblquad function is going to want to evaluate the input fun at an array of values. The mvncdf function will expect its first input to be a set of points represented by rows, with a column for each dimension. So you can get past one error message by doing this:
m1 = 1; m2 = 2; cov1 = 1;
fun= @(a,b)(mvncdf(a(:)+b(:)*0.0137,m1,cov1))+(mvncdf(a(:)+b(:)*0.5,m2,cov1));
However, you'll need to supply more information if you want to get further. What are m1, m2, and cov1? Do you really mean to write a function that is the sum of two cumulative distribution functions? Do you really mean to evaluate that sum along two lines in the space of a and b? What error message or bad result do you get?
  2 Comments
Michael
Michael on 14 Oct 2012
Thank you very much for your respond.
I will try to explain my problem:
1. I need to calculate the volume of *cdf* (cdf=f(x1,x2)) defined by limits const1<x1<const2 and const<x2<a*x1+b, where a and b are designate constants. The result of this calculation will be some value, call it P.
Then, I`m intrested to refer to a and b (a*x1+b) as variables that can get values in interval [a-num1, a-num2] [b-num1, b-num2], respectively. Finally, I need to integrate P for all possible values of a and b in definded ranges of it.
2. The same procedure but in high dimensional case: instead of a*x1+b, a*x1+b*x2+...+m*xn.
cov1 - some covariance matrix. m1 and m2 some mean vectors.
I hope it is more clear now.
Tom Lane
Tom Lane on 18 Oct 2012
It's a little clearer but not completely clear. I suggest trying quad2d, which is more suitable when the integration limits of one variable depend on the values of the other variable.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!