Name

chis_rnd — chi-squared random draws

CALLING SEQUENCE

[rn]=chis_rnd(nn,v)

PARAMETERS

Input

• nn = a scalar for the size of the vector to be generated or nn(1) = nrows, nn(2) = ncols for a matrix to be generated

• v = the degrees of freedom

Output

• rn = (nxm) vector of draws from the chi-squared law

DESCRIPTION

Generates random chi-squared deviates.

EXAMPLE

1) x=chis_rnd(18,2)
2) x=chis_rnd([4 2],3)
 
Example 1 creates a (18x1) vector of draws from the chi-square with 2 degrees of freedom distribution. Example 2 creates a (4x2) matrix of draws from the chi-square with 3 degrees of freedom distribution. 

               

AUTHOR

Eric Dubois 2002