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

Wald

Wald (inverse Gaussian) distribution


Description

Density, distribution function and random generation for the Wald distribution.

Usage

dwald(x, mu, lambda, log = FALSE)

pwald(q, mu, lambda, lower.tail = TRUE, log.p = FALSE)

rwald(n, mu, lambda)

Arguments

x, q

vector of quantiles.

mu, lambda

location and shape parameters. Scale must be positive.

log, log.p

logical; if TRUE, probabilities p are given as log(p).

lower.tail

logical; if TRUE (default), probabilities are P[X ≤ x] otherwise, P[X > x].

n

number of observations. If length(n) > 1, the length is taken to be the number required.

p

vector of probabilities.

Details

Probability density function

f(x) = sqrt(λ/(2*π*x^3)) * exp((-λ*(x-μ)^2)/(2*μ^2*x))

Cumulative distribution function

F(x) = Φ(sqrt(λ/μ)*(x/μ-1)) - exp((2*λ)/μ) * Φ(sqrt(λ/μ)*(x/μ+1))

Random generation is done using the algorithm described by Michael, Schucany and Haas (1976).

References

Michael, J.R., Schucany, W.R., and Haas, R.W. (1976). Generating Random Variates Using Transformations with Multiple Roots. The American Statistician, 30(2): 88-90.

Examples

x <- rwald(1e5, 5, 16)
hist(x, 100, freq = FALSE)
curve(dwald(x, 5, 16), 0, 50, col = "red", add = TRUE)
hist(pwald(x, 5, 16))
plot(ecdf(x))
curve(pwald(x, 5, 16), 0, 50, col = "red", lwd = 2, add = TRUE)

extraDistr

Additional Univariate and Multivariate Distributions

v1.9.1
GPL-2
Authors
Tymoteusz Wolodzko
Initial release
2020-08-20

We don't support your browser anymore

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