UNIPLT Subroutine

public subroutine UNIPLT(X, N)

NAME

uniplt(3f) - [M_datapac:LINE_PLOT] generate a Uniform probability plot
(line printer graph)

SYNOPSIS

   SUBROUTINE UNIPLT(X,N)

    REAL(kind=wp),intent(in) :: X(:)
    INTEGER,intent(in)       :: N

DESCRIPTION

UNIPLT(3f) generates a uniform probability plot.

The prototype uniform distribution used herein is defined on the
unit interval (0,1). This distribution has mean = 0.5 and standard
deviation = sqrt(1/12) = 0.28867513.

This distribution has the probability density function

    f(X) = 1

As used herein, a probability plot for a distribution is a plot
of the ordered observations versus the order statistic medians for
that distribution.

The uniform probability plot is useful in graphically testing
the composite (that is, location and scale parameters need not be
specified) hypothesis that the underlying distribution from which
the data have been randomly drawn is the uniform distribution.

If the hypothesis is true, the probability plot should be near-linear.

A measure of such linearity is given by the calculated probability
plot correlation coefficient.

INPUT ARGUMENTS

X     The  vector of (unsorted or sorted) observations.

N     The integer number of observations in the vector X.
      The maximum allowable value of N for this subroutine is 7500.

OUTPUT

A one-page uniform probability plot.

EXAMPLES

Sample program:

program demo_uniplt
use M_datapac, only : uniplt, label
implicit none
call label('uniplt')
! call uniplt(x,y)
end program demo_uniplt

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

  • Filliben, ‘Techniques for Tail Length Analysis’, Proceedings of the Eighteenth Conference on the Design of Experiments in Army REsearch Development and Testing (Aberdeen, Maryland, October, 1972), pages 425-450.
  • Hahn and Shapiro, Statistical Methods in Engineering, 1967, pages 260-308.
  • Johnson and Kotz, Continuous Univariate Distributions–2, 1970, pages 57-74.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: X(:)
integer, intent(in) :: N

Common Blocks

CAUPLT (subroutine)
CHSCDF (subroutine)
CODE (subroutine)
DECOMP (subroutine)
DEMOD (subroutine)
DEXPLT (subroutine)
EV1PLT (subroutine)
EV2PLT (subroutine)
EXPPLT (subroutine)
EXTREM (subroutine)
EXTREM (subroutine)
FREQ (subroutine)
GAMPLT (subroutine)
GEOPLT (subroutine)
HFNPLT (subroutine)
INVXWX (subroutine)
LAMPLT (subroutine)
LGNPLT (subroutine)
LOGPLT (subroutine)
MEDIAN (subroutine)
norout (subroutine)
NORPLT (subroutine)
PARPLT (subroutine)
PLOTU (subroutine)
POIPLT (subroutine)
RUNS (subroutine)
SAMPP (subroutine)
SPCORR (subroutine)
TAIL (subroutine)
TPLT (subroutine)
TRIM (subroutine)
WEIB (subroutine)
WEIPLT (subroutine)
WIND (subroutine)
"> common /BLOCK2_real32/

Type Attributes Name Initial
real :: WS(15000)

Source Code

SUBROUTINE UNIPLT(X,N)
REAL(kind=wp),intent(in) :: X(:)
INTEGER,intent(in)       :: N
REAL(kind=wp) :: an, cc, hold, sum1, sum2, sum3, tau, W, wbar, WS, Y, ybar, yint, yslope
INTEGER       :: i, iupper
DIMENSION Y(7500) , W(7500)
COMMON /BLOCK2_real32/ WS(15000)
EQUIVALENCE (Y(1),WS(1))
EQUIVALENCE (W(1),WS(7501))
!
DATA tau/1.04736842_wp/
!
      iupper = 7500
!
!     CHECK THE INPUT ARGUMENTS FOR ERRORS
!
      IF ( N<1 .OR. N>iupper ) THEN
         WRITE (G_IO,99001) iupper
         99001 FORMAT (' ***** FATAL ERROR--The second input argument to UNIPLT(3f) is outside the allowable (1,',&
         & I0,') interval *****')
         WRITE (G_IO,99002) N
         99002 FORMAT (' ','***** The value of the argument is ',I0,' *****')
         RETURN
      ELSEIF ( N==1 ) THEN
         WRITE (G_IO,99003)
         99003 FORMAT (' ***** NON-FATAL DIAGNOSTIC--The second input argument to UNIPLT(3f) has the value 1 *****')
         RETURN
      ELSE
         hold = X(1)
         DO i = 2 , N
            IF ( X(i)/=hold ) GOTO 50
         ENDDO
         WRITE (G_IO,99004) hold
         99004 FORMAT (' ***** NON-FATAL DIAGNOSTIC--The first input argument (a vector) to UNIPLT(3f) has all elements = ', &
         & E15.8,' *****')
!
!-----START POINT-----------------------------------------------------
!
 50      an = N
!
         !     SORT THE DATA
!
         CALL SORT(X,N,Y)
         !
         !     GENERATE UNIFORM ORDER STATISTIC MEDIANS
         !
         CALL UNIMED(N,W)
         !
         !     PLOT THE ORDERED OBSERVATIONS VERSUS ORDER STATISTICS MEDIANS.
         !     WRITE OUT THE TAIL LENGTH MEASURE OF THE DISTRIBUTION
         !     AND THE SAMPLE SIZE.
         !
         CALL PLOT(Y,W,N)
         WRITE (G_IO,99005) tau , N

         99005 FORMAT (' ','Uniform probability plot (TAU = ',E15.8,')',55X,'The sample size N = ',I0)
         !
         !     COMPUTE THE PROBABILITY PLOT CORRELATION COEFFICIENT.
         !     COMPUTE LOCATION AND SCALE ESTIMATES
         !     FROM THE INTERCEPT AND SLOPE OF THE PROBABILITY PLOT.
         !     THEN WRITE THEM OUT.
         !
         sum1 = 0.0_wp
         DO i = 1 , N
            sum1 = sum1 + Y(i)
         ENDDO
         ybar = sum1/an
         wbar = 0.5_wp
         sum1 = 0.0_wp
         sum2 = 0.0_wp
         sum3 = 0.0_wp
         DO i = 1 , N
            sum1 = sum1 + (Y(i)-ybar)*(Y(i)-ybar)
            sum2 = sum2 + (W(i)-0.5_wp)*(Y(i)-ybar)
            sum3 = sum3 + (W(i)-0.5_wp)*(W(i)-0.5_wp)
         ENDDO
         cc = sum2/SQRT(sum3*sum1)
         yslope = sum2/sum3
         yint = ybar - yslope*wbar
         WRITE (G_IO,99006) cc , yint , yslope
         99006 FORMAT (' ','Probability plot correlation coefficient = ',F8.5,&
         & 5X,'Estimated intercept = ',E15.8,3X,'Estimated slope = ',E15.8)
      ENDIF

END SUBROUTINE UNIPLT