powered by
Density and random generation of the generalized gamma distribution.
dggamma(x, shape1, scale, shape2) rggamma(n, shape1, scale, shape2)
dggamma: Generalized gamma density evaluated at x
rggamma: Generalized gamma random deviates
vector of positive values
number of simulated vectors
overall shape parameter
vector of scales. Should be of the same length as x
x
vector of Dirichlet parameters. Should be of the same length as x.
log density at \(x >0\): \(log(shape1/scale) - lgamma(shape2) + (shape1*shape2-1)*log(x/scale) - (x/scale)^{shape1}\)
Stacy, E.W. (1962). "A Generalization of the Gamma Distribution." Annals of Mathematical Statistics 33(3): 1187-1192. Johnson, N.L.; Kotz, S; Balakrishnan, N. (1994) Continuous Univariate Distributions, Volume 1, 2nd Edition. Wiley. ISBN 0-471-58495-9 (Section 17.8.7)
set.seed(12345) u1 <- rggamma(10,2,1,1.4) # 10 random deviates with scale 1 set.seed(12345) u <- rggamma(10,2,1:10,1.4) # 10 random deviates with scale 1:10, repectively u u/u1 dggamma(u,2,1:10,1.4)
Run the code above in your browser using DataLab