RNUNO
Generates pseudorandom order statistics from a uniform (0, 1) distribution.
Required Arguments
IFIRST — First order statistic to generate. (Input)
ILAST — Last order statistic to generate. (Input)
ILAST must be greater than or equal to IFIRST. The full set of order statistics from IFIRST to ILAST is generated. If only one order statistic is desired, set ILAST = IFIRST.
N — Size of the sample from which the order statistics arise. (Input)
R — Vector of length ILAST + 1 ‑ IFIRST containing the random order statistics in ascending order. (Output)
The first element of R is the IFIRST‑th order statistic in a random sample of size N from the uniform (0, 1) distribution.
FORTRAN 90 Interface
Generic: CALL RNUNO (IFIRST, ILAST, N, R)
Specific: The specific interface names are S_RNUNO and D_RNUNO.
FORTRAN 77 Interface
Single: CALL RNUNO (IFIRST, ILAST, N, R)
Double: The double precision name is DRNUNO.
Description
Routine RNUNO generates the IFIRST through the ILAST order statistics from a pseudorandom sample of size N from a uniform (0, 1) distribution. Depending on the values of IFIRST and ILAST, different methods of generation are used to achieve greater efficiency. If IFIRST = 1 and ILAST = N, that is, if the full set of order statistics are desired, the spacings between successive order statistics are generated as ratios of exponential variates. If the full set is not desired, a beta variate is generated for one of the order statistics, and the others are generated as extreme order statistics from conditional uniform distributions. Extreme order statistics from a uniform distribution can be obtained by raising a uniform deviate to an appropriate power.
Each call to RNUNO yields an independent event. This means, for example, that if on one call the fourth order statistic is requested and on a second call the third order statistic is requested, the “fourth” may be smaller than the “third”. If both the third and fourth order statistics from a given sample are desired, they should be obtained from a single call to RNUNO (by specifying IFIRST less than or equal to 3 and ILAST greater than or equal to 4).
Comments
The routine RNSET can be used to initialize the seed of the random number generator. The routine RNOPT can be used to select the form of the generator.
Example
In this example, RNUNO is used to generate the fifteenth through the nineteenth order statistics from a sample of size twenty.
USE RNUNO_INT
USE UMACH_INT
USE RNSET_INT
IMPLICIT NONE
INTEGER IFIRST, ILAST, ISEED, N, NOUT
REAL R(5)
!
CALL UMACH (2, NOUT)
IFIRST = 15
ILAST = 19
N = 20
! Initialize seed of random number
! generator.
ISEED = 123457
CALL RNSET (ISEED)
CALL RNUNO (IFIRST, ILAST, N, R)
WRITE (NOUT,99999) R
99999 FORMAT (' The 15th through the 19th order statistics from a', &
/, ' random sample of size 20 from a uniform ', &
'distribution', /, 5F8.4)
END
Output
The 15th through the 19th order statistics from a
random sample of size 20 from a uniform distribution
0.6575 0.6802 0.6807 0.8177 0.8254