Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: How to set a range from 0 to positive infinity in calculating integrals?


From   Chris Min <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: How to set a range from 0 to positive infinity in calculating integrals?
Date   Mon, 10 Oct 2011 12:48:10 -0700 (PDT)

Dear Maarten,

Thank you very much for your help -- I find your explanation very useful.

But, I did mean "normal()" in my example (i.e., I need to calculate integrals of cumulative normal), not normalden(). In that case, would your explanation still apply to my example?

Thanks,
Chris

----- Original Message -----
From: Maarten Buis <[email protected]>
To: [email protected]
Cc: 
Sent: Monday, October 10, 2011 1:58 AM
Subject: Re: st: How to set a range from 0 to positive infinity in calculating integrals?

On Sun, Oct 9, 2011 at 10:06 PM, Chris Min wrote:
> I want to use the command "integ" to calculate for the
> following integral of y over x ranging from 0 to positive
> infinity. But I don't know how to set a range for x (i.e.,
> from 0 to positive infinity). If anyone can help me with
> the second line of my coding, that would be great.
>
> set obs 100
> range x 0 ?
> gen y=1-normal(ax-b) /* where a and b are scalars */
> integ y x, g(integral)

In a strict sense you cannot use -integ- to go to positive infinity.
It takes the x and y values in your dataset to be your function and
calculates the area underneath the curve for that function. Since you
cannot have positve infinity in a dataset, you cannot do what you
want. However, typically, a suitably large number can give you a very
good approximations, and these numbers don't have to be huge: in case
of a standard normal/Gaussian distribution you could use an upper
bound of 4 as a reasonable approximation for positive infinity...

In your example I assume you want to use -normalden()- instead of
-normal()-, as the latter is already the cumulative density function.

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany


http://www.maartenbuis.nl
--------------------------

*
*  For searches and help try:
*  http://www.stata.com/help.cgi?searchhttp://www.stata.com/support/statalist/faqhttp://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index