nag_stat_mills_ratio (g01mb) calculates the reciprocal of Mills' Ratio, the hazard rate,
, for the standard Normal distribution. It is defined as the ratio of the ordinate to the upper tail area of the standard Normal distribution, that is,
The calculation is based on a Chebyshev expansion as described in
nag_specfun_erfcx_real (s15ag).
None.
None.
In the left-hand tail,
, if
the safe range argument (
nag_machine_real_safe (x02am)), then
is returned, which is close to the true value.
The relative accuracy is bounded by the effective
machine precision. See
nag_specfun_erfcx_real (s15ag) for further discussion.
If, before entry,
is not a standard Normal variable, it has to be standardized, and on exit,
nag_stat_mills_ratio (g01mb) has to be divided by the standard deviation. That is, if the Normal distribution has mean
and variance
, then its hazard rate,
, is given by
function g01mb_example
fprintf('g01mb example results\n\n');
x = [ 0.0; -2.0; 10.3];
xmu = [ 0.0; 1.0; 9.0];
xsig = [ 1.0; 2.5; 1.6];
fprintf(' mean sigma x reciprocal\n');
fprintf(' Mills ratio\n\n');
for j = 1:numel(x)
z = (x(j)-xmu(j))/xsig(j);
rm = g01mb(z);
rm = rm/xsig(j);
fprintf('%7.4f%9.4f%9.4f%11.4f\n', xmu(j), xsig(j), x(j), rm);
end