Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

norminvp

Normal quantile function (high precision)


Description

Computes with tail-precision the quantile function of the standard normal distribution at 0≤ p≤ 1, and truncated to the interval [l,u]. Infinite values for vectors l and u are accepted.

Usage

norminvp(p, l, u)

Arguments

p

quantile at 0≤ p≤ 1

l

lower truncation limit

u

upper truncation limit

Details

Suppose we wish to simulate a random variable Z drawn from N(μ,σ^2) and conditional on l<Z<u using the inverse transform method. To achieve this, first compute X=norminvp(runif(1),(l-mu)/sig,(u-mu)/sig) and then set Z=mu+sig*X

Value

quantile value of the truncated normal distribution.

Note

If you wish to simulate truncated normal variables fast, use trandn. Using norminvp is advisable only when needed, for example, in quasi-Monte Carlo or antithetic sampling, where the inverse transform method is unavoidable.

Author(s)

Zdravko I. Botev

References

Z. I. Botev (2017), The Normal Law Under Linear Restrictions: Simulation and Estimation via Minimax Tilting, Journal of the Royal Statistical Society, Series B, 79 (1), pp. 1–24.

See Also

Examples

d <- 150 # simulate via inverse transform method
 norminvp(runif(d),l = 1:d, u = rep(Inf, d))

TruncatedNormal

Truncated Multivariate Normal and Student Distributions

v2.2
GPL-3
Authors
Zdravko Botev [aut] (<https://orcid.org/0000-0001-9054-3452>), Leo Belzile [aut, cre] (<https://orcid.org/0000-0002-9135-014X>)
Initial release
2020-05-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.