Learn R Programming

cpsurvsim (version 1.2.2)

weib_icdf: Inverse CDF value generation for the Weibull distribution

Description

weib_icdf returns a value from the Weibull distribution by using the inverse CDF.

Usage

weib_icdf(n, gamma, theta)

Value

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

Arguments

n

Number of output Weibull values

gamma

Shape parameter \(\gamma\)

theta

Scale parameter \(\theta\)

Details

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

Examples

Run this code
simdta <- weib_icdf(n = 10, theta = 0.05, gamma = 2)

Run the code above in your browser using DataLab