Inverse Gamma Distribution in Prior Sample Size Parameterization
Random draws and density of inverse gamma distribution parameterized
in prior sample size n0
and prior variance var0
(see Gelman et al., 2014).
rinvgamma2(n, n0, var0) dinvgamma2(x, n0, var0)
n |
Number of draws for inverse gamma distribution |
n0 |
Prior sample size |
var0 |
Prior variance |
x |
Vector with numeric values for density evaluation |
A vector containing random draws or density values
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.
MCMCpack::rinvgamma
,
stats::rgamma
,
MCMCpack::dinvgamma
,
stats::dgamma
############################################################################# # 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")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.