C*********************************************************** C THIS SUBROUTINE TESTS FOR WHETHER THE UNDERLYING DISTRIBUTION OF A C RANDOM SAMPLE IS NEGATIVE EXPONENTIAL. NO CENSORING OR TRUNCATION C IS ALLOWED FOR. FOR THE UNDERLYING THEORY SEE EPSTEIN, PART ONE, C 1960, TECHNOMETRICS. C NOTE THAT THE INPUT SAMPLE DATA ARE DESTROYED DURING TESTING. C C SUBROUTINES CALLED: CHI,PCDF,PLOTF,UTEST,HEADER C*********************************************************** SUBROUTINE EXPT (X,N) C*********************************************************************** C DECLARATIONS C*********************************************************************** REAL X(1) CHARACTER*1 LABEL, HEAD, UL C*********************************************************************** C COMMON STATEMENTS C*********************************************************************** COMMON /ALPHA/ LABEL(80), HEAD(30), UL(3,25) COMMON /PAGE/ IPAGE C*********************************************************************** C PLOT THE EMPIRICAL CDF OVERLAID WITH THE THEORETICAL NEGATIVE C EXPONENTIAL CDF. C*********************************************************************** XN=FLOAT(N) XMEAN=0.0 DO 10 I=1,N 10 XMEAN=XMEAN+X(I) XMEAN=XMEAN/XN WRITE (6,40) XL=0.0 XU=3.0*XMEAN CALL PCDF (X,N,XL,XU,1) CALL PLOTF (2) CALL HEADER (1) WRITE (6,70) CALL PCDF (X,N,XL,XU,2) WRITE (6,80) (UL(1,J),J=1,25) C*********************************************************************** C TRANSFORM THE DATA TO UNIFORM RANDOM VARIABLES C*********************************************************************** XOLD=X(1) X(1)=XN*XOLD N1=N-1 DO 20 I=1,N1 IP=I+1 XHOLD=X(IP) X(IP)=X(I)+(XN-IP+1.)*(X(IP)-XOLD) 20 XOLD=XHOLD XMEAN=0.0 SCALE=1./X(N) DO 30 I=1,N1 X(I)=X(I)*SCALE 30 XMEAN=XMEAN+X(I) XMEAN=XMEAN/FLOAT(N1) C*********************************************************************** C TEST TO SEE IF THE TRANSFORMED RANDOM VARIABLES ARE UNIFORM AND C PLOT THEIR EMPIRICAL CDF WITH THE THEORTICAL UNIFORM CDF. C*********************************************************************** CALL HEADER (1) WRITE (6,50) N1 CALL UTEST (X,N1,N1,1) CALL HEADER (1) WRITE (6,60) CALL UTEST (X,N1,N1,2) WRITE (6,90) RETURN C*********************************************************************** C FORMAT STATEMENTS C*********************************************************************** C 40 FORMAT (//'0The negative exponential estimator assumes that', 1' perpendicular distances follow'/ 2' a negative exponential distribution. The following', 3' is a test of that assump-'/ 4' tion. First the sample CDF of perpendicular distances', 4' is plotted with the'/ 5' best fit of a negative exponential distribution. Then the', 6' data are transformed.'/ 7' If the data do in fact come from a negative exponential', 8' distribution then'/ 9' the transformed data will be from a uniform distribution.', A' The transformed'/ B' data are tested and a sample CDF of the transformed data', C' compared to a uniform'/ D' CDF. These tests are only valid and only performed if the', E' data are untruncated'/ F' and ungrouped.') 50 FORMAT (//'0Test of the hypothesis that the transformed'/ 1' data come from a uniform distribution.'/ 2'0Sample Size = ',I4/'0Ordered Transformed Data'/) 60 FORMAT (/10X,'Sample CDF of the transformed data (*) and the', 1' uniform CDF (U).') 70 FORMAT (/10X,'Sample CDF of the Perpendicular Distances (*)'/ 110X,'and the fitted negative exponential distribution (E).') 80 FORMAT (/41X,'Perpendicular Distances in ',25A1) 90 FORMAT (/52X,'Transformed Data') END