EV2CDF Subroutine

public subroutine EV2CDF(X, Gamma, Cdf)

NAME

ev2cdf(3f) - [M_datapac:CUMULATIVE_DISTRIBUTION] compute the extreme value type 2
(Frechet) cumulative distribution function

SYNOPSIS

   SUBROUTINE EV2CDF(X,Gamma,Cdf)

    REAL(kind=wp),intent(in) :: X
    REAL(kind=wp),intent(in) :: Gamma
    REAL(kind=wp),intent(out) :: Cdf

DESCRIPTION

EV2CDF(3f) computes the cumulative distribution function value for
the extreme value type 2 distribution with REAL tail
length parameter = GAMMA.

The extreme value type 2 distribution used herein is defined for all
non-negative X, and has the probability density function

    f(X) = GAMMA * (X**(-GAMMA-1)) * exp(-(X**(-GAMMA)))

INPUT ARGUMENTS

X      The value at which the cumulative distribution function is
       to be evaluated. X should be non-negative.

GAMMA  The value of the tail length parameter. GAMMA should be
       positive.

OUTPUT ARGUMENTS

CDF    The cumulative distribution function value for the extreme
       value type 2 distribution with tail length parameter value = GAMMA.

EXAMPLES

Sample program:

program demo_ev2cdf
use M_datapac, only : ev2cdf
implicit none
! call ev2cdf(x,y)
end program demo_ev2cdf

Results:

AUTHOR

The original DATAPAC library was written by James Filliben of the
Statistical Engineering Division, National Institute of Standards
and Technology.

MAINTAINER

John Urban, 2022.05.31

LICENSE

CC0-1.0

REFERENCES

  • Johnson and Kotz, Continuous Univariate Distributions–1, 1970, pages 272-295.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: X
real(kind=wp), intent(in) :: Gamma
real(kind=wp), intent(out) :: Cdf

Source Code

SUBROUTINE EV2CDF(X,Gamma,Cdf)
REAL(kind=wp),intent(in) :: X
REAL(kind=wp),intent(in) :: Gamma
REAL(kind=wp),intent(out) :: Cdf
!
!     CHECK THE INPUT ARGUMENTS FOR ERRORS
!
      IF ( X<0.0_wp ) THEN
         WRITE (G_IO,99001)
         99001 FORMAT (' ***** NON-FATAL DIAGNOSTIC--The first input argument to EV2CDF(3f) is negative *****')
         WRITE (G_IO,99003) X
         Cdf = 0.0_wp
         RETURN
      ELSEIF ( Gamma<=0.0_wp ) THEN
         WRITE (G_IO,99002)
         99002 FORMAT (' ***** FATAL ERROR--The second input argument to EV2CDF(3f) is non-positive *****')
         WRITE (G_IO,99003) Gamma
         Cdf = 0.0_wp
         RETURN
      ELSE
         Cdf = 0.0_wp
         IF ( X==0.0_wp ) RETURN
         Cdf = EXP(-(X**(-Gamma)))
      ENDIF

99003 FORMAT (' ','***** The value of the argument is ',E15.8,' *****')

END SUBROUTINE EV2CDF