hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_stat_mills_ratio (g01mb)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

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, λx, 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πxe-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:     x – double scalar
x, the argument of the reciprocal of Mills' Ratio.

Optional Input Parameters

None.

Output Parameters

1:     result – double scalar
The result of the function.

Error Indicators and Warnings

None.

Accuracy

In the left-hand tail, x<0.0, if 12e-1/2x2 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.

Further Comments

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 μ and variance σ2, then its hazard rate, λx;μ,σ2, 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

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015