| rgamma0 {ADtools} | R Documentation |
Simulate gamma random variates
rgamma0(n, shape, scale, method = "inv_tf")
n |
Positive integer; the number of samples. |
shape |
Positive number; the shape of the gamma distribution. |
scale |
Positive number; the scale of the gamma distribution. |
method |
'base' or 'inv_tf'; 'base' refers to 'stats::rgamma' while 'inv_tf' refers to inverse transform. |
Inverse transform is slower, but it is provided to remedy that base R uses two algorithms to simulate gamma random variables in different parameter regions, which creates a discontinuity in the pathwise derivative.
n <- 10
rgamma0(n, shape = 1, scale = 1)