Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rinvgamma2

Inverse Gamma Distribution in Prior Sample Size Parameterization


Description

Random draws and density of inverse gamma distribution parameterized in prior sample size n0 and prior variance var0 (see Gelman et al., 2014).

Usage

rinvgamma2(n, n0, var0)

dinvgamma2(x, n0, var0)

Arguments

n

Number of draws for inverse gamma distribution

n0

Prior sample size

var0

Prior variance

x

Vector with numeric values for density evaluation

Value

A vector containing random draws or density values

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

sirt

Supplementary Item Response Theory Models

v3.10-118
GPL (>= 2)
Authors
Alexander Robitzsch [aut,cre] (<https://orcid.org/0000-0002-8226-3132>)
Initial release
2021-09-22 17:45:34

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.