Numerical integration

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Numerical integration

nardi_ele
Hallo! I would like to find P(X_1>X_2>X_3>X_4), where X_i are independent random variables with a Gaussian distribution, numerically solving the integral of the function f3 below:

f3=function(x,y,z){dnorm(z,mean = mu3,sd=sigma3)*dnorm(y,mean = mu2,sd=sigma2)*dnorm(x,mean = mu1,sd=sigma1)} I tried the function integral3 of the package "pracma" withe the code below:

mu1=2

mu2=4

mu3=6

mu4=8

sigma1=1

sigma2=1

sigma3=1

sigma4=1

xmin <- qnorm(0.000000000000001,mu1)

xmax <- qnorm(0.999999999999999,mu4)

ymin=function(x){x}

ymax <- qnorm(0.999999999999999,mu4)

zmin=function(x,y){y}

zmax <- qnorm(0.999999999999999,mu4)

volume=integral3(f3, xmin, xmax ,ymin, xmax, zmin, zmax)

But I think that something is wrong. To make a check setted all the means equal to 2 thus I expected a volume =1/24 but the value I obtained was 0.1666667.

Can someone give me a clue to solve the problem?

Thanks in advance, elena