I would like to take double integral over standard normal distribution but it does not work.

1 visualización (últimos 30 días)
Hi everyone, I'm trying to take double integral over the pdf to find out the probablity,
However using the code below, it just took the time and memory(over 9GB) without any error message, but it did not give any solution.
What I'm trying: where .
syms z_1 z_2 rho
phi(z_1,z_2,rho) = (exp(-(((z_1)^2)+((z_2)^2)-(2*rho*(z_1)*(z_2)))/(2*(1-rho^2)))/(2*pi*sqrt(1-rho^2)))
phi(z_1, z_2, rho) =
exp((z_1^2 - 2*rho*z_1*z_2 + z_2^2)/(2*rho^2 - 2))/(2*pi*(1 - rho^2)^(1/2))
syms mu_1 mu_2 sigma lambda mu_M
Pr1 = int(int(phi,z_2,[-inf ((mu_M-mu_2)/sigma)]),z_1,[-inf ((lambda-mu_1)/sigma)])
I would appreciate your help.
  6 comentarios
Bruno Luong
Bruno Luong el 24 de Sept. de 2020
I don't think 2D integral formula of a Gaussian can be expressed as 1D integral and error function.
Bjorn Gustavsson
Bjorn Gustavsson el 24 de Sept. de 2020
@Bruno, For the uncorrelated case things behave nicely:
>> syms x z xlim zlim real
>> TwoDtrivial = int(int(exp(-x^2-z^2),'x',-inf,xlim),'z',-inf,zlim)
TwoDtrivial =
(pi*(erf(xlim) + 1)*(erf(zlim) + 1))/4
For the case I sketched below (in its simplest version where the transformation is just a 45-degree rotation) I end up with:
>> int(int(exp(-x^2-z^2),'x',z-zlim,zlim-z),'z',-inf,zlim)
ans =
int(-pi^(1/2)*erf(z - zlim)*exp(-z^2), z == -Inf..zlim)
Not a solution that doesn't require an integration - but at least something like a solution...

Iniciar sesión para comentar.

Respuesta aceptada

Bjorn Gustavsson
Bjorn Gustavsson el 24 de Sept. de 2020
Your problem might be that the symbolic toolbox have no way of knowing that your correlation is between -1 and 1. If you try the trivial calculation for the case where there is no correlation it is unproblematically fast. One way forward might be to transform your coordinates to one where there is no correlation. This would have to be combined with a change in the integration-limits, but by a simple sketch this seems "reasonably" manageable to do - the rectangular region in your original variables ought to become a triangular region in the transformed variables.
HTH

Más respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by