Learn R Programming

mnorm (version 1.2.2)

qnormFast: Quantile function of a normal distribution

Description

Calculate quantile of a normal distribution using one of the available methods.

Usage

qnormFast(
  p,
  mean = 0L,
  sd = 1L,
  method = "Voutier",
  is_validation = TRUE,
  n_cores = 1L
)

Value

The function returns a vector of p-level quantiles of a normal distribution with mean equal to mean and standard deviation equal to sd.

Arguments

p

numeric vector of values between 0 and 1 representing levels of the quantiles.

mean

numeric value representing the expectation of a normal distribution.

sd

positive numeric value representing standard deviation of a normal distribution.

method

character representing the method to be used for quantile calculation. Available options are "Voutier" (default) and "Shore".

is_validation

logical value indicating whether input arguments should be validated. Set it to FALSE to get performance boost (default value is TRUE).

n_cores

positive integer representing the number of CPU cores used for parallel computing. Currently it is not recommended to set n_cores > 1 if vectorized arguments include less then 100000 elements.

Details

If method = "Voutier" then the method of P. Voutier (2010) is used which maximum absolute error is about \(0.000025\). If method = "Shore" then the approach proposed by H. Shore (1982) is applied which maximum absolute error is about \(0.026\) for quantiles of level between \(0.0001\) and \(0.9999\).

References

H. Shore (1982) <doi:10.2307/2347972>

P. Voutier (2010) <doi:10.48550/arXiv.1002.0567>

Examples

Run this code
qnormFast(c(0.1, 0.9), mean = 1, sd = 2)

Run the code above in your browser using DataLab