draw_gamma: Simulate draws from the Gamma distribution.

Description Usage Arguments Details Value Examples

Description

Simulate draws from the Gamma distribution.

Usage

1
draw_gamma(a, rate)

Arguments

a

A positive number, the shape parameter of the distribution.

rate

A numeric vector of positive values containing the rates rates parameters for each draw.

Details

Note that the rate parameter is the reciprocal of the scale parameter which appears as an argument in the underlying C function rgamma from Rmath.h called here. The function draw_gamma is vectorized for its second argument, the vector of rate parameters, and uses the length of this parameter to determine how many draws to make. This function is intended for use in a Gibbs sampler that uses the scale mixture of normals representation of the Student-t distribution. In each step of the sampler we draw an auxiliary parameter (a Gamma variate) for each observation in the sample. Each of these draws has the same shape parameter but a different rate parameter.

Value

A vector of random draws. The jth element is a Gamma(a, rate(j)) variate.

Examples

1
draw_gamma(1, 1:10)

fditraglia/zoofactr documentation built on May 16, 2019, 12:12 p.m.