rtgamma function

Testing truncated Gamma sampling

Testing truncated Gamma sampling

Truncated Gamma draws are needed for the standard deviation of the random effects Gibbs conditional.

rtgamma(n, shape, rate, a)

Arguments

  • n: Number of samples.
  • shape: Sampling from a truncated Gamma where E[x]=shape/rateE[x]=shape/rate.
  • rate: This parameter is the inverse of the scale which is an alternative representation for the Gamma distribution.
  • a: The truncation point, i.e., a<xa<x.

Returns

Returns n truncated Gamma, i.e., Gam(shape,rate)I(a,infinity)Gam(shape, rate)I(a, infinity).

References

Gentle J. (2013) Random number generation and Monte Carlo methods. Springer, New York, NY.

Examples

set.seed(12) rtgamma(1, 3, 1, 4) rtgamma(1, 3, 1, 4) a=rtgamma(10000, 10, 2, 1) mean(a) min(a)
  • Maintainer: Rodney Sparapani
  • License: GPL (>= 2)
  • Last published: 2024-06-21

Useful links