WEICDF Subroutine

public subroutine WEICDF(X, Gamma, Cdf)

NAME

weicdf(3f) - [M_datapac:CUMULATIVE_DISTRIBUTION] compute the Weibull cumulative
distribution function

SYNOPSIS

   SUBROUTINE WEICDF(X,Gamma,Cdf)

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

DESCRIPTION

WEICDF(3f) computes the cumulative distribution function value for
the Weibull distribution with REAL tail length parameter
= GAMMA.

The Weibull distribution used herein is defined for all positive 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 positive ( >0 )

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

OUTPUT ARGUMENTS

CDF    The cumulative distribution function value for the Weibull
       distribution

EXAMPLES

Sample program:

program demo_weicdf
!@(#) line plotter graph of cumulative distribution function
use M_datapac, only : weicdf, plott, label
implicit none
real,allocatable  :: x(:), y(:)
real              :: gamma
integer           :: i
   call label('weicdf')
   x=[((real(i)+epsilon(0.0))/30.0,i=0,100,1)]
   if(allocated(y))deallocate(y)
   allocate(y(size(x)))
   gamma=12.2
   do i=1,size(x)
      call weicdf(X(i),Gamma,y(i))
   enddo
   call plott(x,y,size(x))
end program demo_weicdf

Results:

 The following is a plot of Y(I) (vertically) versus X(I) (horizontally)
                   I-----------I-----------I-----------I-----------I
  0.3333333E+01 -                                                  X
  0.3194444E+01 I                                                  X
  0.3055556E+01 I                                                  X
  0.2916667E+01 I                                                  X
  0.2777778E+01 I                                                  X
  0.2638889E+01 I                                                  X
  0.2500000E+01 -                                                  X
  0.2361111E+01 I                                                  X
  0.2222222E+01 I                                                  X
  0.2083333E+01 I                                                  X
  0.1944444E+01 I                                                  X
  0.1805556E+01 I                                                  X
  0.1666667E+01 -                                                  X
  0.1527778E+01 I                                                  X
  0.1388889E+01 I                                                  X
  0.1250000E+01 I                                                  X
  0.1111111E+01 I                                             X  X X
  0.9722223E+00 I                   X     X      X      X
  0.8333335E+00 -    XX X  X   X
  0.6944444E+00 I  XX
  0.5555556E+00 I  X
  0.4166667E+00 I  X
  0.2777779E+00 I  X
  0.1388891E+00 I  X
  0.3973643E-08 -  X
                   I-----------I-----------I-----------I-----------I
            0.0000E+00  0.2500E+00  0.5000E+00  0.7500E+00  0.1000E+01

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 250-271.
  • Hastings and Peacock, Statistical Distributions–A Handbook for Students and Practitioners, 1975, page 124.

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 WEICDF(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 WEICDF(3f) IS NON-POSITIVE *****')
         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 WEICDF(3f) IS NON-POSITIVE *****')
         WRITE (G_IO,99003) Gamma
         Cdf = 0.0_wp
         RETURN
      ELSE
         Cdf = 1.0_wp - (EXP(-(X**Gamma)))
      ENDIF
99003 FORMAT (' ','***** THE VALUE OF THE ARGUMENT IS ',E15.8,' *****')
!
END SUBROUTINE WEICDF