      SUBROUTINE TAIL(X,N)
C
C     PURPOSE--THIS SUBROUTINE PERFOMS A SYMMETRIC DISTRIBUTION
C              TAIL LENGTH ANALYSIS
C              ON THE DATA IN THE INPUT VECTOR X. 
C              THE ANALYSIS CONSISTS OF THE FOLLOWING--
C              1) VARIOUS TEST STATISTICS TO TEST 
C                 THE SPECIFIC HYPOTHESIS OF NORMALITY;
C              2) A UNIFORM PROBABILITY PLOT
C                 (A SHORT-TAILED DISTRIBUTION);
C              3) A NORMAL PROBAIBLITY PLOT
C                 (A MODERATE-TAILED DISTRIBUTION);
C              4) A TUKEY LAMBDA = -0.5 PROBABILTY PLOT
C                 (A MODERATE-LONG-TAILED DISTRIBTION);
C              5) A CAUCHY PROBABILITY PLOT
C                (A LONG-TAILED DISTRIBUTION);
C              6) A DETERMINATION OF THE BEST-FIT 
C                 SYMMETRIC DISTRIBUTION
C                 TO THE DATA SET FROM AN
C                 ADMISSABLE SET CONSISTING OF
C                 43 SYMMETRIC DISTRIBUTIONS.
C              THE ADMISSABLE SET OF SYMMETRIC
C              DISTRIBUTIONS CONSIDERED INCLUDES THE
C              UNIFORM, NORMAL, LOGISTIC,
C              DOUBLE EXPONENTIAL, CAUCHY, AND
C              37 DISTRIBUTIONS DRAWN FROM THE
C              THE TUKEY LAMBDA DISTRIBUTIONAL FAMILY.
C              THE GOODNESS OF FIT CRITERION IS THE MAXIMUM PROBABILITY
C              PLOT CORRELATION COEFFICIENT CRITERION.
C     INPUT ARGUMENTS--X      = THE SINGLE PRECISION VECTOR OF
C                               (UNSORTED OR SORTED) OBSERVATIONS.
C                      N      = THE INTEGER NUMBER OF OBSERVATIONS
C                               IN THE VECTOR X.
C     OUTPUT--6 PAGES OF AUTOMATIC PRINTOUT--
C             1) VARIOUS TEST STATISTICS FOR NORMALITY;
C             2) A UNIFORM PROBABILITY PLOT;
C             3) A NORMAL PROBAIBLITY PLOT;
C             4) A TUKEY LAMBDA = -0.5 PROBABILTY PLOT;
C             5) A CAUCHY PROBABILITY PLOT;
C             6) A DETERMINATION OF THE BEST-FIT
C                SYMMETRIC DISTRIBUTION 
C                TO THE DATA SET.
C     PRINTING--YES.
C     RESTRICTIONS--THE MAXIMUM ALLOWABLE VALUE OF N
C                   FOR THIS SUBROUTINE IS 3000.
C     OTHER DATAPAC   SUBROUTINES NEEDED--SORT, UNIMED, NORPPF, PLOT. 
C     FORTRAN LIBRARY SUBROUTINES NEEDED--SQRT, ALOG, ALOG10, EXP,
C                                         SIN, COS, ATAN.
C     MODE OF INTERNAL OPERATIONS--SINGLE PRECISION.
C     LANGUAGE--ANSI FORTRAN. 
C     REFERENCE--FILLIBEN (1972), 'TECHNIQUES FOR TAIL LENGTH
C                ANALYSIS', PROCEEDINGS OF THE EIGHTEENTH
C                CONFERENCE ON THE DESIGN OF EXPERIMENTS IN 
C                ARMY RESEARCH AND TESTING, PAGES 425-450.
C              --FILLIBEN, 'THE PERCENT POINT FUNCTION',
C                UNPUBLISHED MANUSCRIPT.
C              --JOHNSON AND KOTZ (1970), CONTINUOUS UNIVARIATE
C                DISTRIBUTIONS-1, PAGES 250-271.
C     WRITTEN BY--JAMES J. FILLIBEN
C                 STATISTICAL ENGINEERING LABORATORY (205.03)
C                 NATIONAL BUREAU OF STANDARDS
C                 WASHINGTON, D. C. 20234
C                 PHONE--301-921-2315
C     ORIGINAL VERSION--JUNE      1972. 
C     UPDATED         --NOVEMBER  1975. 
C     UPDATED         --FEBRUARY  1976. 
C
C---------------------------------------------------------------------
C
      CHARACTER*4 IFLAG1
      CHARACTER*4 IFLAG2
      CHARACTER*4 IFLAG3
      CHARACTER*4 ILINE1
      CHARACTER*4 ILINE2
C
      CHARACTER*4 ALPHAM
      CHARACTER*4 ALPHAA
      CHARACTER*4 BLANK
      CHARACTER*4 HYPHEN
      CHARACTER*4 ALPHAI
      CHARACTER*4 ALPHAX
C
      DIMENSION X(*)
      DIMENSION Y(3000),Z(3000),YM(3000)
      DIMENSION P(3000),PTENTH(3000)
      DIMENSION CORR(50),IFLAG1(50),IFLAG2(50),IFLAG3(50)
      DIMENSION  ILINE1(130),ILINE2(130)
      DIMENSION XLINE(13)
      COMMON /BLOCK2/ WS(15000)
      EQUIVALENCE (Y(1),WS(1)),(Z(1),WS(3001)),(YM(1),WS(6001))
      EQUIVALENCE (P(1),WS(9001)),(PTENTH(1),WS(12001))
C
      DATA ALPHAM,ALPHAA/'M','A'/
      DATA BLANK,HYPHEN,ALPHAI,ALPHAX/' ','-','I','X'/
      DATA PICONS/3.14159265358979/
      DATA CONSTN/.3989422804/
C
      IPR=6
      IUPPER=3000
C
C     CHECK THE INPUT ARGUMENTS FOR ERRORS
C
      IF(N.LT.1.OR.N.GT.IUPPER)GOTO50
      IF(N.EQ.1)GOTO55
      HOLD=X(1)
      DO60I=2,N
      IF(X(I).NE.HOLD)GOTO90
   60 CONTINUE
      WRITE(IPR, 9)HOLD
      RETURN
   50 WRITE(IPR,17)IUPPER
      WRITE(IPR,47)N
      RETURN
   55 WRITE(IPR,18) 
      RETURN
   90 CONTINUE
    9 FORMAT(1H ,109H***** NON-FATAL DIAGNOSTIC--THE FIRST  INPUT ARGUME
     1NT (A VECTOR) TO THE TAIL   SUBROUTINE HAS ALL ELEMENTS = ,E15.8,6
     1H *****)
   17 FORMAT(1H , 98H***** FATAL ERROR--THE SECOND INPUT ARGUMENT TO THE
     1 TAIL   SUBROUTINE IS OUTSIDE THE ALLOWABLE (1,,I6,16H) INTERVAL *
     1****)
   18 FORMAT(1H ,100H***** NON-FATAL DIAGNOSTIC--THE SECOND INPUT ARGUME
     1NT TO THE TAIL   SUBROUTINE HAS THE VALUE 1 *****)
   47 FORMAT(1H , 35H***** THE VALUE OF THE ARGUMENT IS ,I8   ,6H *****)
C
C-----START POINT-----------------------------------------------------
C
      AN=N
C
C     COMPUTE THE SAMPLE MEAN 
C
      SUM=0.0
      DO100I=1,N
      SUM=SUM+X(I)
  100 CONTINUE
      XBAR=SUM/AN
C
C     COMPUTE S, BIASED S, B1, AND B2
C
      SUM2=0.0
      SUM3=0.0
      SUM4=0.0
      DO200I=1,N
      DEL=X(I)-XBAR 
      A2=DEL*DEL
      A3=DEL*A2
      A4=A2*A2
      SUM2=SUM2+A2
      SUM3=SUM3+A3
      SUM4=SUM4+A4
  200 CONTINUE
      AM2=SUM2/AN
      AM3=SUM3/AN
      AM4=SUM4/AN
      S=SQRT(SUM2/(AN-1.0))
      BS=SQRT(AM2)
      B1=AM3/(BS**3)
      B2=AM4/(BS**4)
C
C     COMPUTE THE EXPECTED VALUE AND STANDARD DEVIATION OF B1 AND B2
C     UNDER THE NORMALITY ASSUMPTION
C     REFERENCE--CRAMER, PAGE 386
C
      EB1=0.0
      SDB1=6.0*(AN-2.0)/((AN+1.0)*(AN+3.0))
      SDB1=SQRT(SDB1)
      ZB1=(B1-EB1)/SDB1
      EB2=3.0-6.0/(AN+1.0)
      SDB2=24.0*AN*(AN-2.0)*(AN-3.0)/((AN+1.0)*(AN+1.0)*(AN+3.0)*(AN+5.0
     1))
      ZB2=(B2-EB2)/SDB2
C
C     COMPUTE GEARY'S STATISTIC
C
      SUM=0.0
      DO300I=1,N
      SUM=SUM+ABS(X(I)-XBAR)
  300 CONTINUE
      EANDEV=SUM/AN 
      GEARY=EANDEV/BS
C
C     COMPUTE THE EXPECTED VALUE AND STANDARD DEVIATION
C     OF GEARY'S STATISTIC UNDER THE NORMALITY ASSUMPTION
C     REFERENCE--BIOMETRIKA, 1936, PAGE 296
C
      AA=SQRT(2.0/PICONS)
      BB=SQRT(2.0/(AN-1.0))
      IF(N.GE.100)CC=SQRT(AN/2.0)*(1.0-(1.0/(8.0*AN/2.0))+(1.0/(128.0*AN
     1*AN/4.0)))
      IF(N.GE.100)GOTO350
      COEF=1.0
      IMAX=N-1
      IEVODD=N-2*(N/2)
      IMIN=2
      IF(IEVODD.EQ.0)IMIN=3
      IF(IMIN.GT.IMAX)GOTO310 
      DO320I=IMIN,IMAX,2
      AI=I
      COEF=((AI-1.0)/AI)*COEF 
  320 CONTINUE
  310 COEF=COEF*(AN-1.0)
      IF(IEVODD.EQ.0)GOTO330
      COEF=COEF*(SQRT(PICONS)/2.0)
      GOTO340
  330 COEF=COEF/SQRT(PICONS)
  340 CC=COEF
  350 EGEARY=AA/(BB*CC)
      DD=(2.0/PICONS)*SQRT(AN*(AN-2.0)) 
      ARG=1.0/(AN-1.0)
      ARG=ARG/SQRT(1.0-ARG*ARG)
      EE=ATAN(ARG)
      SDGEAR=(1.0/AN)*(1.0+DD+EE)
      SDGEAR=SDGEAR-EGEARY*EGEARY
      SDGEAR=SQRT(SDGEAR)
      ZGEARY=(GEARY-EGEARY)/SDGEAR
C
C     SORT THE DATA,
C     THEN COMPUTE RANGE/S.
C
      CALL SORT(X,N,Y)
      RS=(Y(N)-Y(1))/S
C
C     COMPUTE THE EXPECTED VALUE AND STANDARD DEVIATION OF THE RANGE/S
C     UNDER THE NORMALITY ASSUMPTION
C     REFERENCE--BIOMETRIKA, 1954, PAGE 483
C
      G=.33000598+((AN-2.0)**.16)/41.785
      PN=(AN-G)/(AN-2.0*G+1.0)
      P1=1.0-PN
      CALL NORPPF(PN,RPN)
      CALL NORPPF(P1,RP1)
      EXN=RPN
      EX1=RP1
      ER=EXN-EX1
      CALL NORPPF(P1,PPFNOR)
      SFP1=1.0/(CONSTN*EXP(-(PPFNOR*PPFNOR)/2.0)) 
      CALL NORPPF(PN,PPFNOR)
      SFPN=1.0/(CONSTN*EXP(-(PPFNOR*PPFNOR)/2.0)) 
      VARXN=PN*(1.0-PN)*SFPN*SFPN/(AN+2.0)
      EXNSQ=VARXN+EXN*EXN
      COX1XN=P1*P1*SFP1*SFPN/(AN+2.0)
      EX1XN=COX1XN+EX1*EXN
      ERSQ=2.0*(EXNSQ-EX1XN)
      ES=BB*CC
      ESSQ=1.0
      ERS=ER/ES
      ERSSQ=ERSQ/ESSQ
      VARRS=ERSSQ-ERS*ERS
      SDRS=SQRT(VARRS)
      ZRS=(RS-ERS)/SDRS
C
C     COMPUTE THE WILK-SHAPIRO STATISTIC
C
      AL=ALOG10(AN) 
      GAMMA=.327511+.058212*AL-.009776*AL*AL
      SUM=0.0
      IF(N.LE.20)ARG=N
      IF(N.GT.20)ARG=N+1
      ASUBN=SQRT((1.0+(1.0/(4.0*ARG)))/SQRT(ARG)) 
      ASUB1=-ASUBN
      SUM=SUM+ASUB1*Y(1)+ASUBN*Y(N)
      IF(N.LE.2)GOTO510
      NM1=N-1
      DO500I=2,NM1
      AI=I
      PI=(AI-GAMMA)/(AN-2.0*GAMMA+1.0)
      CALL NORPPF(PI,EI)
      COEFI =2.0*EI  /SQRT(-2.722+4.083*AN)
      SUM=SUM+COEFI*Y(I)
  500 CONTINUE
  510 WILKSH=SUM*SUM/(AN*BS*BS)
C
C     COMPUTE THE EXPECTED VALUE AND STANDARD DEVIATION OF THE WILK-SHAPIRO
C     STATISTIC UNDER THE NORMALITY ASSUMPTION
C     REFERENCE--JJF APPROXIMATION TO MOMENTS ON PAGE 601 OF BIOMETRIKA (1965)
C
      IF(N.EQ.3)EWILKS=.9135
      IF(N.EQ.4)EWILKS=.9012
      IF(N.GE.5)EWILKS=.9026+(AN-5.0)/(44.608+13.593*SQRT(AN)+10.267*AN)
      IF(N.EQ.3)SDWILK=.0755
      IF(N.EQ.4)SDWILK=.0719
      IF(N.GE.5)SDWILK=.0670+(AN-5.0)/(-42.368-5.026*SQRT(AN)-14.925*AN)
      ZWILKS=(WILKSH-EWILKS)/SDWILK
C
C     COMPUTE THE CORRELATION COEFFICIENT BETWEEN THE ORDERED OBSERVATIONS
C     AND THE ORDER STATISIC MEDIANS FROM 44 DIFFERENT SYMMETRIC DISTRIBUTIONS
C
      NUMDIS=44
      NHALF=N/2
      NHALFP=NHALF+1
      IEVODD=N-2*(N/2)
      CALL UNIMED(N,Z)
      DO950I=1,N
      PTENTH(I)=Z(I)**(0.1)
  950 CONTINUE
      DO1000IDIS=1,NUMDIS
      IF(IDIS.EQ.20)GOTO1199
      IF(IDIS.EQ.22)GOTO1299
      IF(IDIS.EQ.23)GOTO1399
      IF(IDIS.EQ.33)GOTO1499
      IF(IDIS.LT.20)IDIS2=IDIS
      IF(IDIS.EQ.21)IDIS2=IDIS-1
      IF(23.LT.IDIS.AND.IDIS.LT.33)IDIS2=IDIS-2
      IF(33.LT.IDIS)IDIS2=IDIS-3
      ALAMBA=-(0.1)*FLOAT(IDIS2)+2.1
      IF(IDIS.EQ. 1)GOTO1009
      IF(IDIS.EQ.11)GOTO1019
      IF(IDIS.EQ.24)GOTO1029
      IF(IDIS.EQ.34)GOTO1039
      IF(IDIS.EQ.44)GOTO1049
      GOTO1059
 1009 DO1010I=1,NHALF
      IREV=N-I+1
      P(I)=Z(I)*Z(I)
      P(IREV)=Z(IREV)*Z(IREV) 
      YM(I)=(P(I)-P(IREV))/ALAMBA
      YM(IREV)=-YM(I)
 1010 CONTINUE
      IF(IEVODD.EQ.1)YM(NHALFP)=0.0
      GOTO1999
 1019 DO1020I=1,NHALF
      IREV=N-I+1
      P(I)=Z(I)
      P(IREV)=Z(IREV)
      YM(I)=(P(I)-P(IREV))/ALAMBA
      YM(IREV)=-YM(I)
 1020 CONTINUE
      IF(IEVODD.EQ.1)YM(NHALFP)=0.0
      GOTO1999
 1029 DO1030I=1,NHALF
      IREV=N-I+1
      P(I)=Z(I)**(-0.1)
      P(IREV)=Z(IREV)**(-0.1) 
      YM(I)=(P(I)-P(IREV))/ALAMBA
      YM(IREV)=-YM(I)
 1030 CONTINUE
      IF(IEVODD.EQ.1)YM(NHALFP)=0.0
      GOTO1999
 1039 DO1040I=1,NHALF
      P(IREV)=1.0/Z(IREV)
      P(I)=1.0/Z(I) 
      IREV=N-I+1
      YM(I)=(P(I)-P(IREV))/ALAMBA
      YM(IREV)=-YM(I)
 1040 CONTINUE
      IF(IEVODD.EQ.1)YM(NHALFP)=0.0
      GOTO1999
 1049 DO1050I=1,NHALF
      IREV=N-I+1
      P(I)=1.0/(Z(I)*Z(I))
      P(IREV)=1.0/(Z(IREV)*Z(IREV))
      YM(I)=(P(I)-P(IREV))/ALAMBA
      YM(IREV)=-YM(I)
 1050 CONTINUE
      IF(IEVODD.EQ.1)YM(NHALFP)=0.0
      GOTO1999
 1059 DO1060I=1,NHALF
      IREV=N-I+1
      P(I)=P(I)/PTENTH(I)
      P(IREV)=P(IREV)/PTENTH(IREV)
      YM(I)=(P(I)-P(IREV))/ALAMBA
      YM(IREV)=-YM(I)
 1060 CONTINUE
      IF(IEVODD.EQ.1)YM(NHALFP)=0.0
      GOTO1999
 1199 DO1200I=1,NHALF
      IREV=N-I+1
      CALL NORPPF(Z(I),YM(I)) 
      YM(IREV)=-YM(I)
 1200 CONTINUE
      IF(IEVODD.EQ.1)YM(NHALFP)=0.0
      GOTO1999
 1299 DO1300I=1,NHALF
      IREV=N-I+1
      YM(I)=ALOG(Z(I)/(1.0-Z(I)))
      YM(IREV)=-YM(I)
 1300 CONTINUE
      IF(IEVODD.EQ.1)YM(NHALFP)=0.0
      GOTO1999
 1399 DO1400I=1,NHALF
      IREV=N-I+1
      IF(Z(I).LE.0.5)YM(I)=ALOG(2.0*Z(I))
      IF(Z(I).GT.0.5)YM(I)=-ALOG(2.0*(1.0-Z(I)))
      YM(IREV)=-YM(I)
 1400 CONTINUE
      IF(IEVODD.EQ.1)YM(NHALFP)=0.0
      GOTO1999
 1499 DO1500I=1,NHALF
      IREV=N-I+1
      ARG=PICONS*Z(I)
      YM(I)=-COS(ARG)/SIN(ARG)
      YM(IREV)=-YM(I)
 1500 CONTINUE
      IF(IEVODD.EQ.1)YM(NHALFP)=0.0
 1999 SUM1=0.0
      SUM2=0.0
      DO2100I=1,N
      SUM1=SUM1+Y(I)*YM(I)
      SUM2=SUM2+YM(I)*YM(I)
 2100 CONTINUE
      SUM2=SQRT(SUM2)
      SUM3=S*SQRT(AN-1.0)
      CORR(IDIS)=SUM1/(SUM2*SUM3)
 1000 CONTINUE
C
C     DETERMINE THAT DISTRIBUTION WITH THE MAXIMUM PROB PLOT CORR COEFFICIENT
C
      IDISMX=1
      CORRMX=CORR(1)
      DO2200IDIS=1,NUMDIS
      IF(CORR(IDIS).GT.CORRMX)IDISMX=IDIS
      IF(CORR(IDIS).GT.CORRMX)CORRMX=CORR(IDIS)
 2200 CONTINUE
      DO2300IDIS=1,NUMDIS
      IFLAG1(IDIS)=BLANK
      IFLAG2(IDIS)=BLANK
      IFLAG3(IDIS)=BLANK
      IF(IDIS.EQ.IDISMX)GOTO2350
      GOTO2300
 2350 IFLAG1(IDIS)=ALPHAM
      IFLAG2(IDIS)=ALPHAA
      IFLAG3(IDIS)=ALPHAX
 2300 CONTINUE
      CC=CORR(20)
C
C     COMPUTE THE EXPECTED VALUE AND STANDARD DEVIATION OF THE PROBABILITY PLOT 
C     CORRELATION COEFFICIENT UNDER THE NORMALITY ASSUMPTION
C     REFERENCE--JJF UNPUBLISHED MANUSCRIPT
C
      IF(N.EQ.2)ECC=1.0
      IF(N.EQ.3)ECC=.95492958 
      IF(N.GE.4)ECC=.94947355+(AN-4.0)/(196.815-2.9418*SQRT(AN)+19.7916*
     1AN) 
      IF(N.EQ.2)SDCC=99999999.9999
      IF(N.EQ.3)SDCC=.04007697
      IF(N.GE.4)SDCC=.039492+(AN-4.0)/(-127.0-25.3*AN)
      ZCC=(CC-ECC)/SDCC
C
C     WRITE OUT THE NORMAL TAIL LENGTH STATISTICS PAGE
C
      WRITE(IPR,998)
      WRITE(IPR,810)
      WRITE(IPR,999)
      WRITE(IPR,821)N
      WRITE(IPR,822)XBAR
      WRITE(IPR,823)S
      WRITE(IPR,999)
      WRITE(IPR,830)
      WRITE(IPR,831)
      WRITE(IPR,832)
      WRITE(IPR,833)
      WRITE(IPR,834)
      DO840I=1,6
      WRITE(IPR,999)
  840 CONTINUE
      WRITE(IPR,850)
      WRITE(IPR,851)
      WRITE(IPR,999)
      WRITE(IPR,999)
      WRITE(IPR,860)
      WRITE(IPR,999)
      WRITE(IPR,871)B1,EB1,SDB1,ZB1
      WRITE(IPR,872)
      WRITE(IPR,873)B2,EB2,SDB2,ZB2
      WRITE(IPR,874)
      WRITE(IPR,875)GEARY,EGEARY,SDGEAR,ZGEARY
      WRITE(IPR,876)
      WRITE(IPR,877)RS,ERS,SDRS,ZRS
      WRITE(IPR,878)
      WRITE(IPR,879)WILKSH,EWILKS,SDWILK,ZWILKS
      WRITE(IPR,880)
      WRITE(IPR,881)CC,ECC,SDCC,ZCC
      WRITE(IPR,882)
C
C     COMPUTE THE LINE PLOT WHICH SHOWS THE DISTRIBUTION OF THE OBSERVED
C     VALUES IN TERMS OF MULTIPLES OF SAMPLE STANDARD DEVIATIONS AWAY FROM
C     THE SAMPLE MEAN
C
      DO 900I=1,130 
      ILINE1(I)=BLANK
      ILINE2(I)=BLANK
  900 CONTINUE
      ICOUNT=0
      DO920I=1,N
      MX=10.0*(((X(I)-XBAR)/S)+6.0)+0.5 
      MX=MX+7
      IF(MX.LT. 7.OR.MX.GT.127)ICOUNT=ICOUNT+1
      IF(MX.LT. 7.OR.MX.GT.127)GOTO920
      ILINE1(MX)=ALPHAX
  920 CONTINUE
      DO940I=7,127
      ILINE2(I)=HYPHEN
  940 CONTINUE
      DO960I=7,127,10
      ILINE2(I)=ALPHAI
  960 CONTINUE
      XLINE(7)=XBAR 
      DO3315I=1,6
      IREV=13-I+1
      AI=I
      XLINE(I)=XBAR-(7.0-AI)*S
      XLINE(IREV)=XBAR+(7.0-AI)*S
 3315 CONTINUE
C
C     WRITE OUT THE LINE PLOT SHOWING THE DEVIATIONS OF THE OBSERVATIONS
C     ABOUT THE SAMPLE MEAN IN TERMS OF MULTIPLES OF THE SAMPLE STANDARD
C     DEVIATION
C
      DO3305I=1,8
 3305 WRITE(IPR,999)
      WRITE(IPR,3310)
      WRITE(IPR,999)
      WRITE(IPR,999)
      WRITE(IPR,3321)(ILINE1(I),I=1,130)
      WRITE(IPR,3321)(ILINE2(I),I=1,130)
      WRITE(IPR,3323)
      WRITE(IPR,3326)(XLINE(I),I=1,13)
      WRITE(IPR,999)
      WRITE(IPR,3324)ICOUNT
C
C     GENERATE UNIFORM, NORMAL, LAMBDA = -0.5, AND CAUCHY PROBABILITY PLOTS
C
      NHALF=(N/2)+1 
      CALL PLOT(Y,Z ,N)
      WRITE(IPR,3501)N
      WRITE(IPR,3510)CORR(11) 
      DO4100I=1,NHALF
      IREV=N-I+1
      CALL NORPPF(Z(I),YM(I)) 
      YM(IREV)=-YM(I)
 4100 CONTINUE
      CALL PLOT(Y,YM,N)
      WRITE(IPR,3502)N
      WRITE(IPR,3510)CORR(20) 
      ALAMBA=-0.5
      DO4200I=1,NHALF
      IREV=N-I+1
      Q=Z(I)
      YM(I)=(Q**ALAMBA-(1.0-Q)**ALAMBA)/ALAMBA
      YM(IREV)=-YM(I)
 4200 CONTINUE
      CALL PLOT(Y,YM,N)
      WRITE(IPR,3503)ALAMBA,N 
      WRITE(IPR,3510)CORR(28) 
      DO4300I=1,NHALF
      IREV=N-I+1
      ARG=PICONS*Z(I)
      YM(I)=-COS(ARG)/SIN(ARG)
      YM(IREV)=-YM(I)
 4300 CONTINUE
      CALL PLOT(Y,YM,N)
      WRITE(IPR,3504)N
      WRITE(IPR,3510)CORR(33) 
C
C      WRITE OUT THE PROBABILITY PLOT CORRELATION COEFFICIENT PAGE
C
      WRITE(IPR,998)
      DO2400IDIS=1,NUMDIS
      IF(IDIS.EQ.20)GOTO2110
      IF(IDIS.EQ.22)GOTO2120
      IF(IDIS.EQ.23)GOTO2130
      IF(IDIS.EQ.33)GOTO2140
      IF(IDIS.LT.20)IDIS2=IDIS
      IF(IDIS.EQ.21)IDIS2=IDIS-1
      IF(23.LT.IDIS.AND.IDIS.LT.33)IDIS2=IDIS-2
      IF(33.LT.IDIS)IDIS2=IDIS-3
      ALAMBA=-(0.1)*FLOAT(IDIS2)+2.1
      WRITE(IPR,2105)N,ALAMBA,CORR(IDIS),IFLAG1(IDIS),IFLAG2(IDIS),
     1IFLAG3(IDIS)
      GOTO2400
 2110 WRITE(IPR,2115)N,CORR(IDIS),IFLAG1(IDIS),IFLAG2(IDIS),IFLAG3(IDIS)
      GOTO2400
 2120 WRITE(IPR,2125)N,CORR(IDIS),IFLAG1(IDIS),IFLAG2(IDIS),IFLAG3(IDIS)
      GOTO2400
 2130 WRITE(IPR,2135)N,CORR(IDIS),IFLAG1(IDIS),IFLAG2(IDIS),IFLAG3(IDIS)
      GOTO2400
 2140 WRITE(IPR,2145)N,CORR(IDIS),IFLAG1(IDIS),IFLAG2(IDIS),IFLAG3(IDIS)
 2400 CONTINUE
C
  810 FORMAT(1H ,48X,20HTAIL LENGTH ANALYSIS)
  821 FORMAT(1H ,46X,21H(THE SAMPLE SIZE N = ,I5,1H))
  822 FORMAT(1H ,40X,19H(THE SAMPLE MEAN = ,E15.8,1H))
  823 FORMAT(1H ,35X,33H(THE SAMPLE STANDARD DEVIATION = ,E15.8,1H))
  830 FORMAT(1H ,35X,63HREFERENCE--SHAPIRO, WILK, AND CHEN, JASA, 1968,
     1PAGES 1343-1372)
  831 FORMAT(1H ,35X,32HREFERENCE--CRAMER, PAGES 386-387)
  832 FORMAT(1H ,35X,49HREFERENCE--GEARY, BIOMETRIKA, 1947, PAGES 209-24
     12)
  833 FORMAT(1H ,35X,76HREFERENCE--BIOMETRIKA TABLES, VOLUME 1, PAGES 67
     1-69, 59-60, 207-208, AND 200)
  834 FORMAT(1H ,35X,60HREFERENCE--SHAPIRO AND WILK, BIOMETRIKA, 1965, P
     1AGES 591-611) 
  850 FORMAT(1H ,49X,22HTAIL LENGTH STATISTICS)
  851 FORMAT(1H ,5X,106HTHE EXPECTED VALUE AND STANDARD DEVIATION OF STA
     1TISTICS ON THIS PAGE ARE BASED ON THE NORMALITY ASSUMPTION)
  860 FORMAT(1H ,128H          FORM OF STATISTIC               VALUE OF
     1STAT    EXP(STAT)    SD(STAT)    (STAT-EXP(STAT))/SD(STAT)    TABL
     1E REFERENCE)
  871 FORMAT(1H ,41HSTANDARDIZED THIRD CENTRAL MOMENT        ,    F10.5,
     16X,F10.5,2X,F10.5,9X,F10.5,13X,17HBIOMETRIKA TABLES)
  872 FORMAT(1H ,111X,16HVOL. 1, PAGE 207)
  873 FORMAT(1H ,41HSTANDARDIZED FOURTH CENTRAL MOMENT       ,    F10.5,
     16X,F10.5,2X,F10.5,9X,F10.5,13X,17HBIOMETRIKA TABLES)
  874 FORMAT(1H ,111X,16HVOL. 1, PAGE 208)
  875 FORMAT(1H ,41HGEARY STATISTIC (MEAN DEVIATION/S)       ,    F10.5,
     16X,F10.5,2X,F10.5,9X,F10.5,13X,17HBIOMETRIKA TABLES)
  876 FORMAT(1H ,111X,16HVOL. 1, PAGE 207)
  877 FORMAT(1H ,41HRANGE/S                                  ,    F10.5,
     16X,F10.5,2X,F10.5,9X,F10.5,13X,17HBIOMETRIKA TABLES)
  878 FORMAT(1H ,111X,16HVOL. 1, PAGE 200)
  879 FORMAT(1H ,41HWILK-SHAPIRO STATISTIC (BLUE FOR SCALE/S),    F10.5,
     16X,F10.5,2X,F10.5,9X,F10.5,13X,17HBIOMETRIKA (1965))
  880 FORMAT(1H ,111X,8HPAGE 605)
  881 FORMAT(1H ,41HPROBABILITY PLOT CORRELATION COEFFICIENT ,    F10.5,
     16X,F10.5,2X,F10.5,9X,F10.5,13X,15HUNPUBLISHED JJF)
  882 FORMAT(1H ,111X,10HMANUSCRIPT)
 2105 FORMAT(1H ,28HTHE CORRELATION BETWEEN THE ,I6,60H ORDERED OBS. AND
     1 THE ORDER STAT. MEDIANS FROM THE LAMBDA = ,F4.1,10H DIST. IS ,F8.
     15,1X,3A1)
 2115 FORMAT(1H ,28HTHE CORRELATION BETWEEN THE ,I6,74H ORDERED OBS. AND
     1 THE ORDER STAT. MEDIANS FROM THE NORMAL DISTRIBUTION IS ,F8.5,1X,
     13A1)
 2125 FORMAT(1H ,28HTHE CORRELATION BETWEEN THE ,I6,74H ORDERED OBS. AND
     1 THE ORDER STAT. MEDIANS FROM THE LOGISTIC DIST.      IS ,F8.5,1X,
     13A1)
 2135 FORMAT(1H ,28HTHE CORRELATION BETWEEN THE ,I6,74H ORDERED OBS. AND
     1 THE ORDER STAT. MEDIANS FROM THE DOUBLE EXP. DIST.   IS ,F8.5,1X,
     13A1)
 2145 FORMAT(1H ,28HTHE CORRELATION BETWEEN THE ,I6,74H ORDERED OBS. AND
     1 THE ORDER STAT. MEDIANS FROM THE CAUCHY DISTRIBUTION IS ,F8.5,1X,
     13A1)
 3310 FORMAT(1H ,131HLINE PLOT SHOWING THE DISTRIBUTION OF THE OBSERVATI
     1ONS ABOUT THE SAMPLE MEAN IN TERMS OF MULTIPLES OF THE SAMPLE STAN
     1DARD DEVIATION)
 3321 FORMAT(1H ,130A1)
 3323 FORMAT(1H ,   127H     -6        -5        -4        -3        -2
     1       -1         0         1         2         3         4
     1  5         6)
 3324 FORMAT(1H ,10X,I5,105H OBSERVATIONS WERE IN EXCESS OF 6 SAMPLE STA
     1NDARD DEVIATIONS FROM THE SAMPLE MEAN AND SO WERE NOT PLOTTED)
 3326 FORMAT(1H ,13F10.4)
 3501 FORMAT(1H ,35X,47HUNIFORM PROBABILITY PLOT  (THE SAMPLE SIZE N = ,
     1I5,1H))
 3502 FORMAT(1H ,35X,46HNORMAL PROBABILITY PLOT  (THE SAMPLE SIZE N = ,I
     15,1H))
 3503 FORMAT(1H ,35X,9HLAMBDA = ,F4.1,40H PROBABILITY PLOT  (THE SAMPLE
     1SIZE N = ,I5,1H))
 3504 FORMAT(1H ,35X,46HCAUCHY PROBABILITY PLOT  (THE SAMPLE SIZE N = ,I
     15,1H))
 3510 FORMAT(1H , 34X,44H(PROBABILITY PLOT CORRELATION COEFFICIENT = ,F8
     1.5,1H))
  998 FORMAT(1H1)
  999 FORMAT(1H )
C
      RETURN
      END 
