InvMethod: Inversion Method

Description Usage Arguments References Examples

Description

Algorithm to sample from cumulative distribution function, if no inverse function is analytically available.

Usage

1
InvMethod(Fun, len, candArea, grid = 1e-05, method = c("vector", "free"))

Arguments

Fun

cumulative distribution function

len

number of samples

candArea

candidate area

grid

fineness degree

method

vectorial ("vector") or not ("free")

References

Devroye, L. (1986). Non-Uniform Random Variate Generation. New York: Springer.

Examples

1
2
3
test <- InvMethod(function(x) pnorm(x, 5, 1), 1000, candArea = c(0, 10), method = "free")
plot(density(test))
curve(dnorm(x, 5, 1), col = 2, add = TRUE)

SimoneHermann/BaPreStoPro documentation built on May 9, 2019, 1:46 p.m.