Next: DRANDGAMMA, Previous: DRANDEXPONENTIAL, Up: Continuous Univariate Distributions
DRANDF / SRANDFGenerates a vector of random variates from an F distribution, also called the Fisher's variance ratio distribution, with probability density function, f(X), where: f(X) = [((m + v - 2) / 2)! * X^(m / 2 - 1) * m^(m / 2)] / [(m / 2 - 1)! * (v / 2 - 1)! * (1 + m * X / v)^((m + v) / 2) * v^(m / 2)], if X > 0, otherwise f(X) = 0. Here m is the first degrees of freedom, (DF1) and v is the second degrees of freedom, (DF2).
(Note that SRANDF is the single precision version of DRANDF. The argument lists of both routines are identical except that any double precision arguments of DRANDF are replaced in SRANDF by single precision arguments - type REAL in FORTRAN or type float in C).
— Input/Output: INTEGER STATE(*)
The STATE vector holds information on the state of the base generator being used and as such its minimum length varies. Prior to calling
DRANDFSTATE must have been initialized. See Initialization of the Base Generators for information on initialization of the STATE variable.
On input: the current state of the base generator.
On output: the updated state of the base generator.
Example:
C Generate 100 values from the F distribution
INTEGER LSTATE,N
PARAMETER (LSTATE=16,N=100)
INTEGER I,INFO,SEED(1),STATE(LSTATE)
INTEGER DF1,DF2
DOUBLE PRECISION X(N)
C Set the seed
SEED(1) = 1234
C Read in the distributional parameters
READ(5,*) DF1,DF2
C Initialize the STATE vector
CALL DRANDINITIALIZE(1,1,SEED,1,STATE,LSTATE,INFO)
C Generate N variates from the F distribution
CALL DRANDF(N,DF1,DF2,STATE,X,INFO)
C Print the results
WRITE(6,*) (X(I),I=1,N)
|