weippf(3f) - [M_datapac:PERCENT_POINT] compute the Weibull percent
point function
SUBROUTINE WEIPPF(P,Gamma,Ppf)
REAL(kind=wp),intent(in) :: P
REAL(kind=wp),intent(in) :: Gamma
REAL(kind=wp),intent(out) :: Ppf
WEIPPf(3f) computes the percent point 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))
Note that the percent point function of a distribution is identically
the same as the inverse cumulative distribution function of the
distribution.
P The value (between 0.0 (inclusively) and 1.0 (exclusively))
at which the percent point function is to be evaluated.
GAMMA The value of the tail length parameter. GAMMA should be positive.
PPF The percent point function value for the Weibull distribution
Sample program:
program demo_weippf
!@(#) line plotter graph of function
use M_datapac, only : weippf, plott, label
implicit none
integer,parameter :: n=200
real :: x(n), y(n)
real :: gamma
integer :: i
gamma=2.0
call label('weippf')
x=[(real(i)/real(n+1),i=1,n)]
do i=1,n
call weippf(x(i),gamma,y(i))
enddo
call plott(x,y,n)
end program demo_weippf
Results:
The following is a plot of Y(I) (vertically) versus X(I) (horizontally)
I-----------I-----------I-----------I-----------I
0.9950249E+00 - XX X X X
0.9537728E+00 I XXXXXX
0.9125207E+00 I XXXX
0.8712686E+00 I XXX
0.8300166E+00 I XXX
0.7887645E+00 I XX
0.7475125E+00 - XX
0.7062603E+00 I XX
0.6650083E+00 I XX
0.6237562E+00 I XX
0.5825042E+00 I XX
0.5412520E+00 I XX
0.5000000E+00 - XX
0.4587479E+00 I XX
0.4174958E+00 I XX
0.3762438E+00 I XX
0.3349917E+00 I XX
0.2937396E+00 I XX
0.2524875E+00 - XX
0.2112355E+00 I XX
0.1699834E+00 I XX
0.1287313E+00 I XX
0.8747923E-01 I XXX
0.4622716E-01 I XXX
0.4975124E-02 - XXX
I-----------I-----------I-----------I-----------I
0.7062E-01 0.6287E+00 0.1187E+01 0.1745E+01 0.2303E+01
The original DATAPAC library was written by James Filliben of the
Statistical Engineering Division, National Institute of Standards
and Technology.
John Urban, 2022.05.31
CC0-1.0
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | P | |||
real(kind=wp), | intent(in) | :: | Gamma | |||
real(kind=wp), | intent(out) | :: | Ppf |
SUBROUTINE WEIPPF(P,Gamma,Ppf) REAL(kind=wp),intent(in) :: P REAL(kind=wp),intent(in) :: Gamma REAL(kind=wp),intent(out) :: Ppf !--------------------------------------------------------------------- ! ! CHECK THE INPUT ARGUMENTS FOR ERRORS ! IF ( P<0.0_wp .OR. P>=1.0_wp ) THEN WRITE (G_IO,99001) 99001 FORMAT (' ***** FATAL ERROR--The first input argument TO WEIPPF(3f) is outside the allowable (0,1) interval *****') WRITE (G_IO,99003) P Ppf = 0.0_wp RETURN ELSEIF ( Gamma<=0.0_wp ) THEN WRITE (G_IO,99002) 99002 FORMAT (' ***** FATAL ERROR--The second input argument to WEIPPF(3f) is non-positive *****') WRITE (G_IO,99003) Gamma Ppf = 0.0_wp RETURN ELSE Ppf = (-LOG(1.0_wp-P))**(1.0_wp/Gamma) ENDIF 99003 FORMAT (' ***** The value of the argument is ',E15.8,' *****') ! END SUBROUTINE WEIPPF