10 PRINT "STUDENT'S T-DISTRIBUTION TEST"
20 PRINT
29 REM - LIMIT SAMPLE SIZE TO P(N,2) WHERE N=MAX. SAMPLE SIZE
30 DIM P(100,2)
40 DIM V(2),R(2),M(2),D(2)
50 PRINT "TEST 1: MEAN=X"
60 PRINT "TEST 2: MEAN=MEAN,STANDARD DEVIATION=STANDARD DEVIATION"
70 PRINT "TEST 3: MEAN=MEAN,STANDARD DEVIATION<>STANDARD DEVIATION"
80 PRINT "WHICH HYPOTHESIS";
90 INPUT T
100 PRINT
109 REM - INPUT 1 OR 2 SAMPLES DEPENDING ON HYPOTHESIS
110 FOR I=1 TO SGN(T-1)+1
120 V(I)=0
130 D(I)=0
140 PRINT "SAMPLE";I;":"
150 PRINT "   NUMBER OF ELEMENTS";
160 INPUT R(I)
170 FOR J=1 TO R(I)
180 PRINT "   ELEMENT";J;
190 INPUT P(J,I)
199 REM - ACCUMULATE SAMPLES
200 V(I)=V(I)+P(J,I)
210 D(I)=D(I)+P(J,I)[2
220 NEXT J
229 REM - COMPUTE INTERMEDIATE VALUES
230 M(I)=V(I)/R(I)
240 V(I)=(D(I)-V(I)[2/R(I))/(R(I)-1)
250 NEXT I
260 PRINT
270 IF T=2 THEN 340
280 IF T=3 THEN 380
289 REM - INPUT GIVEN VALUE FOR FIRST HYPOTHESIS
290 PRINT "VALUE OF MEAN";
300 INPUT M
309 REM - COMPUTE T AND DEGREES OF FREEDOM FOR FIRST HYPOTHESIS
310 A=(M(1)-M)*SQR(R(1)/V(1))
320 B=R(1)-1
330 GOTO 420
339 REM - COMPUTE T AND DEGREES OF FREEDOM FOR SECOND HYPOTHESIS
340 A=(M(1)-M(2))/SQR(1/R(1)+1/R(2))
350 B=R(1)+R(2)-2
360 A=A/SQR(((R(1)-1)*V(1)+(R(2)-1)*V(2))/B)
370 GOTO 420
379 REM - COMPUTE T AND DEGREES OF FREEDOM FOR THIRD HYPOTHESIS
380 A=(M(1)-M(2))/SQR(V(1)/R(1)+V(2)/R(2))
390 B=(V(1)/R(1)+V(2)/R(2))[2
400 B=B/((V(1)/R(1))[2/(R(1)+1)+(V(2)/R(2))[2/(R(2)+1))-2
410 B=INT(B+.5)
420 PRINT
430 PRINT "T-VALUE =";ABS(A)
440 PRINT "DEGREES OF FREEDOM =";B
450 END
