dcgamma
approximates density of a gamma shape distribution with
a gamma density. rcgamma
obtains random draws from the
approximation. mcgamma
computes approximated mean, variance and
normalization constant.
dcgamma(x, a, b, c, d, r, s, newton = TRUE)
rcgamma(n, a, b, c, d, r, s, newton = TRUE)
mcgamma(a, b, c, d, r, s, newton = TRUE)
TRUE
to try to locate the mode by taking
a few Newton-Raphson steps. dcgamma
returns a vector with approximate density.
rcgamma
returns a vector with draws from the approximating gamma.
mcgamma
returns a list with components:
C(a,b,c,d,r,s) (gamma(a*x+d)/gamma(x)^a)
(x/(r+s*x))^{a*x+d} x^{b-d-1} exp(-x*c)
for x>=0
, and 0 otherwise, where C()
is the normalization constant.
The gamma approximation is
Ga(a/2+b-1/2,c+a*log(s/a))
. The approximate normalization constant is
obtained by taking the ratio of the exact density and the
approximation at the maximum, as described in Rossell (2007).
dgamma
, rgamma