The function inv_sample() draws from the random variable, which is specified by the distribution F, using inverse sampling.

inv_sample(Finv, N = 1, F_distribution = NA)

Arguments

Finv

inverse distribution function

N

number of samples

F_distribution

distribution function, optional for more sophisticated plots

Value

returns a list containing the samples, the number of simulations and (optional) the distribution function.

Examples

Finv <- function(x){-log(1-x)} F_dist <- function(x){1-exp(-x)} inv_samples <- inv_sample(Finv, N = 10000) inv_samples_withF <- inv_sample(Finv, N = 10000, F_distribution = F_dist) inv_5samples <- inv_sample(Finv, N = 5)