rchi2 {lazy.stat} | R Documentation |
Chi Squared Random Numbers
rchi2(n, nu, kappa2)
n |
# of random numbers to be generated |
nu |
The degrees of freedom |
kappa2 |
The scale parameter |
kappa2 * chi squared with df=nu is chi squared with nu and kappa2.
If X is distributed as chi2( nu ),
Y2 = kappa2 * X is chiq( nu, kappa2 ).
Equivalently,
Y2 / kappa2 is distributed as chi2( nu ).
E( Y2 ) = nu*kappa2
var( Y2 ) = 2*nu*kappa2^2
mode( Y2 ) = kappa2*(nu-2)
vector of length n
set.seed(1701) x <- rchi2( 10000, 10, 1 ) Print( mean(x), var(x), sqrt(var(x)) )