1 10 REM CONDIF  -- REV APRIL 1971
  2 11 DATA 5000000,5398278,5792597,6179114,6554217,6914625,7257469
  3 12 DATA 7580363,7881446,8159399,8413447,8643339,8849303,9031995
  4 13 DATA 9192433,9331928,9452007,9554345,9640697,9712834,9772499
  5 14 DATA 9821356,9860966,9892759,9918025,9937903,9953388,9965330
  6 15 DATA 9974449,9981342,9986501,9990324,9993129,9995166,9996631
  7 16 DATA 9997674,9998409,9998922,9999277,9999519,9999683,9999793
  8 17 DATA 9999867,9999915,9999946,9999966,9999979,9999987,9999992
  9 18 DIM X(49)
 10 19 DEF FNQ(V)=M3+V*R3
 11 20 DEF FND(V)=X(V)-X(V-1)
 12 21 DEF FNB(V)=U-V*(V-1)*(D2/(2*D1)+(V-2)*D3/(6*D1))
 13 22 DEF FNZ(V)=1+((V^2)+1)/(4*D)+(((V^2)+3)*(5*(V^2)+1))/(96*D^2)
 14 25 FOR I=1 TO 49
 15 30 READ X(I)
 16 35 NEXT I
 17 202 DATA 1E37
 18 203 DATA .5,.75,.9,.95,.99,.999,.9999,.99999,1E37
 19 204 READ H1,N1,M1,S1,H2,N2,M2,S2
 20 205 IF H1=1E37 THEN 352
 21 206 READ I
 22 207 IF H1<>0 THEN 210
 23 208 LET H1=1E20
 24 210 IF H2<>0 THEN 214
 25 212 LET H2=1E20
 26 214 LET M3=M1-M2
 27 216 LET T1=S1*SQR((N1*(H1-1))/(H1*(N1-1)))
 28 218 LET T2=S2*SQR((N2*(H2-1))/(H2*(N2-1)))
 29 220 LET R1=T1*SQR((H1-N1)/(N1*(H1-1)))
 30 222 LET R2=T2*SQR((H2-N2)/(N2*(H2-1)))
 31 224 LET R5=R1^2
 32 226 LET R6=R2^2
 33 228 LET R3=SQR(R5+R6)
 34 230 LET W=R5/(R5+R6)
 35 232 LET D=((N1-1)*(N2-1))/((N2-1)*W^2+(N1-1)*(1-W)^2)
 36 234 LET D=.1*INT(10*D+.5)
 37 236 PRINT
 38 238 PRINT "       STATISTIC    ","SAMPLE 1","SAMPLE 2"
 39 240 PRINT
 40 242 PRINT "SAMPLE MEAN         ",M1,M2
 41 244 PRINT "SAMPLE VARIANCE     ",S1^2,S2^2
 42 246 PRINT "SAMPLE STD DEVIATION",S1,S2
 43 248 PRINT "SAMPLE SIZE         ",N1,N2
 44 250 PRINT "POPULATION SIZE     ",
 45 252 IF H1<>1E20 THEN 258
 46 254 PRINT "INFINITE",
 47 256 GOTO 260
 48 258 PRINT H1,
 49 260 IF H2<>1E20 THEN 266
 50 262 PRINT "INFINITE"
 51 264 GOTO 268
 52 266 PRINT H2
 53 268 PRINT "ESTIM POPN STD DEV  ",T1,T2
 54 270 PRINT "STD ERROR OF MEAN   ",R1,R2
 55 272 PRINT
 56 274 PRINT "DIFF BETWEEN MEANS    ","         ";M3
 57 276 PRINT "STD ERROR OF DIFF     ","         ";R3
 58 278 PRINT "DEGR OF FREEDOM (DIFF)","         ";D
 59 280 PRINT
 60 282 PRINT
 61 284 PRINT "CONFIDENCE LIMITS ON DIFFERENCE BETWEEN MEANS:"
 62 286 PRINT
 63 288 PRINT "CONF LEVEL","LOWER LIM","UPPER LIM"
 64 290 PRINT
 65 292 READ P
 66 294 IF P=1E37 THEN 386
 67 296 LET A1=0.5*(1+P)
 68 298 GOSUB 310
 69 300 IF D=0 THEN 306
 70 302 REM  FNZ CONVERTS STUDENT'S T TO A NORMAL DEVIATE:
 71 304 LET A2=A2*FNZ(A2)
 72 306 PRINT 100*P,FNQ(-A2),FNQ(A2)
 73 308 GOTO 292
 74 310 IF A1>0.5 THEN 320
 75 312 LET A1=1-A1
 76 314 GOSUB 328
 77 316 LET A2=-Q
 78 318 GOTO 324
 79 320 GOSUB 328
 80 322 LET A2=Q
 81 324 RETURN
 82 326 REM  REVERSE INTERPOLATION FOR STD NORMAL DEVIATE:
 83 328 LET Z=1E7*A1
 84 330 FOR I=1 TO 46
 85 332 IF Z<X(I) THEN 336
 86 334 NEXT I
 87 336 LET D1=FND(I)
 88 338 LET E1=FND(I+1)
 89 340 LET D2=E1-D1
 90 342 LET D3=FND(I+2)-E1-D2
 91 344 LET U=(Z-X(I-1))/D1
 92 346 LET Q=FNB(FNB(U))
 93 348 LET Q=0.1*(Q+I-2)
 94 350 RETURN
 95 352 PRINT
 96 354 PRINT "THIS PROGRAM COMPUTES CONFIDENCE LIMITS FOR"
 97 356 PRINT "THE DIFFERENCE BETWEEN TWO POPULATION MEANS,"
 98 358 PRINT "BASED ON DATA SUPPLIED FOR TWO SAMPLES, ONE"
 99 360 PRINT "FROM EACH POPULATION.  TO USE, TYPE:"
100 362 PRINT
101 364 PRINT "   200 DATA  H1,N1,M1,S1, H2,N2,M2,S2"
102 366 PRINT "   RUN"
103 368 PRINT
104 370 PRINT "WHERE  H1 = SIZE OF POPULATION 1 (LET H1"
105 372 PRINT "             EQUAL ZERO IF POPN IS INFINITE)"
106 374 PRINT "       N1 = SIZE OF SAMPLE 1"
107 376 PRINT "       M1 = ARITHMETIC MEAN OF SAMPLE 1"
108 378 PRINT "       S1 = STANDARD DEVIATION OF SAMPLE 1"
109 380 PRINT "              (BASED ON DIVISOR OF N1)"
110 382 PRINT
111 384 PRINT "AND H2,N2,M2,S2 ARE THE SAME FOR SAMPLE 2."
112 386 END