dcgamma: Approximate gamma shape distribution

Description Usage Arguments Details Value Note Author(s) References See Also

View source: R/dcgamma.r

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

1
2
3
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.

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).

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

Note

For general values of the parameters the gamma approximation may be poor. In such a case one could use this function to obtain draws from the proposal distribution in a Metropolis-Hastings step.

Author(s)

David Rossell

References

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

See Also

dgamma, rgamma


gaga documentation built on Nov. 8, 2020, 5:49 p.m.