
Last chance! 50% off unlimited learning
Sale ends in
Density, distribution function and random generation for the Wald distribution.
dwald(x, mu, lambda, log = FALSE)pwald(q, mu, lambda, lower.tail = TRUE, log.p = FALSE)
rwald(n, mu, lambda)
vector of quantiles.
location and shape parameters. Scale must be positive.
logical; if TRUE, probabilities p are given as log(p).
logical; if TRUE (default), probabilities are
number of observations. If length(n) > 1
,
the length is taken to be the number required.
vector of probabilities.
Probability density function
Cumulative distribution function
Random generation is done using the algorithm described by Michael, Schucany and Haas (1976).
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.
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)
Run the code above in your browser using DataLab