Please, some help?
Integration of multivariate normal cumulative distribution function
2 views (last 30 days)
Show older comments
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
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
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.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!