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
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: st: How to set a range from 0 to positive infinity in calculating integrals?
Date
Mon, 10 Oct 2011 07:58:53 +0200
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?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/