Inverse Gamma Distribution in Prior Sample Size Parameterization
rinvgamma2.Rd
Random draws and density of inverse gamma distribution parameterized
in prior sample size n0
and prior variance var0
(see Gelman et al., 2014).
Arguments
- n
Number of draws for inverse gamma distribution
- n0
Prior sample size
- var0
Prior variance
- x
Vector with numeric values for density evaluation
References
Gelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A., & Rubin, D. B. (2014). Bayesian data analysis (Vol. 3). Boca Raton, FL, USA: Chapman & Hall/CRC.
See also
MCMCpack::rinvgamma
,
stats::rgamma
,
MCMCpack::dinvgamma
,
stats::dgamma
Examples
#############################################################################
# EXAMPLE 1: Inverse gamma distribution
#############################################################################
# prior sample size of 100 and prior variance of 1.5
n0 <- 100
var0 <- 1.5
# 100 random draws
y1 <- sirt::rinvgamma2( n=100, n0, var0 )
summary(y1)
graphics::hist(y1)
# density y at grid x
x <- seq( 0, 2, len=100 )
y <- sirt::dinvgamma2( x, n0, var0 )
graphics::plot( x, y, type="l")