IDEAS home Printed from https://ideas.repec.org/a/tsj/stataj/v7y2007i4p542-555.html
   My bibliography  Save this article

A generic function evaluator implemented in Mata

Author

Listed:
  • Henrik Stovring

    (University of Southern Denmark)

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.

Suggested Citation

  • Henrik Stovring, 2007. "A generic function evaluator implemented in Mata," Stata Journal, StataCorp LP, vol. 7(4), pages 542-555, December.
  • Handle: RePEc:tsj:stataj:v:7:y:2007:i:4:p:542-555
    as

    Download full text from publisher

    File URL: http://www.stata-journal.com/article.html?article=pr0034
    Download Restriction: no

    File URL: http://www.stata-journal.com/software/sj7-4/pr0034/
    Download Restriction: no
    ---><---

    More about this item

    Keywords

    rpnfcn(); RPN; Mata;
    All these keywords.

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:tsj:stataj:v:7:y:2007:i:4:p:542-555. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    We have no bibliographic references for this item. You can help adding them by using this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Christopher F. Baum or Lisa Gilmore (email available below). General contact details of provider: http://www.stata-journal.com/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.