RANDF Generate F-Distributed Random Variable
Section: Random Number Generation
Usage
Generates random variables with an F-distribution. The general syntax for its use isy = 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.
Function Internals
The statisticF_{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.
Example
Here we userandf
to generate some F-distributed random variables,
and then again using the randchi
function:
--> randf(5*ones(1,9),7) ans = Columns 1 to 8 1.1944 0.9069 0.7558 1.5029 0.0621 1.3860 1.8161 0.3755 Columns 9 to 9 3.5794 --> randchi(5*ones(1,9))./randchi(7*ones(1,9)) ans = Columns 1 to 8 1.3085 1.2693 1.0684 0.4377 1.1158 0.7171 0.4151 1.8022 Columns 9 to 9 1.4606