[Rd] Reciprocal Mill's Ratio
maj at stats.waikato.ac.nz
maj at stats.waikato.ac.nz
Thu Sep 13 23:54:09 CEST 2007
I believe that this may be more appropriate here in r-devel than in r-help.
The normal hazard function, or reciprocal Mill's Ratio, may be obtained
in R as dnorm(z)/(1 - pnorm(z)) or, better, as dnorm(z)/pnorm(-z) for
small values of z. The latter formula breaks dowm numerically for me
(running R 2.4.1 under Windows XP 5.1 SP 2) for values of z near 37.4
or greater.
Looking at the pnorm documentation I see that it is based on Cody (1993)
and thence, going one step further back, on Cody (1969). Consulting
Cody (1969) I see that the algorithm for pnorm(z) [or actually erf(z)]
is actually based on rational function approximations for the
reciprocal Mill's ratio itself, as I rather expected.
I wonder if anyone has dug out a function for the reciprocal Mill's
ratio out of the pnorm() code? Anticipating the obvious response I don't
believe that this would be one of the things I might be good at!
Murray Jorgensen
References
Cody, W. D. (1993)
Algorithm 715: SPECFUN – A portable FORTRAN package of special function
routines and test drivers.
ACM Transactions on Mathematical Software 19, 22–32.
Cody, W. D. (1969)
Rational Chebyshev Approximations for the Error Function
Mathematics of Computation, Vol. 23, No. 107. (Jul., 1969), pp. 631-637.
More information about the R-devel
mailing list