Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_stat_mills_ratio (g01mb)

Purpose

nag_stat_mills_ratio (g01mb) returns the reciprocal of Mills' Ratio.

Syntax

[result] = g01mb(x)
[result] = nag_stat_mills_ratio(x)

Description

nag_stat_mills_ratio (g01mb) calculates the reciprocal of Mills' Ratio, the hazard rate, $\lambda \left(x\right)$, 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,
 $λx=Zx Qx =12πe-x2/2 12π∫x∞e-t2/2dt .$
The calculation is based on a Chebyshev expansion as described in nag_specfun_erfcx_real (s15ag).

References

Gross A J and Clark V A (1975) Survival Distributions: Reliability Applications in the Biomedical Sciences Wiley

Parameters

Compulsory Input Parameters

1:     $\mathrm{x}$ – double scalar
$x$, the argument of the reciprocal of Mills' Ratio.

None.

Output Parameters

1:     $\mathrm{result}$ – double scalar
The result of the function.

None.

Accuracy

In the left-hand tail, $x<0.0$, if $\frac{1}{2}{e}^{-\left(1/2\right){x}^{2}}\le \text{}$ the safe range argument (nag_machine_real_safe (x02am)), then $0.0$ 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, $x$ 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 $\mu$ and variance ${\sigma }^{2}$, then its hazard rate, $\lambda \left(x;\mu ,{\sigma }^{2}\right)$, is given by
 $λx;μ,σ2=λx-μ/σ/σ.$

Example

The hazard rate is evaluated at different values of $x$ for Normal distributions with different means and variances. The results are then printed.
```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

```
```g01mb example results

mean     sigma    x        reciprocal
Mills ratio

0.0000   1.0000   0.0000     0.7979
1.0000   2.5000  -2.0000     0.0878
9.0000   1.6000  10.3000     0.8607
```