A generic function evaluator implemented in Mata
Henrik Stovring ()
Stata Journal, 2007, vol. 7, issue 4, 542-555
Abstract:
When implementing new statistical procedures, there is often a need for simple--and yet computationally efficient--ways of numerically evaluating composite distribution functions. If the statistical procedure must support calculations for censored and noncensored cases, those calculations should be carried out using efficient computational implementations of both definite and indefinite integrals (e.g., calculation of tail areas of distribution functions). We developed a generic function evaluator such that users may specify a function using reverse Polish notation. As its argument the function evaluator takes a matrix of pointers and then applies the rows of this matrix to its internally defined stack of pointers. Accordingly, each row of the argument matrix defines a single operation such as evaluating a function on the current element of the stack, applying an algebraic operation to the two top elements of the stack, or manipulating the stack itself. Defining new composite distribution functions from other (atomic) distribution functions then corresponds to joining two or more function-defining matrices vertically. This approach can further be used to obtain integrals of any defined function. As an example we show how the density and distribution function for the minimum of two Weibull distributed random variables can be numerically evaluated and integrated. The procedure provides a flexible and extensible framework for imple- menting numerical evaluation of general, composite distributions. The procedure is numerically relatively efficient, although not optimal. Copyright 2007 by StataCorp LP.
Keywords: rpnfcn(); RPN; Mata (search for similar items in EconPapers)
Date: 2007
References: View complete reference list from CitEc
Citations:
Downloads: (external link)
http://www.stata-journal.com/article.html?article=pr0034
http://www.stata-journal.com/software/sj7-4/pr0034/ (text/html)
Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.
Export reference: BibTeX
RIS (EndNote, ProCite, RefMan)
HTML/Text
Persistent link: https://EconPapers.repec.org/RePEc:tsj:stataj:v:7:y:2007:i:4:p:542-555
Ordering information: This journal article can be ordered from
http://www.stata-journal.com/subscription.html
Access Statistics for this article
Stata Journal is currently edited by Nicholas J. Cox and Stephen P. Jenkins
More articles in Stata Journal from StataCorp LLC
Bibliographic data for series maintained by Christopher F. Baum () and Lisa Gilmore ().