rigamma: Random number generation for inverse gamma distribution

Description Usage Arguments Value Author(s) Examples

Description

Simulates from a inverse gamma (a, b) distribution with density proportional to $y^(-a-1) exp(-b/y)$

Usage

1
rigamma(n, a, b)

Arguments

n

number of random numbers to be generated

a

inverse gamma shape parameter

b

inverse gamma rate parameter

Value

vector of n simulated draws

Author(s)

Jim Albert

Examples

1
2
3
4
a=10
b=5
n=20
rigamma(n,a,b)

Example output

 [1] 0.3834260 0.4719047 0.5931504 0.4672214 0.3860028 0.8494853 0.7019057
 [8] 0.7912156 0.7548683 0.6315305 0.4481571 0.5878979 1.3318498 0.6401769
[15] 0.3027346 0.6788368 0.6408850 0.4433238 0.4213004 0.5241296

LearnBayes documentation built on May 1, 2019, 7:03 p.m.