rinvchi {lazy.stat} R Documentation

Inverted Chi Random Numbers

Description

Inverted Chi Random Numbers

Usage

```rinvchi(n, nu, kappa2)
```

Arguments

 `n` # of random numbers to be generated `nu` The degrees of freedom `kappa2` The scale parameter

Details

If X is distributed as chi2( nu ), then
Y2= kappa2 / X is distributed as invchi2( nu, kappa2 )
and
Y1= sqrt(Y2) = sqrt( kappa2/X ) is distributed as invchi( nu, kappa2 ).

E( Y1 ) = kappa*gamma((nu-1)/2)/sqrt(2)/gamma(nu/2)
== sqrt( kappa2/(nu-1.5) ) = kappa/sqrt(nu-1.5)
var( Y1 ) = kappa2/(nu-2) - E( Y1 )^2
mode( Y1 ) = kappa/sqrt( nu+1 )

E( Y2 ) = kappa2/( nu-2 )
var( Y2 ) = 2 kappa2^2/(nu-2)^2/(nu-4)
mode( Y2 ) = kappa2/(nu+2)

If Y1 is distributed as invchi( nu, kappa2 )
Y2 = Y1^2 is distributed as invchi2( nu, kappa2 )
Therefore, X2 = 1 / Y2 is distributed as chi2( nu, 1/kappa2 ).

Value

vector of length n

Examples

```set.seed(1701)
x <- rinvchi( 10000, 10, 1 )
Print( mean(x), var(x), sqrt(var(x)) )

```

[Package lazy.stat version 0.1.3 Index]