Trailing-Edge
-
PDP-10 Archives
-
decus_20tap1_198111
-
decus/20-0025/statan.bas
There are 2 other files named statan.bas in the archive. Click here to see a list.
00010 GO TO 474
00100 DATA 4E37,3E33
00102 DIM X(100),W(100),D(110)
00103 PRINT "MODIFIED O5/29/68"
00104 PRINT
00105 PRINT
00106 PRINT "COMPUTATIONS ON THE DATA ARRAY:"
00107 PRINT
00108 READ N
00110 LET J=0
00112 LET I=1
00114 LET J1=0
00116 IF K=10 THEN 380
00118 LET I1=0
00120 LET K1=0
00122 LET L1=0
00124 READ X(I)
00126 IF X(I)=4E37 THEN 150
00128 LET W(I)=1
00130 IF N = 0 THEN 136
00132 READ W(I)
00134 IF W(I)=0 THEN 138
00136 LET J=J+1
00138 LET I=I+1
00140 LET I1 = X(I-1) + I1
00142 LET J1 = W(I-1) + J1
00144 LET K1 = W(I-1)*X(I-1) +K1
00146 LET L1=W(I-1)*X(I-1)^2 +L1
00148 GOTO 124
00150 LET I=I-1
00152 PRINT "NUMBER OF VALUES ="I
00154 PRINT "NUMBER OF NONZERO WEIGHTS =";J
00156 PRINT "SUM OF WEIGHTS =";J1
00158 PRINT "SUM OF UNWEIGHTED VALUES =";I1
00160 LET X2 = K1/J1
00162 PRINT "WEIGHTED MEAN =";X2
00164 PRINT "UNWEIGHTED MEAN =";I1/I
00166 LET M1=0
00168 LET M2=0
00170 LET D(1)=X(1)-X2
00172 LET A=1
00174 GOSUB 462
00176 LET S=D(1)^2*W(1)
00178 LET S1=D(1)
00180 LET S2=D(1)^2*W(1)
00182 LET S3=S2*D(1)
00184 LET S4=S3*D(1)
00186 LET S5=0
00188 LET S6=ABS(D(1))
00190 LET X3=X(1)
00192 LET X4=X(1)
00194 FOR A = 2 TO I
00196 IF X(A)>= X3 THEN 202
00198 LET X3=X(A)
00200 GOTO 206
00202 IF X(A)<= X4 THEN 206
00204 LET X4=X(A)
00206 LET D(A)=X(A) - X2
00208 GOSUB 462
00210 LET S = D(A)^2*W(A) + S
00211 LET V1=S/J1
00212 LET S5 = (X(A)-X(A-1))^2 + S5
00214 LET S1=A*D(A)+S1
00216 LET S2=D(A)^2*W(A)+S2
00218 LET S3=D(A)^3*W(A)+S3
00220 LET S4=D(A)^4*W(A)+S4
00222 LET S6=ABS(D(A))+S6
00223 NEXT A
00224 PRINT"STD DEVIATION OF SAMPLE =";SQR(V1)
00225 PRINT"SAMPLE VARIANCE =";V1
00226 PRINT "SMALLEST VALUE =";X3
00228 PRINT "LARGEST VALUE =";X4
00230 PRINT "RANGE =";X4-X3
00232 PRINT "WEIGHTED SUM OF SQUARES =";L1
00233 PRINT
00234 PRINT"NOTE: THE FOLLOWING MEASURES PERTAIN TO THE MOST-LIKELY"
00235 PRINT" ESTIMATES FOR THE TOTAL POPULATION"
00236 PRINT
00237 LET S=SQR(S/(J1-1))
00238 PRINT "VARIANCE =";S^2
00239 PRINT "STANDARD DEVIATION =";S
00240 PRINT "STANDARD ERROR OF MEAN =";S/SQR(J1)
00242 PRINT "COEFFICIENT OF VARIATION =";S/X2
00244 PRINT "STUDENT'S T =";X2*SQR(J1)/S
00246 LET S5 = S5/(I-1)
00248 PRINT "MEAN SQUARE SUCCESSIVE DIFFERENCES =";S5
00250 PRINT "(MEAN SQ SUCC DIFF)/(VARIANCE) =";S5/S^2
00252 LET N=1
00254 LET N1=1
00256 LET K=1
00258 IF X(K)=X(K+1) THEN 270
00260 IF X(K)>X(K+1) THEN 266
00262 IF X(K+1)>X(K+2) THEN 268
00264 GOTO 270
00266 IF X(K+1)>=X(K+2) THEN 270
00268 LET N=N+1
00270 IF D(K)=0 THEN 290
00272 IF D(K)>0 THEN 282
00274 IF D(K+1)<0 THEN 290
00276 IF D(K+1)>0 THEN 288
00278 IF D(K+2)<=0 THEN 290
00280 GOTO 288
00282 IF D(K+1)<0 THEN 288
00284 IF D(K+1)>0 THEN 290
00286 IF D(K+2)<=0 THEN 290
00288 LET N1=N1+1
00290 LET K=K+1
00292 IF K<= I-2 THEN 258
00294 IF X(I-1)=0 THEN 306
00296 IF X(I-1)>0 THEN 302
00298 IF X(I)<=0 THEN 306
00300 GOTO 304
00302 IF X(I)>0 THEN 306
00304 LET N1=N1+1
00306 LET N2=(2*I-1)/3
00308 FOR J=1 TO I-1
00310 LET K=J+1
00312 FOR L=K TO I
00314 IF X(J)<=X(L) THEN 322
00316 LET N3=X(J)
00318 LET X(J)=X(L)
00320 LET X(L)=N3
00322 NEXT L
00324 NEXT J
00326 IF I/2=INT(I/2) THEN 334
00328 LET J=INT((I+1)/2)
00330 LET J=X(J)
00332 GOTO 338
00334 LET J=INT(I/2)
00336 LET J=(X(J)+X(J+1))/2
00338 PRINT "MEDIAN =";J
00340 LET N3=SQR((16*I-29)/90)
00342 PRINT "NUMBER OF RUNS UP AND DOWN =";N
00344 PRINT "EXPECTED NUMBER OF RUNS =";N2
00346 PRINT "STD ERROR OF NUMBER OF RUNS =";N3
00348 LET K=1
00350 FOR J=1 TO 10
00352 LET D(100+J)=0
00354 NEXT J
00356 PRINT "(ACTUAL RUNS - EXP RUNS)/(STD ERR) =";ABS(N-N2)/N3
00358 PRINT
00360 PRINT "FREQUENCY DISTRIBUTION (TEN EQUAL CLASSES):"
00362 LET M3=(X4-X3)/10
00364 LET M4=X3+M3
00366 FOR J=1 TO I
00368 IF X(J)<=M4 THEN 380
00370 IF K>10 THEN 382
00372 IF K=10 THEN 380
00374 LET K=K+1
00376 LET M4=X3+K*M3
00378 IF X(J)>M4 THEN 370
00380 LET D(100+K)=D(100+K)+1
00382 NEXT J
00384 FOR J=1 TO 10
00386 PRINT D(100+J);
00388 NEXT J
00390 PRINT
00392 PRINT
00394 PRINT "COMPUTATIONS ON DEVIATIONS FROM MEAN:"
00396 PRINT
00398 PRINT "NUMBER OF + SIGNS IN DEVIATIONS =";M1
00400 PRINT "NUMBER OF - SIGNS IN DEVIATIONS =";M2
00402 PRINT "NUMBER OF RUNS (SIGN CHANGES + 1) =";N1+1
00404 LET M3 = 1+(2*M1*M2/I)
00406 LET M4 = SQR(2*M1*M2*(2*M1*M2-M1-M2))/SQR((M1+M2)^2*(I-1))
00408 PRINT "EXPECTED NUMBER OF RUNS =";M3
00410 PRINT "STD ERROR OF NUMBER OF RUNS =";M4
00412 PRINT "(ACTUAL RUNS - EXP RUNS)/(STD ERR) =";ABS(N1+1-M3)/M4
00414 LET T = 12*S1/(I^3-I)
00416 PRINT "TREND VALUE =";T
00418 LET M3 = SQR(12*S2/(I^3-I)-T^2)/(I-2)
00420 PRINT "STD ERROR OF TREND =";M3
00422 PRINT "(TREND)/(STD ERROR) =";T/M3
00424 LET M3=(S3/J1)^2/(S*S-S*S/J1)^3
00426 LET M4=(S4/J1)/(S*S-S*S/J1)^2
00428 PRINT "BETA ONE =";M3
00430 PRINT "BETA TWO =";M4
00432 PRINT "MEAN DEVIATION =";ABS(S6)/I
00434 PRINT
00436 PRINT "RECAPITULATION OF INPUT:"
00438 PRINT
00440 PRINT "VALUE","DEVIATIONS","WEIGHTS","ORDERED ARRAY"
00442 PRINT
00444 RESTORE
00446 READ N
00448 FOR I1=1 TO I
00450 READ X1
00452 IF N=0 THEN 456
00454 READ S1
00456 PRINT X1,D(I1),W(I1),X(I1)
00458 NEXT I1
00460 STOP
00462 IF D(A)>0 THEN 468
00463 IF D(A)=0 THEN 470
00464 LET M2=M2+1
00466 GOTO 470
00468 LET M1=M1+1
00470 RETURN
00472 STOP
00474 PRINT
00476 PRINT "ENTER DATA STARTING AT LINE 10. LIST THE"
00478 PRINT "FILE STATEX*** FOR DETAILED INSTRUCTIONS."
00480 END