Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-01 - decus/20-0020/statwe.sta
There are 2 other files named statwe.sta in the archive. Click here to see a list.
100'  NAME--STATWE
110'
120'  DESCRIPTION--COMPUTES 34 STAT. MEASURES FOR A WEIGHTED STRING
130'  OF NUMBERS AS GIVEN IN THE NBS HANDBOOK 101.
140'
150'  SOURCE--CARLA MESSINA, N.B.S., APRIL 22, 1965.
160'
170'  INSTRUCTIONS--ENTER DATA IN LINE 290 AND FOLLOWING.
180'  FIRST DATA IS 0 IF THE DATA ARE UNWEIGHTED, OTHERWISE IT IS 1.
190'  NEXT ENTER THE NUMBERS THEMSELVES. IF THE NUMBERS
200'  ARE UNWEIGHTED, JUST ENTER THEM IN ORDER. IF THE NUMBERS ARE
210'  WEIGHTED, ENTER PAIRS X,W WHERE X IS THE NUMBER AND
220'  W IS ITS WEIGHT. NO X CAN BE EXACTLY -999999. IF THE NUMBER OF
230' THE POINTS IS GREATER THAN 100, THE DIM STATEMENTS IN LINE
240'  300 MUST BE CHANGED. SAMPLE DATA IS IN LINE 290.
250'
260'
270'  *  *  *  *  *  *   MAIN PROGRAM  *  *  *  *  *  *  *  *  *  *
280'
290 DATA   0,79,101,83,116,78,114,87, 134,84,124,0,0
300 DIM X(100),W(100),D(110)
310 PRINT " COMPUTATIONS ON THE X ARRAY"
320 PRINT
330 READ N
340 LET J=0
350 LET I=1
360 LET J1=0
370 IF K=10 THEN 1690
380 LET I1=0
390 LET K1=0
400 LET L1=0
410 READ X(I)
420 IF X(I)= 0 THEN 540
430 LET W(I)=1
440 IF N = 0 THEN 470
450 READ W(I)
460 IF W(I)=0 THEN 480
470 LET J=J+1
480 LET I=I+1
490 LET I1 = X(I-1) + I1
500 LET J1 = W(I-1) + J1
510 LET K1 = W(I-1)*X(I-1) +K1
520 LET L1 =(W(I-1)*X(I-1))^2 +L1
530 GOTO 410
540 LET I=I-1
550 PRINT "NO OF POINTS= "I
560 PRINT "NO OF NONZERO WEIGHTS= "J
570 PRINT "SUM OF WEIGHTS= "J1
580 PRINT "SUM OF VALUES= "I1
590 LET X2 = K1/J1
600 PRINT "WEIGHTED MEAN= "X2
610 PRINT "UNWEIGHTED MEAN= "I1/I
620 LET M1=0
630 LET M2=0
640 LET D(1)=X(1)-X2
650 LET A=1
660 GOSUB 2070
670 LET S=D(1)^2*W(1)
680 LET S1=D(1)
690 LET S2=D(1)^2
700 LET S3=D(1)^3
710 LET S4=D(1)^4
720 LET S5=0
730 LET S6=ABS(D(1))
740 LET X3=X(1)
750 LET X4=X(1)
760 FOR A = 2 TO I
770 IF X(A)>= X3 THEN 800
780 LET X3=X(A)
790 GOTO 820
800 IF X(A)<= X4 THEN 820
810 LET X4=X(A)
820 LET D(A)=X(A) - X2
830 GOSUB 2070
840 LET S=D(A)^2*W(A) +S
850 LET S5=(X(A)-X(A-1))^2 + S5
860 LET S1=A*D(A)+S1
870 LET S2=D(A)^2 +S2
880 LET S3=D(A)^3 + S3
890 LET S4=D(A)^4 + S4
900 LET S6=ABS(D(A))+S6
910 NEXT A
920 PRINT "MINIMUM VALUE="X3
930 PRINT "MAXIMUM VALUE= "X4
940 PRINT "WEIGHTED SUMS OF SQUARES= "L1
950 LET S = SQR(S/(J-1))
960 PRINT "VARIANCE= "S*S
970 PRINT "STANDARD DEVIATION= "S
980 PRINT "S.D. OF MEAN= "S/SQR(J1)
990 PRINT "RANGE= "X4-X3
1000 PRINT "COEFF. OF VARIANCE= "100*S/X2
1010 PRINT "STUDENT'S T= "X2*SQR(J1)/S
1020 LET S5 = S5/(I-1)
1030 PRINT "MEAN SQ. SUCCESSIVE DIFF.= "S5
1040 PRINT "MEAN SQ. SUCC. DIFF/VAR= "S5/S 2
1050 LET N=1
1060 LET N1=1
1070 LET K=1
1080 IF X(K)=X(K+1) THEN 1140
1090 IF X(K)>X(K+1) THEN 1120
1100 IF X(K+1)>X(K+2) THEN 1130
1110 GOTO 1140
1120 IF X(K+1)>=X(K+2) THEN 1140
1130 LET N=N+1
1140 IF D(K)=0 THEN 1240
1150 IF D(K)>0 THEN 1200
1160 IF D(K+1)<0 THEN 1240
1170 IF D(K+1)>0 THEN 1230
1180 IF D(K+2)<=0 THEN 1240
1190 GOTO 1230
1200 IF D(K+1)<0 THEN 1230
1210 IF D(K+1)>0 THEN 1240
1220 IF D(K+2)<=0 THEN 1240
1230 LET N1=N1+1
1240 LET K=K+1
1250 IF K<= I-2 THEN 1080
1260 IF X(I-1)=0 THEN 1320
1270 IF X(I-1)>0 THEN 1300
1280 IF X(I)<=0 THEN 1320
1290 GOTO 1310
1300 IF X(I)>0 THEN 1320
1310 LET N1=N1+1
1320 LET N2=(2*I-1)/3
1330 FOR J=1 TO I-1
1340 LET K=J+1
1350 FOR L=K TO I
1360 IF X(J)<=X(L) THEN 1400
1370 LET N3=X(J)
1380 LET X(J)=X(L)
1390 LET X(L)=N3
1400 NEXT L
1410 NEXT J
1420 IF I/2=INT(I/2) THEN 1460
1430 LET J=INT((I+1)/2)
1440 LET J=X(J)
1450 GOTO 1480
1460 LET J=INT(I/2)
1470 LET J=(X(J)+X(J+1))/2
1480 PRINT"MEDIAN= "J
1490 LET N3=SQR((16*I-29)/90)
1500 PRINT "NO OF RUNS UP AND DOWN= "N
1510PRINT "EXPECTED NO OF RUNS= "N2
1520 PRINT  "S.D. OF NO. OF RUNS= "N3
1530 LET K=1
1540 FOR J=1 TO 10
1550 LET D(100+J)=0
1560 NEXT J
1570 PRINT"DIFF./S.D. OF RUNS= "ABS(N-N2)/N3
1580 PRINT
1590 PRINT"  FREQUENCY DISTRIBUTION"
1600 LET M3=(X4-X3)/10
1610 LET M4=X3+M3
1620 FOR J=1 TO I
1630 IF X(J)<=M4 THEN 1690
1640 IF K>10 THEN 1700
1650 IF K=10 THEN 1690
1660 LET K=K+1
1670 LET M4=X3+K*M3
1680 IF X(J)>M4 THEN 1640
1690 LET D(100+K)=D(100+K)+1
1700 NEXT J
1710 FOR J=1 TO 10
1720 PRINT D(100+J);
1730 NEXT J
1740 PRINT
1750 PRINT
1760 PRINT " COMPUTATIONS ON DEVIATIONS"
1770 PRINT
1780 PRINT "NO OF + SIGNS IN DEVIATIONS= "M1
1790 PRINT "NO OF - SIGNS IN DEVIATIONS= "M2
1800 PRINT "NO OF SIGN CHANGES IN DEVIATIONS + 1= "N1+1
1810 LET M3 = 1+(2*M1*M2/I)
1820 LET M4=SQR(2*M1*M2*(2*M1*M2-M1-M2))/SQR((M1+M2)^2*(I-1))
1830 PRINT "EXPECTED NO OF RUNS= "M3
1840 PRINT"S.D. OF NO OF RUNS= "M4
1850 PRINT "DIFF./S.D. OF RUNS= "ABS(N1+1-M3)/M4
1860 LET T = 12*S1/(I 3-I)
1870 PRINT "TREND= "T
1880 LET M3 = SQR(12*S2/(I 3-I)-T 2)/(I-2)
1890 PRINT "S.D. OF TREND= "M3
1900 PRINT "TREND/S.D. OF TREND= "T/M3
1910 LET M3=(S3/I)^2/(S*S-S*S/I)^3
1920 LET M4=S4/(I*(S*S-S*S/I)^2)
1930 PRINT "BETA ONE= "M3
1940 PRINT"BETA TWO= "M4
1950 PRINT "MEAN DEVIATION= " ABS(S6)/I
1960 PRINT
1970 PRINT "  X","DEVIATIONS","  W(I)","ORDERED X"
1980 RESTORE
1990 READ N
2000 FOR I1=1 TO I
2010 READ X1
2020 IF N=0 THEN 2040
2030 READ S1
2040 PRINT X1,D(I1),W(I1),X(I1)
2050 NEXT I1
2060 STOP
2070 IF D(A)>=0 THEN 2100
2080 LET M2=M2+1
2090 GOTO 2110
2100 LET M1=M1+1
2110 RETURN
2120 END