Author 
Message 
glare22@gmail.com science forum beginner
Joined: 12 Jul 2006
Posts: 7

Posted: Wed Jul 12, 2006 9:02 am Post subject:
Is there a program for numerically integrating a PDF to get CDF



I want to get the CDF from the integration of a given PDF. Is there any
good codes I can use for this purpose? Currently I use the program
dqk15i.f from the quadpack. But the result is not good. especially, for
the PDF with a sharp peak, it gives totally wrong results. Is there any
other programs which can deal with semiinfinite range? Is there anyone
can help me? Thanks. 

Back to top 


Torsten Hennig science forum Guru Wannabe
Joined: 28 Apr 2005
Posts: 136

Posted: Wed Jul 12, 2006 10:27 am Post subject:
Re: Is there a program for numerically integrating a PDF to get CDF



Quote:  I want to get the CDF from the integration of a given >PDF. Is there any
good codes I can use for this purpose? Currently I use >the program
dqk15i.f from the quadpack. But the result is not good. >especially, for
the PDF with a sharp peak, it gives totally wrong >results. Is there any
other programs which can deal with semiinfinite range? >Is there anyone
can help me? Thanks.

Hi,
in which form is the pdf given ? analytic formula ?
number of hits in a finite number of intervals resulting
from a montecarlosimulation ?
Best wishes
Torsten. 

Back to top 


glare22@gmail.com science forum beginner
Joined: 12 Jul 2006
Posts: 7

Posted: Wed Jul 12, 2006 8:40 pm Post subject:
Re: Is there a program for numerically integrating a PDF to get CDF



Yes, the PDF has the anaytical funciton as p=
exp((u1+sqrt(abs(u1^2+4*u2*(uu0+u2))))^2/8/u2^2/sqrt(2*pi*abs(u1^2+4*u2*(uu0+u2))).
u0 is mean, u1 is standard deviation, u2 is the skewness.
what should I do? Thanks.
Liang
Torsten Hennig wrote:
Quote:  I want to get the CDF from the integration of a given >PDF. Is there any
good codes I can use for this purpose? Currently I use >the program
dqk15i.f from the quadpack. But the result is not good. >especially, for
the PDF with a sharp peak, it gives totally wrong >results. Is there any
other programs which can deal with semiinfinite range? >Is there anyone
can help me? Thanks.
Hi,
in which form is the pdf given ? analytic formula ?
number of hits in a finite number of intervals resulting
from a montecarlosimulation ?
Best wishes
Torsten. 


Back to top 


Torsten Hennig science forum Guru Wannabe
Joined: 28 Apr 2005
Posts: 136

Posted: Thu Jul 13, 2006 7:11 am Post subject:
Re: Is there a program for numerically integrating a PDF to get CDF



Torsten Hennig wrote:
Quote:  I want to get the CDF from the integration of a given >PDF. Is there any
good codes I can use for this purpose? Currently I use >the program
dqk15i.f from the quadpack. But the result is not good. >especially, for
the PDF with a sharp peak, it gives totally wrong >results. Is there any
other programs which can deal with semiinfinite range? >Is there anyone
can help me? Thanks.
Hi,
in which form is the pdf given ? analytic formula ?
number of hits in a finite number of intervals resulting
from a montecarlosimulation ?
Best wishes
Torsten.
Yes, the PDF has the anaytical funciton as p=
exp((u1+sqrt(abs(u1^2+4*u2*(uu0+u2))))^2/8/u2^2/sqrt>(2*pi*abs(u1^2+4*u2*(uu0+u2))).
u0 is mean, u1 is standard deviation, u2 is the skewness.
what should I do? Thanks.

Hi,
let u*>0 be such that the pdf is small for u>u*.
Then use an integrator for ordinary differential
equations to solve the problem
F'(u)= exp((u1+sqrt(abs(u1^2+4*u2*(uu0+u2))))
^2/8/u2^2/sqrt(2*pi*abs(u1^2+4*u2*(uu0+u2))),
with initial condition F(u*)=0 in the range [u*,u*].
Good integrators for ODEs automatically choose the
step size adaptively so that sharp gradients
in the cdf should be well resolved.
Of course, because the ODE does not contain the
dependent variable F, the use of quadpack is also
possible. Then follow Peter's advice.
Best wishes
Torsten. 

Back to top 


glare22@gmail.com science forum beginner
Joined: 12 Jul 2006
Posts: 7

Posted: Fri Jul 14, 2006 11:44 pm Post subject:
Re: Is there a program for numerically integrating a PDF to get CDF



Thank Torsten a lot.
Torsten Hennig wrote:
Quote:  Torsten Hennig wrote:
I want to get the CDF from the integration of a given >PDF. Is there any
good codes I can use for this purpose? Currently I use >the program
dqk15i.f from the quadpack. But the result is not good. >especially, for
the PDF with a sharp peak, it gives totally wrong >results. Is there any
other programs which can deal with semiinfinite range? >Is there anyone
can help me? Thanks.
Hi,
in which form is the pdf given ? analytic formula ?
number of hits in a finite number of intervals resulting
from a montecarlosimulation ?
Best wishes
Torsten.
Yes, the PDF has the anaytical funciton as p=
exp((u1+sqrt(abs(u1^2+4*u2*(uu0+u2))))^2/8/u2^2/sqrt>(2*pi*abs(u1^2+4*u2*(uu0+u2))).
u0 is mean, u1 is standard deviation, u2 is the skewness.
what should I do? Thanks.
Hi,
let u*>0 be such that the pdf is small for u>u*.
Then use an integrator for ordinary differential
equations to solve the problem
F'(u)= exp((u1+sqrt(abs(u1^2+4*u2*(uu0+u2))))
^2/8/u2^2/sqrt(2*pi*abs(u1^2+4*u2*(uu0+u2))),
with initial condition F(u*)=0 in the range [u*,u*].
Good integrators for ODEs automatically choose the
step size adaptively so that sharp gradients
in the cdf should be well resolved.
Of course, because the ODE does not contain the
dependent variable F, the use of quadpack is also
possible. Then follow Peter's advice.
Best wishes
Torsten. 


Back to top 


Paul Abbott science forum addict
Joined: 19 May 2005
Posts: 99

Posted: Mon Jul 17, 2006 7:40 am Post subject:
Re: Is there a program for numerically integrating a PDF to get CDF



In article <1152736858.550214.324000@m73g2000cwd.googlegroups.com>,
glare22@gmail.com wrote:
Quote:  Yes, the PDF has the anaytical funciton as p=
exp((u1+sqrt(abs(u1^2+4*u2*(uu0+u2))))^2/8/u2^2/sqrt(2*pi*abs(u1^2+4*u2*(uu
0+u2))).
u0 is mean, u1 is standard deviation, u2 is the skewness.

This is inconsistent. Analytic computation of the mean of this PDF yields
mean = u0  u2  u1^2/(4 u2)
Also, note that other moments of this PDF can be computed in
closedform. For example, the variance is
(u1^4 BesselK[6, u1/(4 Sqrt[2 Pi] u2^2)])/
(16 u2^2 BesselK[2, u1/(4 Sqrt[2 Pi] u2^2)])
Since you have access to Mathematica, it is straightforward to use
NDSolve to compute the CDF.
Cheers,
Paul
_______________________________________________________________________
Paul Abbott Phone: 61 8 6488 2734
School of Physics, M013 Fax: +61 8 6488 1014
The University of Western Australia (CRICOS Provider No 00126G)
AUSTRALIA http://physics.uwa.edu.au/~paul 

Back to top 


Google


Back to top 



The time now is Mon Oct 23, 2017 11:24 am  All times are GMT

