Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
Maarten Buis <maartenlbuis@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

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/

**Follow-Ups**:**Re: st: How to set a range from 0 to positive infinity in calculating integrals?***From:*Chris Min <cmsk0109@yahoo.com>

**References**:**st: How to set a range from 0 to positive infinity in calculating integrals?***From:*Chris Min <cmsk0109@yahoo.com>

- Prev by Date:
**RE: st: how to put both coefficient and exponentiated form in a table using estout or similar command** - Next by Date:
**Re: st: Error with outreg (ssc) stata 11** - Previous by thread:
**st: How to set a range from 0 to positive infinity in calculating integrals?** - Next by thread:
**Re: st: How to set a range from 0 to positive infinity in calculating integrals?** - Index(es):