[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: New package -rpnfcn-

 From Henrik Stovring To statalist@hsphsun2.harvard.edu Subject st: New package -rpnfcn- Date Tue, 06 Nov 2007 20:45:14 +0100

Thanks to Kit Baum, the new package -rpnfcn- is now available on SSC. To install simply type:

ssc install rpnfcn

from a net-aware Stata-session.

The function is presented in an upcoming paper in Stata Journal, where it is described as follows in the abstract:

------------------------------------------------------------------
A generic function evaluator implemented in Mata

Background: When implementing new statistical procedures, there is frequently 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 non-censored cases, then 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).

Method: We developed a generic function evaluator such that users may specify a function using Reverse Polish notation (RPN). 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.

Results: The procedure provides a flexible and extensible framework for implementing numerical evaluation of general, composite distributions. The procedure is numerically relatively efficient, although not optimal.
----------------------------------------------------------------------

In its present form only the exponential and Weibull distributions have been implemented, but as the tool is generic, it should be simple to implement other distributions. If you do so, please let me know and I will incorporate them in the package with due acknowledgement. While the package comes with no warranty at all, please let me know if you find a bug, so we can get it squashed.

Best,

Henrik
--
Henrik Støvring, PhD

Research Unit of General Practice
University of Southern Denmark
Winsløwparken 19, 3
DK-5000 Odense C
Phone: (+45) 6550 3692
Fax: (+45) 6591 8296
email: hstovring@health.sdu.dk
Homepage: http://www.biostat.sdu.dk/~stovring
------------------------------------------------------------------

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/

 © Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index