rinvchi2 {lazy.stat} | R Documentation |
Inverted Chi Squared Random Numbers
rinvchi2(n, nu, kappa2)
n |
# of random numbers to be generated |
nu |
The degrees of freedom |
kappa2 |
The scale parameter |
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 Y2 is distributed as invchi2( nu, kappa2 )
X2 = 1 / Y2 is distributed as chi2( nu, 1/kappa2 )
vector of length n
set.seed(1701) x <- rinvchi2( 10000, 10, 1 ) Print( mean(x), var(x), sqrt(var(x)) )