# RE: st: Integrals

 From "Jann Ben" <[email protected]> To <[email protected]> Subject RE: st: Integrals Date Fri, 30 Sep 2005 00:13:43 +0200

```awesome! thanks
ben

> -----Original Message-----
> You can evaluate the integrals by integrating by parts or directly.
> Let I(r, b)=integral from minus infinity to b of x^r*f(x)dx where f is
> the standard normal density and r is a positive integer.
> Putting x^r*f(x)=x^(r-1)*x*f(x) and integrating by parts gives
> I(r, b)=-b^(r-1)*exp(-b^2/2)/sqrt(2*pi)+(r-1)*I(r-2, b)
> I(0,b)=normal(b)
> and
> I(1,b)= - normalden(b)
> so any I() for any higher integer can be found recursively.
>
> The integral of f(x)^2 can be found by substituting w=sqrt(2)*x
> J(b)=1/(2*sqrt(pi))*normal(sqrt(2)*b)
>
> The code below checks these results numerically (in Stata 8).
>
> Jamie Griffin

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```