Learn R Programming

gaga (version 2.18.0)

dcgamma: Approximate gamma shape distribution

Description

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.

Usage

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)

Arguments

x
Vector indicating the values at which to evaluate the density.
n
Number of random draws to obtain.
a,b,c,d,r,s
Parameter values.
newton
Set to TRUE to try to locate the mode by taking a few Newton-Raphson steps.

Value

dcgamma returns a vector with approximate density. rcgamma returns a vector with draws from the approximating gamma. mcgamma returns a list with components:
m
Approximate mean
v
Approximate variance
normk
Approximate normalization constant

Details

The density of a gamma shape distribution is given by 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).

References

Rossell D. GaGa: a simple and flexible hierarchical model for microarray data analysis. http://rosselldavid.googlepages.com.

See Also

dgamma, rgamma