draw.left.truncated.gamma {UnivRNG} | R Documentation |
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.
draw.left.truncated.gamma(nrep,alpha,beta,tau)
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. |
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.
Dagpunar, J. S. (1978). Sampling of variates from a truncated gamma distribution. Journal of Statistical Computation and Simulation, 8, 59-64.
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)