Section: Random Number Generation
y = randf(n,m)
where n
and m
are vectors of the number of degrees of freedom
in the numerator and denominator of the chi-square random variables
whose ratio defines the statistic.
F_{n,m}
is defined as the ratio of two chi-square
random variables:
The PDF is given by
where B(a,b)
is the beta function.
randf
to generate some F-distributed random variables,
and then again using the randchi
function:
--> randf(5*ones(1,9),7) ans = <float> - size: [1 9] Columns 1 to 6 1.194351196 0.906920850 0.755768538 1.502930284 0.062067628 1.386031985 Columns 7 to 9 1.816088676 0.375541776 3.579419374 --> randchi(5*ones(1,9))./randchi(7*ones(1,9)) ans = <float> - size: [1 9] Columns 1 to 7 1.3084840 1.2693102 1.0684280 0.4377135 1.1158004 0.7171145 0.4150873 Columns 8 to 9 1.8022333 1.4605886