Learn R Programming

cpsurvsim (version 1.2.2)

exp_icdf: Inverse CDF for the exponential distribution

Description

exp_icdf simulates values from the inverse CDF of the exponential distribution.

Usage

exp_icdf(n, theta)

Value

Output is a value or a vector of values from the exponential distribution.

Arguments

n

Number of output exponential values

theta

Scale parameter \(\theta\)

Details

This function uses the exponential distribution of the form $$f(t)=\theta exp(-\theta t)$$ to get the inverse CDF $$F^(-1)(u)=(-log(1-u))/\theta$$ where \(u\) is a uniform random variable. It can be implemented directly and is also called by the function exp_memsim.

Examples

Run this code
simdta <- exp_icdf(n = 10, theta = 0.05)

Run the code above in your browser using DataLab