# Solve equation with bivariate normal cdf in it

7 views (last 30 days)
Stefano Caria on 21 Sep 2017
Answered: David Ding on 27 Sep 2017
Hi! I have two variables -- T and C -- that have a bivariate normal distribution. Given a value "b" of C, I would like to find the the value "a" of T such that the probability of the joint event T>a and C<b is equal to n.
I have tried: MU = [46 220]; SIGMA = [188 1633.37518976450; 1633.37518976450 64724]; n = 0.2; b = 280; syms a; vpasolve(mvncdf([a b],MU,SIGMA) == 1-n, a); x = double(ans)
but (i) I think this would actually give me Pr(T>a and C>b), (ii) in any case, I get the following error message: Error using bsxfun Operands must be numeric arrays.
Error in mvncdf (line 137) XL0 = bsxfun(@minus,XL,mu);
It would be great if you could help me get this right- thanks!

David Ding on 27 Sep 2017
Hi Stefano,
It looks like you are trying to compute the inverse of a multivariate normal distribution via vpasolve. I will leave to the MATLAB Answers community to comment whether the mathematical setup in your code is correct. However, from the MATLAB side, I can tell you that the error message you are getting:
Error using bsxfun Operands must be numeric arrays.
Error in mvncdf (line 137) XL0 = bsxfun(@minus,XL,mu);
Is due to the fact that you are defining the variable "a" as a symbol, and passing in that symbol into the argument of "mvncdf" function to compute the inverse of the distribution. Unfortunately, "mvncdf" does not accept symbolic inputs because in one of the underlying function calls, it invokes "bsxfun" which errors out when one of the input arguments (in your case it is "XL" on line 137 of "mvncdf") is not numeric (i.e. here "XL" is a symbol--you may verify by placing a breakpoint in the debugger).
I am not sure if "vpasolve" is the right tool to solve for the inverse of the multi-variate normal CDF, as this CDF is not an algebraic function. In MATLAB we have the function " norminv " that can be used to find the inverse of the single-variable normal CDF. However, a multi-variate version does not exist yet.

### Categories

Find more on Multivariate Normal Distribution in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!