The other approach is to use a density with infinite bounds.
If f is the function to integrate, and g is a density (e.g. Normal or t)
then
\inf_{-\infty}^\infty f(x) dx =
\inf_{-\infty}^\infty f(x) g(x) / g(x) dx
Draw samples from g, and calculate the average value of f/g.
This is equivalent to using a u-substitution u = G(x) where G is the
cdf for density g.
= \int_0^1 f(G^{-1}(u)) / g(G^{-1}(u))
One caution - make sure that $g$ has heavy enough
tails that $f/g$ does not blow up.
Similarly, with u-substitution you want to choose a transformation
such that the integrand of the transformed problem doesn't blow up.
Tim Hesterberg
>integrate() handles infinite intervals.
>
>The standard approach, which integrate() uses, is to use a
>transformation (u-substitution)
> u = 1/x
> \int_1^\infty f(x) dx = \int_0^1 f(1/u) u^{-2} du
>It adjusts this based on the value of a. For a double-infinite
>integral it splits the domain into two and does a transformation
>for each.
>
>For Monte Carlo you can do a transformation followed by Monte Carlo.
>But for a one-variable problem it is generally better to use an
>adaptive deterministic method like integrate() rather than
>Monte Carlo.
>
>Tim Hesterberg
>
>>Hello,
>>
>>I would like to perform integral calculation using the Monte-carlo method.
>>I understood how to use the method when the integral is defined on a
>>finite interval [a ; b], but how can I do when my integral is defined in
>>an interval [a ; infinite[ ?
>>Does someone have a clue for this, or may be an S-PLUS function ?
>>
>>Thanks a lot,
>>
>>Anna le Sanquer
>
>========================================================
>| Tim Hesterberg Senior Research Scientist |
>| timh@insightful.com Insightful Corp. |
>| (206)802-2319 1700 Westlake Ave. N, Suite 500 |
>| (206)283-8691 (fax) Seattle, WA 98109-3044, U.S.A. |
>| www.insightful.com/Hesterberg |
>========================================================
>I'll teach:
>Advanced Programming in S-PLUS
> Oct 8-9 San Francisco
>Bootstrap Methods and Permutation Tests
> Oct 10-11 San Francisco
>http://www.insightful.com/services/training.asp
|