Last data update: 2014.03.03

R: Mills Ratio
MillsRatioR Documentation

Mills Ratio

Description

Calculates the Mills ratio

Usage

millsR(y, log = FALSE)

Arguments

y

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

log

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

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.

Value

The Mills' Ratio is

R(z)=(1-Phi(z))/phi(z)

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

Author(s)

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

Examples


## 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))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(NormalLaplace)
Loading required package: DistributionUtils
Loading required package: RUnit
Loading required package: GeneralizedHyperbolic
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/NormalLaplace/millsR.Rd_%03d_medium.png", width=480, height=480)
> ### Name: MillsRatio
> ### Title: Mills Ratio
> ### Aliases: MillsRatio millsR
> ### Keywords: math
> 
> ### ** Examples
> 
> 
> ## compare millsR calculated directly with the millsR calculated
> ## by transforming to log scale and then back-transformed
> millsR(1:10)
 [1] 0.6556795 0.4213692 0.3045903 0.2366524 0.1928081 0.1623777 0.1401042
 [8] 0.1231320 0.1097873 0.0990286
> exp(millsR(1:10, log = TRUE))
 [1] 0.6556795 0.4213692 0.3045903 0.2366524 0.1928081 0.1623777 0.1401042
 [8] 0.1231320 0.1097873 0.0990286
> exp(millsR(10*(1:10)))
 [1] 1.104098 1.051141 1.033857 1.025299 1.020193 1.016802 1.014385 1.012576
 [9] 1.011172 1.010049
> exp(millsR(10*(1:10), log = TRUE))
 [1] 0.09902860 0.04987593 0.03329642 0.02498440 0.01999201 0.01666204
 [7] 0.01428280 0.01249805 0.01110974 0.00999900
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>