Bookmark and Share

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]

Re: st: How to improve accuracy in numerical integrations using Stata


From   Maarten Buis <maartenlbuis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to improve accuracy in numerical integrations using Stata
Date   Fri, 23 Dec 2011 14:37:35 +0100

On Fri, Dec 23, 2011 at 1:40 PM, Tiago V. Pereira wrote:
> Do you have any ideas on how to further increase the precision for
> numerical integration in Stata? The problem is that I am working on heavy
> tails (alpha levels below 10^-8).

You can use a rule for choosing your knots such that the maximal error
is (approximately) less than some level that you set, see: (Hoermann
and Leydold 2003).   If you can also analytically compute the
derivative of the function, than you can use that information while
setting up the spline that approximates your function. An example of a
combination of these approaches can be found in -margdistfit-,
available from SSC, in particular see the Mata functions in
margdistfit_mata_approxF.do. There are some differences: in those
functions I only approximate the function, you need to take an extra
step by computing the integral. I have a function that I know to be
monotonically increasing, so I continue adding knots till the
approximate function is also monotonically increasing. You will
probably want to exclude that check.

Hope this helps,
Maarten

Hoermann, Wolfgang and Leydold, Josef. (2003). Continuous random
variate generation by fast numerical inversion.  ACM transactions on
Modeling and Computer Simulation, 13(4): 347--362.

--------------------------
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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index