Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap1_198111 - decus/20-0025/bitest.bas
There are 2 other files named bitest.bas in the archive. Click here to see a list.
00100	PRINT
00110	PRINT "THIS PROGRAM MAKES THE NECESSARY CALCULATION FOR A"
00120	PRINT "STATISTICAL TEST OF A BINOMIAL PROPORTION.  WHAT"
00130	PRINT "ARE (SUCCESSES IN SAMPLE), N(SAMPLE SIE), P(THE"
00140	PRINT "POPULATION PROPORTION)";
00150	INPUT Y,N,P
00160	IF P<Y/N THEN 190
00170	LET T=Y
00180	GOTO 200
00190	LET T=Y-1
00200	GOSUB 340
00210	PRINT
00220	PRINT "IN SAMPLES OF SIE ";N;"RANDOMLY SELECTED FROM A"
00230	PRINT "BINOMIAL POPULATION HAVING A TRUE PROPORTION OF";P
00240	PRINT "THE PROBABILITY OF A SAMPLE HAVING ";Y;
00250	IF P<Y/N THEN 280
00260	PRINT "OR LESS"
00270	GOTO 300
00280	PRINT "OR MORE"
00290	LET Z=1-Z
00300	PRINT "SUCCESSESIS";
00305	IF Z<.5E-6 THEN 320
00310	PRINT 1E-6*INT(1E6*Z+.5)
00315	STOP
00320	PRINT " LESS THAN ONE IN A MILLION."
00330	STOP
00340	LET Q=1-P
00350	LET G=6*SQR(P*Q*N)
00360	LET S=INT(N*P-G)
00370	IF S>0 THEN 410
00380	LET S=0
00390	LET X=1
00400	GOTO 450
00410	LET X=P*N/S
00420	FOR I=1 TO S-1
00430	LET X=X*P*(N-I)/(S-I)
00440	NEXT I
00450	LET F=X*(Q^(N-S))
00460	LET Z=F
00470	FOR I=S+1 TO T
00480	LET F=F*P*(N-I+1)/(Q*I)
00490	LET Z=Z+F
00500	IF I>N*P+G THEN 520
00510	NEXT I
00520	RETURN
00530	END