home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
DOOG
/
PCSSP2.ZIP
/
STATDATA.ZIP
/
TAB1.FOR
< prev
next >
Wrap
Text File
|
1985-12-27
|
4KB
|
142 lines
C
C ..................................................................
C
C SUBROUTINE TAB1
C
C PURPOSE
C TABULATE FOR ONE VARIABLE IN AN OBSERVATION MATRIX (OR A
C MATRIX SUBSET), THE FREQUENCY AND PERCENT FREQUENCY OVER
C GIVEN CLASS INTERVALS. IN ADDITION, CALCULATE FOR THE SAME
C VARIABLE THE TOTAL, AVERAGE, STANDARD DEVIATION, MINIMUM,
C AND MAXIMUM.
C
C USAGE
C CALL TAB1(A,S,NOVAR,UBO,FREQ,PCT,STATS,NO,NV)
C
C DESCRIPTION OF PARAMETERS
C A - OBSERVATION MATRIX, NO BY NV
C S - INPUT VECTOR GIVING SUBSET OF A. ONLY THOSE
C OBSERVATIONS WITH A CORRESPONDING NON-ZERO S(J) ARE
C CONSIDERED. VECTOR LENGTH IS NO.
C NOVAR - THE VARIABLE TO BE TABULATED. NOVAR MUST BE GREATER
C THAN OR EQUAL TO 1 AND LESS THAN OR EQUAL TO NV.
C AND UPPER LIMIT OF VARIABLE TO BE TABULATED
C IN UBO(1), UBO(2) AND UBO(3) RESPECTIVELY. IF
C LOWER LIMIT IS EQUAL TO UPPER LIMIT, THE PROGRAM
C USES THE MINIMUM AND MAXIMUM VALUES OF THE VARIABLE.
C NUMBER OF INTERVALS, UBO(2), MUST INCLUDE TWO CELLS
C FOR VALUES UNDER AND ABOVE LIMITS. VECTOR LENGTH
C IS 3.
C FREQ - OUTPUT VECTOR OF FREQUENCIES. VECTOR LENGTH IS
C UBO(2).
C PCT - OUTPUT VECTOR OF RELATIVE FREQUENCIES. VECTOR
C LENGTH IS UBO(2).
C STATS - OUTPUT VECTOR OF SUMMARY STATISTICS, I.E., TOTAL,
C AVERAGE, STANDARD DEVIATION, MINIMUM AND MAXIMUM.
C VECTOR LENGTH IS 5. IF S IS NULL, THEN TOTAL,AVERAGE
C AND STANDARD DEVIATION = 0, MIN=1.E75 AND MAX=-1.E75
C NO - NUMBER OF OBSERVATIONS. NO MUST BE > OR = TO 1
C NV - NUMBER OF VARIABLES FOR EACH OBSERVATION. NV MUST
C BE GREATER THAN OR EQUAL TO 1.
C
C REMARKS
C NONE
C
C SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
C NONE
C
C METHOD
C THE INTERVAL SIZE IS CALCULATED FROM THE GIVEN INFORMATION
C OR OPTIONALLY FROM THE MINIMUM AND MAXIMUM VALUES FOR
C VARIABLE NOVAR. THE FREQUENCIES AND PERCENT FREQUENCIES ARE
C THEN CALCULATED ALONG WITH SUMMARY STATISTICS.
C THE DIVISOR FOR STANDARD DEVIATION IS ONE LESS THAN THE
C NUMBER OF OBSERVATIONS USED.
C
C ..................................................................
C
SUBROUTINE TAB1(A,S,NOVAR,UBO,FREQ,PCT,STATS,NO,NV)
DIMENSION A(1),S(1),UBO(1),FREQ(1),PCT(1),STATS(1)
DIMENSION WBO(3)
DO 5 I=1,3
5 WBO(I)=UBO(I)
C
C CALCULATE MIN AND MAX
C
VMIN=1.0E38
VMAX=-1.0E38
IJ=NO*(NOVAR-1)
DO 30 J=1,NO
IJ=IJ+1
IF(S(J)) 10,30,10
10 IF(A(IJ)-VMIN) 15,20,20
15 VMIN=A(IJ)
20 IF(A(IJ)-VMAX) 30,30,25
25 VMAX=A(IJ)
30 CONTINUE
STATS(4)=VMIN
STATS(5)=VMAX
C
C DETERMINE LIMITS
C
IF(UBO(1)-UBO(3)) 40,35,40
35 UBO(1)=VMIN
UBO(3)=VMAX
40 INN=UBO(2)
C
C CLEAR OUTPUT AREAS
C
DO 45 I=1,INN
FREQ(I)=0.0
45 PCT(I)=0.0
DO 50 I=1,3
50 STATS(I)=0.0
C
C CALCULATE INTERVAL SIZE
C
SINT=ABS((UBO(3)-UBO(1))/(UBO(2)-2.0))
C
C TEST SUBSET VECTOR
C
SCNT=0.0
IJ=NO*(NOVAR-1)
DO 75 J=1,NO
IJ=IJ+1
IF(S(J)) 55,75,55
55 SCNT=SCNT+1.0
C
C DEVELOP TOTAL AND FREQUENCIES
C
STATS(1)=STATS(1)+A(IJ)
STATS(3)=STATS(3)+A(IJ)*A(IJ)
TEMP=UBO(1)-SINT
INTX=INN-1
DO 60 I=1,INTX
TEMP=TEMP+SINT
IF(A(IJ)-TEMP) 70,60,60
60 CONTINUE
IF(A(IJ)-TEMP) 75,65,65
65 FREQ(INN)=FREQ(INN)+1.0
GO TO 75
70 FREQ(I)=FREQ(I)+1.0
75 CONTINUE
IF (SCNT)79,105,79
C
C CALCULATE RELATIVE FREQUENCIES
C
79 DO 80 I=1,INN
80 PCT(I)=FREQ(I)*100.0/SCNT
C
C CALCULATE MEAN AND STANDARD DEVIATION
C
IF(SCNT-1.0) 85,85,90
85 STATS(2)=STATS(1)
STATS(3)=0.0
GO TO 95
90 STATS(2)=STATS(1)/SCNT
STATS(3)=SQRT(ABS((STATS(3)-STATS(1)*STATS(1)/SCNT)/(SCNT-1.0)))
95 DO 100 I=1,3
100 UBO(I)=WBO(I)
105 RETURN
END
E RELATIVE FREQUENCIES