1 3REM C O N L I M
  2 20 PRINT
  3 21 PRINT
  4 22 PRINT
  5 23 PRINT
  6 24 PRINT
  7 25 PRINT "CONLIM"
  8 26 PRINT
  9 27 PRINT
 10 28 PRINT
 11 29 REM NORMAL CURVE PROBABLILITES...KEEP 'EM HERE...DO NOT DELETE.
 12 30 DATA 5000000,5398278,5792597,6179114,6554217,6914625,7257469
 13 31 DATA 7580363,7881446,8159399,8413447,8643339,8849303,9031995
 14 32 DATA 9192433,9331928,9452007,9554345,9640697,9712834,9772499
 15 33 DATA 9821356,9860966,9892759,9918025,9937903,9953388,9965330
 16 34 DATA 9974449,9981342,9986501,9990324,9993129,9995166,9996631
 17 35 DATA 9997674,9998409,9998922,9999277,9999519,9999683,9999793
 18 36 DATA 9999867,9999915,9999946,9999966,9999979,9999987,9999992
 19 37 DIM X(49)
 20 38 DEF FNQ(V)=M+V*S
 21 39 DEF FND(V)=X(V)-X(V-1)
 22 40 DEF FNB(V)=U-V*(V-1)*(D2/(2*D1)+(V-2)*D3/(6*D1))
 23 41 DEF FNZ(V) = 1+(V^2+1)/(4*D)+((V^2+3)*(5*V^2+1))/(96*D^2)
 24 42 DATA 0,0,0
 25 50 DATA  1E20
 26 100 DATA 2,3,6,9,8,11,13,16,23,45,67,89,35,67,13,43,21,67,98,7,6
 27 200 DATA 3E33
 28 210 DATA .5,.75,.9,.95,.99,.999,.9999,.99999,1E38
 29 220 FOR I = 1 TO 49
 30 230 READ X(I)
 31 240 NEXT I
 32 250 READ I,S1,S2
 33 260 READ H
 34 270 LET I=I+1
 35 280 READ W
 36 290 IF W=3E33 THEN 330
 37 300 LET S1=S1+W
 38 310 LET S2=S2+W^2
 39 320 GOTO 270
 40 330 LET N=I-1
 41 340 PRINT
 42 350 PRINT "VALUES OF SAMPLE STATISTICS:"
 43 360 PRINT
 44 370 PRINT "   SIZE OF SAMPLE",N
 45 380 LET M=S1/N
 46 390 PRINT "   SAMPLE MEAN VALUE",M
 47 400 LET S8=S2/N-M^2
 48 410 LET D = N-1
 49 420 PRINT "   VARIANCE OF SAMPLE",S8
 50 430 PRINT "   SAMPLE STD DEVIATION",SQR(S8)
 51 440 LET S5=S8*N*(H-1)/(H*(N-1))
 52 450 PRINT "   ESTIMATED POPN STD DEV",SQR(S5)
 53 460 LET S6=S5*(H-N)/(N*(H-1))
 54 470 LET S=SQR(S6)
 55 480 PRINT "   STANDARD ERROR OF MEAN",S
 56 490 PRINT
 57 500 PRINT
 58 510 PRINT "CONFIDENCE LIMITS ON POPULATION MEAN:"
 59 520 PRINT
 60 530 PRINT "  CONF LEVEL","  LOWER LIM","   UPPER LIM"
 61 540 PRINT
 62 550 READ P
 63 560 IF P=1E38 THEN 9999
 64 570 LET A1 = 0.5*(1+P)
 65 580 GOSUB 610
 66 590 LET A3 = A2 * FNZ(A2)
 67 592 PRINT 100*P, FNQ(-A3), FNQ(A3)
 68 600 GOTO 550
 69 610 IF A1>0.5 THEN 660
 70 620 LET A1=1-A1
 71 630 GOSUB 700
 72 640 LET A2=-Q
 73 650 GOTO 680
 74 660 GOSUB 700
 75 670 LET A2=Q
 76 680 RETURN
 77 690 REM  REVERSE INTERPOLATION FOR STD NORMAL DEVIATE:
 78 700 LET Z=1E7*A1
 79 710 FOR I = 1 TO 46
 80 720 IF Z<X(I) THEN 740
 81 730 NEXT I
 82 740 LET D1 = FND(I)
 83 750 LET E1 = FND(I+1)
 84 760 LET D2=E1-D1
 85 770 LET D3 = FND(I+2) -E1 - D2
 86 780 LET U = (Z - X(I-1)) / D1
 87 790 LET Q = FNB(FNB(U))
 88 800 LET Q = .1*(Q+I-2)
 89 810 RETURN
 90 820 PRINT
 91 830 PRINT "THIS PROGRAM COMPUTES CONFIDENCE LIMITS FOR"
 92 840 PRINT "AN UNKNOWN POPULATION MEAN, BASED ON RANDOM"
 93 850 PRINT "SAMPLE DATA GIVEN.   TO USE, TYPE:"
 94 860 PRINT
 95 870 PRINT "   50  DATA  (SIZE OF POPULATION)"
 96 880 PRINT "      (OMIT THIS INPUT IF INFINITE POP'N)"
 97 890 PRINT "   100 DATA  X(1), X(2),.....,X(N)"
 98 900 PRINT
 99 910 PRINT "WHERE THE X(I) ARE THE SAMPLE OBSERVATIONS."
100 9999 END