Web pdp-10.trailing-edge.com

Trailing-Edge - PDP-10 Archives - decuslib20-01 - decus/20-0020/statnw.sta
There are 2 other files named statnw.sta in the archive. Click here to see a list.
```100'  NAME--STATNW
110'
120'  DESCRIPTION--COMPUTES 34 STATISTICAL MEASURES ON A STRING
130'  OF UNWEIGHTED NUMBERS.
140'
150'  SOURCE--MRS. CARLA G. MESSINA, NBS,SEPT. 9,1965. THE FORMULAS
160'  WERE TAKEN FROM THE N.B.S. HANDBOOK 101.
170'
180'  INSTRUCTIONS--PLACE DATA IN LINE 270 AND FOLLOWING.
190'  NO DATA SHOULD BE EQUAL TO -999999. THE PROGRAM COUNTS
200'  THE NUMBER OF POINTS FOR YOU. IF THERE ARE MORE THAN 500
210'  NUMBERS TO BE ENTERED, THE DIM STATEMENT IN LINE 280 SHOULD
220'  BE CHANGED.
230'
240'
250'  *  *  *  *  *  *  * MAIN PROGRAM   *  *  *  *  *  *  *  *  *  *
260'
270  DATA 79,101,83,116,78,114,87,134,84,124
280 DIM X(500),D(500)
290 PRINT " COMPUTATIONS ON THE X ARRAY"
300 PRINT
310 LET I=1
330 IF X(I)=-999999 THEN 410
340 LET J = J + 1
350 LET I = I + 1
360 LET I1 =X(I-1) + I1
370 LET J1 = 1 + J1
380 LET K1 = J1
390 LET L1=X(I-1)^2+L1
400 GOTO 320
410 LET I = I - 1
420 PRINT "NO. OF POINTS = "I
430 PRINT "SUM OF VALUES = "I1
440 LET X2 = I1/I
450 PRINT "UNWEIGHTED MEAN = "I1/I
460 LET M1 = 0
470 LET M2 = 0
480 LET D(1) = X(1)-X2
490 LET A = 1
500 GOSUB 1460
510 LET S=D(1)^2
520 LET S1 = D(1)
530 LET S2=D(1)^2
540 LET S3=D(1)^3
550 LET S4=D(1)^4
560 LET S5 = 0
570 LET S6 = ABS(D(1))
580 LET X3 = X(1)
590 LET X4 = X(1)
600 FOR A = 2 TO I
610 IF X(A)>=X3 THEN 640
620 LET X3 = X(A)
630 GOTO 660
640 IF X(A)<=X4 THEN 660
650 LET X4 = X(A)
660 LET D(A)=X(A)-X2
670 GOSUB 1460
680 LET S=D(A)^2+S
690 LET S5=(X(A)-X(A-1))^2 +S5
700 LET S1 = A*D(A) + S1
710 LET S2=D(A)^2 + S2
720 LET S3=D(A)^3 + S3
730 LET S4=D(A)^4 + S4
740 LET S6 = ABS(D(A)) + S6
750 NEXT A
760 PRINT "MINIMUM VALUE = "X3
770 PRINT "MAXIMUM VALUE = "X4
780 PRINT "SUMS OF SQUARES = "L1
790 LET S = SQR(S/(J-1))
800 PRINT "VARIANCE = "S*S
810 PRINT "STANDARD DEVIATION = "S
820 PRINT "S.D. OF MEAN = "S/SQR(J1)
830 PRINT "RANGE = "X4-X3
840 PRINT "COEFF. OF VARIANCE = "100*S/X2
850 PRINT "STUDENT'S T = "X2*SQR(J1)/S
860 LET S5 = S5/(I-1)
870 PRINT "MEAN SQ. SUCCESSIVE DIFF. = "S5
880 PRINT "MEAN SQ. SUCC. DIFF./VARIANCE = "S5/S 2
890 LET N = 1
900 LET N1 = 1
910 LET K = 1
920 IF X(K) = X(K+1) THEN 980
930 IF X(K)>X(K+1) THEN 960
940 IF X(K+1)>X(K+2) THEN 970
950 GOTO 980
960 IF X(K+1)>=X(K+2) THEN 980
970 LET N = N +1
980 IF D(K)=0 THEN 1060
990 IF D(K)>0 THEN 1030
1000 ON SGN(D(K+1))+2 GOTO 1060,1010,1050
1010 IF D(K+2)<=0 THEN 1060
1020 GOTO 1050
1030 ON SGN(D(K+1))+2 GOTO 1050,1040,1060
1040 IF D(K+2)<=0 THEN 1060
1050 LET N1 = N1 + 1
1060 LET K = K + 1
1070 IF K <= I-2 THEN 920
1080 ON SGN(X(I-1))+2 GOTO 1090,1130,1110
1090 IF X(I)<=0 THEN 1130
1100 GOTO 1120
1110 IF X(I)>0 THEN 1130
1120 LET N1 = N1 + 1
1130 LET N2 = (2*I-1)/3
1140 LET N3 = SQR((16*I-29)/90)
1150 PRINT "NO OF RUNS UP AND DOWN = "N
1160 PRINT "EXPECTED NO OF RUNS = "N2
1170 PRINT "S.D. OF NO. OF RUNS = "N3
1180 PRINT "DIFF./S.D. OF RUNS = "ABS(N-N2)/N3
1190 PRINT
1200 PRINT " COMPUTATIONS ON THE DEVIATIONS"
1210 PRINT
1220 PRINT "NO. OF + SIGNS IN DEVIATIONS = "M1
1230 PRINT "NO. OF - SIGNS IN DEVIATIONS = "M2
1240 PRINT "NO.  OF SIGN CHANGES IN DEVIATIONS = "N1
1250 LET M3 = 1 + (2*M1*M2/I)
1260 LET M4=SQR(2*M1*M2*(2*M1*M2-M1-M2))/SQR((M1+M2)^2*(I-1))
1270 PRINT "EXPECTED NO. OF RUNS = "M3
1280 PRINT "S.D. OF NO. OF RUNS = "M4
1290 PRINT "DIFF./S.D. OF RUNS = "ABS(N1+1-M3)/M4
1300 LET T = 12*S1/(I 3 - I)
1310 PRINT "TREND = "T
1320 LET M3 = SQR(ABS(12*S2/(I 3-I)-T 2))/(I-2)
1330 PRINT "S.D. OF TREND = "M3
1340 PRINT "TREND/S.D. OF TREND = "T/M3
1350 LET M3=(S3/I)^2/(S*S-S*S/I)^3
1360 LET M4=S4/(I*(S*S-S*S/I)^2)
1370 PRINT "BETA ONE = "M3
1380 PRINT "BETA TWO = "M4
1390 PRINT "MEAN DEVIATION = "ABS(S6)/I
1400 PRINT
1410 PRINT "   X(I)","   DEV(I)"
1420 FOR I1 = 1 TO I
1430 PRINT X(I1),D(I1)
1440 NEXT I1
1450 STOP
1460 IF D(A)>=0 THEN 1490
1470 LET M2 = M2 + 1
1480 GOTO 1500
1490 LET M1 = M1 + 1
1500 RETURN
1510 DATA -999999
1520 END

```