RNWIB

Generates pseudorandom numbers from a Weibull distribution.

Required Arguments

A — The shape parameter of the Weibull distribution. (Input)
This parameter must be positive.

R — Vector of length NR containing the random Weibull deviates. (Output)

Optional Arguments

NR — Number of random numbers to generate. (Input)
Default: NR = size (R,1).

FORTRAN 90 Interface

Generic: CALL RNWIB (A, R [])

Specific: The specific interface names are S_RNWIB and D_RNWIB.

FORTRAN 77 Interface

Single: CALL RNWIB (NR, A, R)

Double: The double precision name is DRNWIB.

Description

Routine RNWIB generates pseudorandom numbers from a Weibull distribution with shape parameter A and unit scale parameter. The probability density function is

 

Routine RNWIB uses an antithetic inverse CDF technique to generate a Weibull variate; that is, a uniform random deviate U is generated and the inverse of the Weibull cumulative distribution function is evaluated at 1.0   U to yield the Weibull deviate.

Deviates from the two‑parameter Weibull distribution with shape parameter A and scale parameter B can be generated by using RNWIB and then multiplying each entry in R by B. The following statements (using routine SSCAL (IMSL MATH/LIBARY) in single precision) would yield random deviates from a two‑parameter Weibull distribution.

CALL RNWIB (NR, A, R)

CALL SSCAL (NR, B, R, 1)

The Rayleigh distribution with probability density function,

 

is the same as a Weibull distribution with shape parameter A equal to 2 and scale parameter B equal to

 

hence, RNWIB and SSCAL (or simple multiplication) can be used to generate Rayleigh deviates.

Comments

1. Informational error

 

Type

Code

Description

3

1

The value of A is so small that the proportion of values from the Weibull that are too large to represent is greater than machine epsilon.

2. 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, RNWIB is used to generate five pseudorandom deviates from a two‑parameter Weibull distribution with shape parameter equal to 2.0 and scale parameter equal to 6.0, a Rayleigh distribution with parameter

 

 

USE RNWIB_INT

USE UMACH_INT

USE RNSET_INT

USE SSCAL_INT

 

IMPLICIT NONE

INTEGER ISEED, NOUT, NR

REAL A, B, R(5)

!

CALL UMACH (2, NOUT)

A = 2.0

B = 6.0

NR = 5

ISEED = 123457

CALL RNSET (ISEED)

CALL RNWIB (A, R)

CALL SSCAL (NR, B, R, 1)

WRITE (NOUT,99999) R

99999 FORMAT (' Weibull(2,6) random deviates: ', 5F8.4)

END

Output

 

Weibull(2,6) random deviates: 1.1122 6.9568 3.0959 4.5031 2.4638