lamsf(3f) - [M_datapac:SPARSITY] compute the Tukey-Lambda sparsity
function
SUBROUTINE LAMSF(P,Alamba,Sf)
REAL(kind=wp),intent(in) :: P
REAL(kind=wp),intent(in) :: Alamba
REAL(kind=wp),intent(out) :: Sf
LAMSF(3f) computes the sparsity function value for the (Tukey) lambda
distribution with tail length parameter value = ALAMBA.
In general, the probability density function for this distribution
is not simple.
The percent point function for this distribution is
g(P) = ((P**ALAMBA)-((1-P)**ALAMBA))/ALAMBA
Note that the sparsity function of a distribution is the derivative
of the percent point function, and also is the reciprocal of the
probability density function (but in units of P rather than X).
P The value (between 0.0 and 1.0) at which the sparsity function
is to be evaluated.
ALAMBA The value of Lambda (the Tail Length parameter).
If ALAMBA is positive, then P should be between 0.0 and 1.0,
inclusively.
If ALAMBA is non-positive, then P should be between 0.0 and
1.0, exclusively.
SF The sparsity function value for the Tukey Lambda distribution
Sample program:
program demo_lamsf
use M_datapac, only : lamsf
implicit none
! call lamsf(x,y)
end program demo_lamsf
Results:
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
lgncdf(3f) - [M_datapac:CUMULATIVE_DISTRIBUTION] compute the lognormal
cumulative distribution function
SUBROUTINE LGNCDF(X,Cdf)
REAL(kind=wp),intent(in) :: X
REAL(kind=wp),intent(out) :: Cdf
LGNCDF(3f) computes the cumulative distribution function value for
the lognormal distribution.
The lognormal distribution used herein has mean = sqrt(e) = 1.64872127
and standard deviation = sqrt(e*(e-1)) = 2.16119742. this distribution
is defined for all positive X and has the probability density function
f(X) = (1/(X*sqrt(2*pi))) * exp(-log(X)*log(X)/2)
The lognormal distribution used herein is the distribution of the
variate X = exp(z) where the variate z is normally distributed with
mean = 0 and standard deviation = 1.
X The value at which the cumulative distribution function is
to be evaluated. X should be positive.
Cdf The cumulative distribution function value for the lognormal
distribution
Sample program:
program demo_lgncdf
!@(#) line plotter graph of cumulative distribution function
use M_datapac, only : lgncdf, plott, label
implicit none
real,allocatable :: x(:), y(:)
integer :: i
call label('lgncdf')
x=[((real(i)+epsilon(0.0))/10.0,i=0,100,1)]
if(allocated(y))deallocate(y)
allocate(y(size(x)))
do i=1,size(x)
call lgncdf(x(i),y(i))
enddo
call plott(x,y,size(x))
end program demo_lgncdf
Results:
The following is a plot of Y(I) (vertically) versus X(I) (horizontally)
I-----------I-----------I-----------I-----------I
0.1000000E+02 - X
0.9583333E+01 I X
0.9166667E+01 I X
0.8750000E+01 I X
0.8333333E+01 I X
0.7916667E+01 I X
0.7500000E+01 - XX
0.7083333E+01 I X
0.6666667E+01 I X
0.6250000E+01 I X
0.5833333E+01 I X
0.5416667E+01 I X
0.5000000E+01 - X
0.4583333E+01 I XX
0.4166667E+01 I XX
0.3750000E+01 I X
0.3333333E+01 I X
0.2916667E+01 I XX
0.2500000E+01 - XXX
0.2083333E+01 I XXX
0.1666667E+01 I XXXX
0.1250000E+01 I X XX X
0.8333340E+00 I X X X X
0.4166670E+00 I X X X X
0.1192093E-07 - XX X
I-----------I-----------I-----------I-----------I
0.0000E+00 0.2473E+00 0.4947E+00 0.7420E+00 0.9893E+00
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) | :: | Alamba | |||
real(kind=wp), | intent(out) | :: | Sf |
SUBROUTINE LAMSF(P,Alamba,Sf) REAL(kind=wp),intent(in) :: P REAL(kind=wp),intent(in) :: Alamba REAL(kind=wp),intent(out) :: Sf !--------------------------------------------------------------------- ! CHECK THE INPUT ARGUMENTS FOR ERRORS ! IF ( Alamba>0.0_wp .OR. P>0.0_wp ) THEN IF ( Alamba>0.0_wp .OR. P<1.0_wp ) THEN IF ( Alamba<=0.0_wp .OR. P>=0.0_wp ) THEN IF ( Alamba<=0.0_wp .OR. P<=1.0_wp ) THEN !-----START POINT----------------------------------------------------- Sf = P**(Alamba-1.0_wp) + (1.0-P)**(Alamba-1.0_wp) GOTO 99999 ENDIF ENDIF ENDIF ENDIF WRITE (G_IO,99001) 99001 FORMAT (' ***** FATAL ERROR--The first input argument to LAMSF(3f) is outside the allowable (0,1) interval *****') WRITE (G_IO,99002) P 99002 FORMAT (' ***** the value of the argument is ',E15.8,' *****') RETURN 99999 END SUBROUTINE LAMSF