Learn R Programming

NormalLaplace (version 0.3-1)

MillsRatio: Mills Ratio

Description

Calculates the Mills ratio

Usage

millsR(y, log = FALSE)

Value

The Mills' Ratio is

$$R(z)=\frac{1-\Phi(z)}{\phi(z)}$$

where \(\Phi(z)\) and \(\phi(z)\) are respectively the distribution function and density function of the standard normal distribution.

Arguments

y

Numeric. Value at which the Mills' Ratio is evaluated.

log

Logical. If log = TRUE, Mills' Ratios are given as log(millsR).

Author

David Scott d.scott@auckland.ac.nz, Jason Shicong Fu

Details

The function calculates the Mills' Ratio. Since the Mill's Ratio converges to zero for large positive \(z\) and infinity for large negative \(z\). The range over which the logarithm of the Mill's ratio may be calculated is greater than that for which the Mill's ratio itself may be calculated.

Examples

Run this code

## compare millsR calculated directly with the millsR calculated
## by transforming to log scale and then back-transformed
millsR(1:10)
exp(millsR(1:10, log = TRUE))
exp(millsR(10*(1:10)))
exp(millsR(10*(1:10), log = TRUE))

Run the code above in your browser using DataLab