draw.left.truncated.gamma {UnivRNG} | R Documentation |
Generates variates from left truncated Gamma distribution
Description
This function implements pseudo-random number generation for a left-truncated gamma distribution with pdf
f(x|\alpha, \beta) = \frac{1}{(\Gamma(\alpha)-\Gamma_{\tau/\beta}(\alpha))\beta^{\alpha}}x^{\alpha-1}e^{-x/\beta}
for 0<\tau\leq x
, and min(\tau
, \beta
)>0 where \alpha
and \beta
are the shape and scale parameters, respectively, \tau
is the cutoff point at which truncation occurs, and \Gamma_{\tau/\beta}
is the incomplete gamma function.
Usage
draw.left.truncated.gamma(nrep,alpha,beta,tau)
Arguments
nrep |
Number of data points to generate. |
alpha |
Shape parameter for the desired gamma distribution. |
beta |
Scale parameter fot the desired gamma distribution. |
tau |
Point of left truncation. |
Value
A list of length five containing generated data, the theoretical mean, the empirical mean, the theoretical variance, and the empirical variance with names y, theo.mean, emp.mean, theo.var, and emp.var, respectively.
References
Dagpunar, J. S. (1978). Sampling of variates from a truncated gamma distribution. Journal of Statistical Computation and Simulation, 8, 59-64.
Examples
draw.left.truncated.gamma(nrep=100000,alpha=5,beta=1,tau=0.5)
draw.left.truncated.gamma(nrep=100000,alpha=2,beta=2,tau=0.1)