Generates random variables with an F-distribution. The general syntax for its use is
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.
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.
Here we use 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 3 1.0182518 1.6145548 1.2731971 Columns 4 to 6 0.99473107 0.21895742 3.7101061 Columns 7 to 9 1.1556993 0.78403413 2.9067836 --> randchi(5*ones(1,9))./randchi(7*ones(1,9)) ans = <float> - size: [1 9] Columns 1 to 3 2.5839260 0.59389555 0.25209698 Columns 4 to 6 0.99553269 0.69540071 2.1197720 Columns 7 to 9 0.85026217 0.39067981 0.34328517