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]

From |
"Feiveson, Alan H. (JSC-SK311)" <alan.h.feiveson@nasa.gov> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: How to improve accuracy in numerical integrations using Stata |

Date |
Fri, 23 Dec 2011 11:03:42 -0600 |

Tiago - You can also consider Gaussian integration - for example see my presentation at the 2004 Stata users' group meeting. http://www.stata.com/meeting/3nasug/abstracts.html Al Feiveson -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Tiago V. Pereira Sent: Friday, December 23, 2011 10:45 AM To: statalist@hsphsun2.harvard.edu Subject: st: How to improve accuracy in numerical integrations using Stata Dear Maarten, I don't have a clue on how to select specific knots, but I will investigate that. As usual (since 2005!) I thank you very much for you time and extremely helpful tips! All the best, Tiago --- Dear statalisters, I am using -integ- to numerically integrate a set of functions. An example of a function to integrate: function_y = -2*normal((-`x'-`r'*z)/sqrt(1-`r'^2))*normalden(z) for variable z. In my case, the domain ranges from 0 to `x'. So, what I am doing is the following: */ ------------ start example -------------- local r = 0.1 local x = 6 drop _all range z 0 `x' 1000 generate y = -2*normal((-`x'-`r'*z)/sqrt(1-`r'^2))*normalden(z) dydx y z, gen(yprime) integ y z, gen(Sy) */ ------- end example ------------------ dis r(integral) -5.288096*07214*e-10 to gain more precision, I have manually edited -integ- to compute values using the double format (i.e. instead of 'gen float variable = ', it is using 'gen double variable ='). It seems that some precision is gained: [using the exactly same code above, but using the 'double' version, one gets:] dis r(integral) -5.288096*31782*e-10 I know that the correct answer would be something like: -5.28809630924643245856745711e-10 which is obtained from numerical integration using a C program (supposed to be the most precise approach I am aware of). 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). All the best, Tiago * * 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/ * * 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/

**References**:**st: How to improve accuracy in numerical integrations using Stata***From:*"Tiago V. Pereira" <tiago.pereira@mbe.bio.br>

- Prev by Date:
**Re: st: "Correct" way to convert a vector into a matrix** - Next by Date:
**st: Is it possible to recover estimation sample size used in -twoway lfit-** - Previous by thread:
**st: How to improve accuracy in numerical integrations using Stata** - Next by thread:
**st: Simple question about interpreting an econometric model** - Index(es):