home *** CD-ROM | disk | FTP | other *** search
Wrap
GW-BASIC | 1984-11-10 | 34.9 KB | 910 lines
5 REM STATLIB 2 LIBRARY v1.0 6 REM 10/16/84 10 CLS 20 WIDTH 80 30 KEY OFF 40 LOCATE 1,30 50 COLOR 0,7 60 PRINT " >>> STATLIB 2 <<< " 70 COLOR 7,0 80 LOCATE 3,24 90 PRINT "Volume Two -- Hypothesis Testing"; 100 COLOR 0,7 110 X$ = CHR$(186) 120 LOCATE 5,10,0 130 PRINT CHR$(201) + STRING$(59,205) + CHR$(187) 140 LOCATE 19,10 150 PRINT CHR$(200) + STRING$(59,205) + CHR$(188) 160 FOR W = 6 TO 18 170 LOCATE W,10 180 PRINT X$ 190 LOCATE W,70 200 PRINT X$ 210 NEXT 220 COLOR 0,15 230 COLOR 7,0 240 LOCATE 7,29 250 PRINT "Designed by Dale Benzer" 260 LOCATE 9,26 270 PRINT "Programmed by Peter Schlaifer" 280 LOCATE 11,37 290 PRINT "For" 300 LOCATE 13,25 310 PRINT "THE PC DISK LIBRARY OF SOFTWARE" 320 LOCATE 15,32 330 PRINT "Copyright 1984 " 340 LOCATE 17,26 350 PRINT "ZIFF-DAVIS PUBLISHING CO., INC." 360 LOCATE 22,26 370 PRINT "PRESS ANY KEY TO CONTINUE" 380 A$ = INKEY$ 390 IF A$ = "" THEN 380 400 LOCATE 22,26,0 410 PRINT SPACE$(40) 420 LOCATE 22,26 430 CLEAR ,,2500 440 PRINT "initializing STATLIB 2 ..." 1020 CLEAR ,,2500 'BEGIN 1030 REM:PRINT "initializing STATLIB 2..." 1040 GOSUB 1300 'init 1050 ON ERROR GOTO 1110 'error 1060 CLS 1070 GOSUB 2810 'wdraw 1080 MD=-1 1090 GOTO 4900 'main 1100 REM 1110 GOSUB 2990 'ERROR;putprompt 1120 PRINT "ERROR"STR$(ERR)" IN LINE"STR$(ERL); 1130 END 1140 PRINT ""; 1150 REM 1160 QT$=CHR$(34) 1170 KEY ON 1180 KEY 1,"LIST " 1190 KEY 2,"RUN"+CHR$(13) 1200 KEY 3,"LOAD"+CHR$(34) 1210 KEY 4,"SAVE"+CHR$(34) 1220 KEY 5,"CONT"+CHR$(13) 1230 KEY 6,","+CHR$(34)+"LPT:" 1240 KEY 7,"TRON"+CR$ 1250 KEY 8,"TROFF"+CR$ 1260 KEY 9,"KEY " 1270 KEY 10,"SCREEN 0,0,0"+CR$ 1280 CLS:KEY ON 1290 ON ERROR GOTO 0:END 1300 KEY OFF 'INIT 1310 FOR J = 1 TO 10:KEY J,"":NEXT 1320 LOCATE ,,0 1330 WIDTH 80 1340 DEFINT I,J,K,L,N 1350 I=0:J=0:K=0:L=0:P=0:Q=0:ARG=0:ARG1=0:ARG2=0:U=0:V=0 1360 X$="":Y$="":W$="":LIN$="":ARG$="" 1370 ESC$=CHR$(27):CR$=CHR$(13) 1380 RS$=CHR$(28):LS$=CHR$(29):US$=CHR$(30):DS$=CHR$(31) 1390 DEF FNK$(J)=CHR$(0)+CHR$(J) 1400 F1$=FNK$(59):F2$=FNK$(60):F3$=FNK$(61):F4$=FNK$(62):F5$=FNK$(63) 1410 ECMD$="F1 HELP F2 QUIT/RETURN F3 CONTINUE/SAVE F4 REDO F5 VIEW" 1420 NVARS=0:NDEFS=0:NSUBS=0:NCASE=0<UNK! {0009}> 1430 BPTR=0:FPTR=0:NPTR=0:MAXPTR=0<UNK! {0009}> 1440 F0=0:F1=0:F2=0:FF=0:VFLAG=0<UNK! {0009}> 1450 FCMD=0:CMD=0:CMD$=""<UNK! {0009}> 1460 FPROMPT$="":FTYP$="":FTYP=0 1470 ZPTR=0:JJ=0:CCASE=0:MD=0 1480 U1=0:U2=0:V1=0:V2=0:UHIGH=-1E+06:ULOW=1E+06:VLOW=ULOW:VHIGH=UHIGH 1490 MAIN=0:OPIN=1:SELS=2:TEST=3:MEAN1=4:MEAN2=5:VAR1=6:VAR2=7:EXIT=8 1500 HELP=1:QRET=2:QSAV=3:REDO=4:VYEW=5:ESC=-1 1510 FC=12<UNK! {0009}> 1520 FD=6<UNK! {0009}> 1530 FJ=4<UNK! {0009}> 1540 FL=12<UNK! {0009}> 1550 FW=FL*FJ<UNK! {0009}> 1560 NC=(FC+FD)*FJ<UNK! {0009}> 1570 FP=5<UNK! {0009}> 1580 FQ=2<UNK! {0009}> 1590 MAXLIN=FC<UNK! {0009}> 1600 MAXSTEPS=FL-4<UNK! {0009}> 1610 WUR=FP 1620 WUC=FQ 1630 WLR=WUR+1+FL+1+1 1640 WLC=80-FQ 1650 GOSUB 2660 'wclx 1660 FC$=SPACE$(FC)<UNK! {0009}> 1670 FD$=SPACE$(FD-3)<UNK! {0009}> 1680 FE$=SPACE$(FC+FD)<UNK! {0009}> 1690 FL$=SPACE$(NC) 1700 NFL$=STRING$(FQ+2,RS$)<UNK! {0009}> 1710 NW$=NL$+STRING$(FQ+2,RS$)<UNK! {0009}> 1720 FILSPEC$="":FILDESC$=""<UNK! {0009}> 1730 WBUF$=SPACE$(24)<UNK! {0009}> 1740 MAXBUF=127:BVARS=0:BUFSIZ=MAXBUF:GOSUB 3420 'setmax 1750 K=BVARS+MAXLBLS+1:DIM W$(K):FOR J = 1 TO K-1:W$(J)=FC$:NEXT 1760 DIM S(2,MAXSUBS+1)<UNK! {0009}> 1770 DIM T(15)<UNK! {0009}> 1780 DIM U(2,20)<UNK! {0009}> 1790 DIM V(MAXVARS+MAXDEFS+1)<UNK! {0009}> 1800 REM 'THDR 1810 DATA "TESTS OF ONE MEAN" 1820 DATA "TESTS OF TWO MEANS" 1830 DATA "TESTS OF ONE VARIANCE" 1840 DATA "TESTS OF TWO VARIANCES" 1850 RESTORE 1800 'thdr 1860 FOR J = 1 TO 4:READ THDR$(J):NEXT 1870 RETURN 1880 REM<UNK! {0009}>CONIO 1890 CLS:RETURN 'CLS 1900 LOCATE P,Q:RETURN 'PUTCURSOR 1910 X$=INKEY$:IF X$="" THEN 1910 'IN_FKEY;in_fkey 1920 IF X$>=" " OR X$=CR$ OR X$=CHR$(8) THEN RETURN 1930 IF X$=F1$ THEN GOSUB 4110:FCMD=HELP:RETURN 'fhelp 1940 IF X$=F2$ THEN FCMD=QRET:RETURN 1950 IF X$=F3$ THEN FCMD=QSAV:RETURN 1960 IF X$=F4$ THEN FCMD=REDO:RETURN 1970 IF X$=F5$ THEN GOSUB 4530:FCMD=VYEW:RETURN 'fview 1980 IF X$=ESC$ THEN FCMD=ESC:RETURN 1990 GOTO 1910 'in_fkey 2000 CMD=0 'GET_CMD 2010 FCMD=0 2020 PRINT " "; 2030 LOCATE,,1 2040 GOSUB 1910 'in_fkey 2050 LOCATE,,0 2060 IF FCMD THEN RETURN 2070 GOSUB 2430 'toupperx 2080 CMD=INSTR(CMD$,X$) 2090 IF CMD OR CMD$="" THEN RETURN 2100 PRINT LS$; 2110 GOTO 2000 'get_cmd 2120 GOSUB 2990:PRINT "ENTER YOUR CHOICE:"; 'GETCHOICE;putprompt 2130 GOSUB 2000:RETURN 'get_cmd 2140 PRINT " (Y/N)";:CMD$="YN" 'GETYESNO 2150 GOSUB 2000:RETURN 'get_cmd 2160 PRINT " <CR> TO CONTINUE"; 'GET_CR 2170 CMD$=CR$:GOSUB 2000 'get_cmd 2180 CMD=0:RETURN 2190 LIN$=SPACE$(MAXLIN) 'GETLIN 2200 J=0 2210 FCMD=0 2220 LOCATE,,1 2230 PRINT " "; 2240 GOSUB 2290 'getlin_ 2250 LOCATE,,0 2260 IF FCMD THEN J=0 2270 IF J THEN LIN$=LEFT$(LIN$,J) ELSE LIN$="" 2280 RETURN 2290 GOSUB 1910 'GETLIN_;in_fkey 2300 IF FCMD THEN RETURN 2310 IF X$>=" " THEN PRINT X$;:GOSUB 2350:GOTO 2290 'addchar;getlin_ 2320 IF X$=CHR$(8) THEN PRINT LS$;" ";LS$;:GOSUB 2390:GOTO 2290'delchar;getlin_ 2330 IF X$=CHR$(13) THEN RETURN 2340 GOTO 2290 'getlin_ 2350 IF J>MAXLIN-1 THEN RETURN 'ADDCHAR 2360 J=J+1 2370 MID$(LIN$,J)=X$ 2380 RETURN 2390 IF J<1 THEN RETURN 'DELCHAR 2400 MID$(LIN$,J)=" " 2410 J=J-1 2420 RETURN 2430 IF X$="" THEN RETURN 'TOUPPERX 2440 J=ASC(X$):IF J>96 AND J<123 THEN J=J-32 2450 X$=CHR$(J):RETURN 2460 IF X$="" THEN RETURN 'TOLOWERX 2470 J=ASC(X$):IF J>64 AND J<91 THEN J=J+32 2480 X$=CHR$(J):RETURN 2490 P=1:Q=1:GOSUB 3010 'PUTCHDR;el 2500 Q=40-LEN(X$)\2-5:GOSUB 1900 'putcursor 2510 COLOR 0,7 2520 PRINT ">>> ";X$;" <<<"; 2530 COLOR 7,0 2540 RETURN 2550 P=FP-1:Q=40:GOSUB 1900:PRINT SPACE$(40-FQ); 'PUTRHDR;putcursor 2560 Q=80-FQ-LEN(X$):GOSUB 1900:PRINT X$;:RETURN 'putcursor 2570 P=FP-1:Q=FQ+1:GOSUB 1900:PRINT SPACE$(40-FQ-1) 'PUTLHDR;putcursor 2580 GOSUB 1900:PRINT X$;:RETURN 'putcursor 2590 X$=FILSPEC$ 'PUTFILSPEC 2600 IF X$="" THEN X$="NO FILE OPENED":GOSUB 2570:X$="":GOSUB 2550:RETURN'putlhdr;putrhdr 2610 IF FILDESC$<>"" THEN X$=X$+"/"+FILDESC$ 2620 X$="FILE: "+X$:GOSUB 2570 'putlhdr 2630 X$="NO":IF NCASE<>0 THEN X$=STR$(NCASE) 2640 IF NCASE<>1 THEN X$=X$+" CASES ENTERED":GOSUB 2550:RETURN'putrhdr 2650 X$="1 CASE ENTERED":GOSUB 2550:RETURN 'putrhdr 2660 REM 'WCLX 2670 DATA 85,184,0,6,183,7,185,0,0,186,0,0,205,16,93,203 2680 WCLX$=SPACE$(16) 2690 J=VARPTR(WCLX$) 2700 WCLX!=PEEK(J+1)+256*PEEK(J+2) 2710 RESTORE 2660 'wclx 2720 FOR J = 1 TO 16 2730 READ K 2740 MID$(WCLX$,J)=CHR$(K) 2750 NEXT 2760 MID$(WCLX$,8)=CHR$(WUC) 2770 MID$(WCLX$,9)=CHR$(WUR) 2780 MID$(WCLX$,11)=CHR$(WLC-2) 2790 MID$(WCLX$,12)=CHR$(WLR-2) 2800 RETURN 2810 COLOR 0,7 'WDRAW 2820 LOCATE WUR,WUC 2830 PRINT CHR$(201); 2840 PRINT STRING$(WLC-WUC-1,205); 2850 PRINT CHR$(187); 2860 FOR J = WUR+1 TO WLR-1 2870 LOCATE J,WUC:PRINT CHR$(186); 2880 LOCATE J,WLC:PRINT CHR$(186); 2890 NEXT 2900 LOCATE WLR,WUC 2910 PRINT CHR$(200); 2920 PRINT STRING$(WLC-WUC-1,205); 2930 PRINT CHR$(188) 2940 COLOR 7,0 2950 RETURN 2960 P=21:Q=FQ+2:GOSUB 3010 'PUTFTR;el 2970 Q=40-LEN(X$)\2:GOSUB 1900 'putcursor 2980 PRINT X$;:RETURN 2990 P=23:Q=FQ+2:GOSUB 3010:RETURN 'PUTPROMPT;el 3000 GOSUB 2160:RETURN 'PUTMSG;get_cr 3010 GOSUB 1900:PRINT SPACE$(79-Q);:GOSUB 1900:RETURN 'EL;putcursor;putcursor 3020 CALL WCLX! 'CLF 3030 P=FP+2:Q=FQ+3 'HOMEFL 3040 GOSUB 1900; 'putcursor 3050 RETURN 3060 GOSUB 3020 'PUTFL;clf 3070 IF F2=F0-1 THEN PRINT "NOTHING ENTERED":RETURN 3080 F1=FW*(F1\FW):IF F1>(F2-F0+1) OR F1<0 THEN F1=0 3090 K=0 3100 FOR J=F0+F1 TO F2 3110 LSET FD$=MID$(STR$(J-F0+1),2) 3120 PRINT F$FD$": "W$(J); 3130 K=K+1 3140 IF K MOD FJ = 0 THEN PRINT:PRINT NFL$; 3150 NEXT 3160 RETURN 3170 GOSUB 3020 'PUTDATA;clf 3180 READ X$ 'PUTDATA_ 3190 IF X$="" THEN RETURN 3200 PRINT X$:PRINT NFL$; 3210 GOTO 3180 'putdata_ 3220 REM<UNK! {0009}>FILE routines 3230 FCMD=0:ON ERROR GOTO 3360 'LOAD_STL;open_error 3240 GOSUB 2990: PRINT "LOADING "+FILNAM$; 'putprompt 3250 FILTYP=1:OPEN "I",#1,FILSPEC$+".STL" 3260 INPUT #1,FILNAM$,FILDESC$,BUFSIZ:GOSUB 3420 'setmax 3270 INPUT #1,NVARS,NDEFS,NSUBS,NCASE 3280 FOR J = 1 TO NVARS:INPUT #1,X$:LSET W$(BVARS+J)=X$:NEXT 3290 FOR J = 1 TO NDEFS:INPUT #1,X$:LSET W$(BDEFS+J)=X$:NEXT 3300 FOR J = 1 TO NSUBS:INPUT #1,X$:LSET W$(BSUBS+J)=X$:NEXT 3310 CLOSE #1:GOSUB 2590:CCASE=0 'putfilspec 3320 FILTYP=2:OPEN "R",#1,FILSPEC$+".DAT",BUFSIZ 3330 FIELD#1,BUFSIZ AS CB$ 3340 ON ERROR GOTO 1110 'OPEN_RESUME;error 3350 RETURN 3360 GOSUB 2990 'OPEN_ERROR;putprompt 3370 PRINT "CAN'T OPEN ";FILSPEC$; 3380 IF FILTYP=1 THEN PRINT ".STL"; ELSE PRINT ".DAT"; 3390 GOSUB 2160 'get_cr 3400 FILSPEC$="":CLOSE:FCMD=REDO 3410 RESUME 3340 'open_resume 3420 MAXVARS=BUFSIZ:MAXDEFS=BUFSIZ\4:MAXSUBS=BUFSIZ 'SETMAX 3430 MAXLBLS=MAXVARS+MAXDEFS+MAXSUBS 3440 BDEFS=BVARS+MAXVARS:BSUBS=BDEFS+MAXDEFS:BVALS=BSUBS+MAXSUBS 3450 RETURN 3460 CCASE=0 'READ_CASEFILE 3470 UFLAG=U(1,0)<UNK! {0009}> 3480 U(0,3)=0:U(1,3)=0<UNK! {0009}> 3490 U(0,4)=0:U(1,4)=0<UNK! {0009}> 3500 U(0,5)=0:U(1,5)=0<UNK! {0009}> 3510 SJ=0 3520 GOSUB 2990 'putprompt 3530 NX=CSRLIN 3540 PRINT "SELECTED CASE ON SELECT "; 3550 NY=POS(0) 3560 WHILE CCASE<NCASE 3570 CCASE=CCASE+1 3580 GOSUB 3710 'sel_case 3590 IF UFLAG THEN SJ=1:GOSUB 3710:SJ=0 'sel_case 3600 WEND 3610 GOSUB 3640 'sample_stat 3620 IF UFLAG THEN SJ=1:GOSUB 3640:SJ=0 'sample_stat 3630 RETURN 3640 J=U(SJ,3):IF J=0 THEN RETURN 3650 U=(U(SJ,5)-((U(SJ,4)*U(SJ,4))/J))/(J-1) 3660 U(SJ,4)=U(SJ,4)/J 3670 U(SJ,5)=U<UNK! {0009}> 3680 U(SJ,6)=SQR(U)<UNK! {0009}> 3690 U(SJ,7)=SQR(U/J)<UNK! {0009}> 3700 RETURN 3710 SEL=1:GET#1,CCASE*4 'SEL_CASE 3720 FOR J = 1 TO S(SJ,0) 3730 IF MID$(CB$,S(SJ,J),1)="0" THEN SEL=0:J=S(SJ,0) 3740 NEXT 3750 IF SEL=0 THEN RETURN 3760 LOCATE NX,NY-15:PRINT USING "####";CCASE 3770 LOCATE NX,NY:PRINT USING "#";SJ+1; 3780 GOSUB 3840 'load_case 3790 U(SJ,3)=U(SJ,3)+1<UNK! {0009}> 3800 V=V(U(SJ,0))<UNK! {0009}> 3810 U(SJ,4)=U(SJ,4)+V<UNK! {0009}> 3820 U(SJ,5)=U(SJ,5)+V*V<UNK! {0009}> 3830 RETURN 3840 IF V(0)=CCASE THEN RETURN 'LOAD_CASE 3850 GET#1,CCASE*4-3:X$=CB$:GET#1:X$=X$+CB$ 3860 FOR J = 1 TO NVARS:V(BVARS+J)=CVI(MID$(X$,J+J-1)):NEXT 3870 GET#1:FOR J = 1 TO NDEFS:V(BDEFS+J)=CVS(MID$(CB$,J*4-3)):NEXT 3880 V(0)=CCASE 3890 RETURN 3900 REM<UNK! {0009}>INPUT ROUTINES 3910 GOSUB 3970:IF FCMD THEN RETURN 'GETFILSPEC;getfilnam 3920 GOSUB 4030:IF FCMD=QRET THEN RETURN 'getfildrv 3930 IF FCMD THEN 3910 'getfilspec 3940 CLOSE 3950 IF FILDRV$<>"" THEN FILSPEC$=FILDRV$+":"+FILNAM$ ELSE FILSPEC$=FILNAM$ 3960 RETURN 3970 GOSUB 2990:PRINT "ENTER FILENAME"; 'GETFILNAM;putprompt 3980 MAXLIN=8:GOSUB 2190 'getlin 3990 IF FCMD=HELP OR FCMD=VYEW THEN 3970 'getfilnam 4000 IF FCMD THEN RETURN 4010 IF LIN$<>"" THEN FILNAM$=LIN$ 4020 RETURN 4030 GOSUB 2990:PRINT "ON DRIVE"; 'GETFILDRV;putprompt 4040 CMD$="ABCD "+CR$:GOSUB 2000 'get_cmd 4050 IF FCMD=HELP OR FCMD=VYEW THEN 4030 'getfildrv 4060 IF FCMD THEN RETURN 4070 IF CMD<5 THEN FILDRV$=MID$(CMD$,CMD,1) ELSE IF CMD=5 THEN FILDRV$="" 4080 RETURN 4090 GOSUB 2990:PRINT "FILE MUST BE FIRST OPENED FROM MAIN MENU";'OPENFILEMSG;putprompt 4100 GOSUB 2160:RETURN 'get_cr 4110 IF MD=MAIN THEN RESTORE 4240 'FHELP;main_help 4120 IF MD=OPIN THEN RESTORE 4290 'open_help 4130 IF MD=SELS THEN RESTORE 4320 'sels_help 4140 IF MD=TEST THEN RESTORE 4350 'test_help 4150 IF MD=MEAN1 THEN RESTORE 4380 'mean1_help 4160 IF MD=MEAN2 THEN RESTORE 4380 'mean2_help 4170 IF MD=VAR1 THEN RESTORE 4440 'var1_help 4180 IF MD=VAR2 THEN RESTORE 4440 'var2_help 4190 IF MD=EXIT THEN RESTORE 4500 'exit_help 4200 GOSUB 3170 'putdata 4210 GOSUB 2990 'putprompt 4220 GOSUB 2160 'get_cr 4225 GOSUB 3020 4226 FCMD=HELP 4230 RETURN 4240 REM 'MAIN_HELP 4250 DATA"MAIN HELP SCREEN":DATA" ":DATA"OPEN a file to begin.":DATA" ":DATA"All subsets specified are selected upon entry. Thus, choosing option":DATA"4 (Print Selected Cases) will print only those cases which satisfy 4251 DATA"all the subsets. You may de-select subsets with option 2 (Select":DATA"Subsets).":DATA" ":DATA"Each of the Menu options has its own HELP screen. Use F1 at any time":DATA"to call a screen.":DATA" 4260 DATA " " 4270 DATA "Called from main menu and/or with F1" 4280 DATA "" 4290 REM 'OPEN_HELP 4300 DATA"OPEN HELP SCREEN":DATA" ":DATA"Opening a file will allow you to run the descriptive statistics":DATA"routines included in this volume. ":DATA" ":DATA"No filename extension should be included at the filename prompt.":DATA" 4301 DATA"After a file is opened, the variable labels are displayed and the":DATA"and the program will return to the Main Menu.":DATA" 4310 DATA "" 4320 REM 'SELS_HELP 4330 DATA"SELECT HELP SCREEN":DATA" ":DATA"This option allows you to choose which of the subsets you wish to":DATA"use. (D)eleting or (C)learing subsets does NOT erase them from the 4331 DATA"disk file, but merely de-selects them. Try (C)learing, and then":DATA"(E)ntering s1. After a (C)lear you may (E)nter as many of the subsets":DATA"as you wish, or use (A)ll to re-select all subsets.":DATA" 4332 DATA"Remember, REJIF0 will reject a case if ANY of the values of that case":DATA"are zero. Use a specific subset i.e., x1>0 to reject zero values for":DATA"a specific variable.":DATA" ":DATA"Use F2 or F3 to return to the menu after Selecting. 4333 DATA " " 4340 DATA "" 4350 REM 'TEST_HELP 4360 DATA "MAIN TEST HELP SCREEN" :DATA " " 4361 DATA "Make certain your subsets are selected correctly.":DATA " " 4362 DATA "Make a test choice from the Menu.":DATA " " 4363 DATA "If the population standard deviation is known" 4364 DATA "the test will make use of that number, else" 4365 DATA "the sample std. dev. will be calculated and used.":DATA " " 4366 DATA "See the HELP screens for the individual tests" 4367 DATA "for more information." 4370 DATA "" 4380 REM 'MEAN1_HELP 4390 DATA "MEANS TEST HELP SCREEN":DATA " " 4391 DATA "If the population std.dev is input, the test" 4392 DATA "will be based on the normal test statistic." 4393 DATA "Otherwise, a student's t will be used.":DATA " " 4394 DATA "The program will display a significance level" 4395 DATA "which should be interpreted as the level at" 4396 DATA "which your null hypothesis should be rejected." 4400 DATA "" 4410 REM 'MEAN2_HELP 4420 DATA "F1 2 MEANS HELP SCREEN" 4430 DATA "" 4440 REM 'VAR1_HELP 4450 DATA "VARIANCE TEST HELP SCREEN":DATA " " 4451 DATA "The single variance test uses the standard" 4452 DATA "chi-square statistic." 4453 DATA "The two variance test is designed to be used" 4454 DATA "to test a variance ratio. It uses the formula" 4455 DATA "F=(first sample variance/second sample variance)" 4456 DATA "multiplied by 1/your test ratio (usually 1)" 4460 DATA "" 4470 REM 'VAR2_HELP 4480 DATA "F1 2 VARIANCES HELP SCREEN" 4490 DATA "" 4500 REM 'EXIT_HELP 4510 DATA"EXIT HELP SCREEN":DATA" ":DATA"Exiting the program will return you to BASIC with all functions ":DATA"restored.":DATA" 4520 DATA "" 4530 CMD$="LDS12UWR" 'FVIEW 4540 IF FF<1 OR FF>3 THEN FF=1:F1=0:VFLAG=0 4550 GOSUB 2990 'FVIEW_;putprompt 4560 PRINT "(L)ABELS (D)EFS (S)UBS SEL(1) SEL(2) (U)P DO(W)N (R)ETURN"; 4570 GOSUB 2000 'get_cmd 4580 IF CMD=8 OR FCMD THEN FCMD=VYEW:RETURN 4590 ON CMD GOSUB 4670,4680,4690,4610,4620,4630,4650 'lbl_key;def_key;sub_key;sel1_key;sel2_key;up_key;down_key 4600 GOTO 4550 'fview_ 4610 SJ=0:FF=4:GOSUB 5650:RETURN 'SEL1_KEY;sel_key 4620 SJ=1:FF=5:GOSUB 5650:RETURN 'SEL2_KEY;sel_key 4630 F1=F1-FW:IF FF<4 THEN GOSUB 3060:RETURN 'UP_KEY;putfl 4640 GOSUB 5650:RETURN 'sel_key 4650 F1=F1+FW:IF FF<4 THEN GOSUB 3060:RETURN 'DOWN_KEY;putfl 4660 GOSUB 5650:RETURN 'sel_key 4670 FF=1:F0=BVARS:F2=F0+NVARS:F0=F0+1:F$="x":GOSUB 3060:RETURN'LBL_KEY;putfl 4680 FF=2:F0=BDEFS:F2=F0+NDEFS:F0=F0+1:F$="d":GOSUB 3060:RETURN'DEF_KEY;putfl 4690 FF=3:F0=BSUBS:F2=F0+NSUBS:F0=F0+1:F$="s":GOSUB 3060:RETURN'SUB_KEY;putfl 4700 F0=BVARS+MAXLBLS:F2=F0+NVARS:F0=F0+1:F$="x":GOSUB 3060:RETURN'LBL_VAL;putfl 4710 F0=BDEFS+MAXLBLS:F2=F0+NDEFS:F0=F0+1:F$="d":GOSUB 3060:RETURN'DEF_VAL;putfl 4720 F0=BSUBS+MAXLBLS:F2=F0+NSUBS:F0=F0+1:F$="s":GOSUB 3060:RETURN'SUB_VAL;putfl 4730 F0=BPTR+1:F1=FPTR-BPTR:F2=NPTR:F$=FTYP$:GOSUB 3060:RETURN'CUR_KEY;putfl 4740 REM<UNK! {0009}>MAIN 4750 REM 'MAIN_DATA 4760 DATA "STATLIB 2 LIBRARY" 4770 DATA "12345" 4780 DATA " " 4790 DATA " " 4800 DATA " 1 OPEN DATA FILE" 4810 DATA " " 4820 DATA " 2 SELECT SUBSETS" 4830 DATA " " 4840 DATA " 3 HYPOTHESIS TESTING" 4850 DATA " " 4860 DATA " 4 HELP" 4870 DATA " " 4880 DATA " 5 EXIT PROGRAM" 4890 DATA "" 4900 RESTORE 4750:READ X$:READ CMD$ 'MAIN;main_data 4910 GOSUB 2490:GOSUB 2590:GOSUB 3170 'putchdr;putfilspec;putdata 4920 IF MD=-1 THEN X$=ECMD$:GOSUB 2960 'putftr 4930 MD=MAIN:GOSUB 2120:IF CMD=5 THEN 4960 'getchoice;exit 4940 ON CMD GOSUB 5060,5260,6230,5040 'open;sels;test;help 4950 GOTO 4900 'main 4960 MD=EXIT:GOSUB 2990 'EXIT;putprompt 4970 PRINT "DO YOU WANT TO TEST ANOTHER FILE"; 4980 GOSUB 2140:IF X$="Y" THEN 4900 'getyesno;main 4990 CLOSE:FILSPEC$="" 5000 FOR J = 1 TO 500:NEXT 5010 GOSUB 2990:PRINT "GOODBYE..." 'putprompt 5020 FOR J = 1 TO 2200:NEXT 5030 GOTO 1140 '_exit 5040 GOSUB 4110:RETURN 'HELP;fhelp 5050 REM<UNK! {0009}>OPEN module 5060 MD=OPIN:X$="OPEN FILE":GOSUB 2490 'OPEN;putchdr 5070 GOSUB 3910:IF FCMD=QRET OR FCMD=ESC THEN RETURN 'getfilspec 5080 IF FCMD THEN 5060 'open 5090 GOSUB 3230:IF FCMD THEN 5060 'load_stl;open 5100 GOSUB 4670:GOSUB 2990:GOSUB 2160 'lbl_key;putprompt;get_cr 5110 FOR J = 1 TO NSUBS:S(0,J)=0:S(1,J)=0:NEXT:S(0,0)=0:S(1,0)=0:SVEC=0 5120 IF NCASE=0 THEN GOSUB 2990:PRINT "N0 CASES ENTERED";:GOSUB 2160'putprompt;get_cr 5130 RETURN 5140 REM<UNK! {0009}>SELECT module 5150 REM 'SELS_DATA 5160 DATA "SELECT SUBSET DEFINITIONS" 5170 DATA "123" 5180 DATA " " 5190 DATA " " 5200 DATA " 1 SELECT SUBSETS FOR 1ST VARIABLE" 5210 DATA " " 5220 DATA " 2 SELECT SUBSETS FOR 2ND VARIABLE" 5230 DATA " " 5240 DATA " 3 RETURN TO MAIN MENU" 5250 DATA "" 5260 IF FILSPEC$="" THEN GOSUB 4090:RETURN 'SELS;openfilemsg 5270 MD=SELS:RESTORE 5150:READ X$,CMD$ 'sels_data 5280 GOSUB 2490:IF NSUBS=0 THEN GOTO 5340 'putchdr;sels0 5290 GOSUB 3170:GOSUB 2120 'putdata;getchoice 5300 IF FCMD=VYEW OR FCMD=HELP THEN GOTO 5260 'sels 5310 IF FCMD OR CMD=3 THEN RETURN 5320 SVEC=CMD-1:GOSUB 5370 'sels_loop 5330 GOTO 5260 'sels 5340 GOSUB 3020:PRINT "NO SUBSETS HAVE BEEN DEFINED" 'SELS0;clf 5350 GOSUB 2990:GOSUB 2160 'putprompt;get_cr 5360 RETURN 5370 SJ=SVEC:GOSUB 5650:GOSUB 2990 'SELS_LOOP;sel_key;putprompt 5380 PRINT "(D)ELETE (E)NTER (C)LEAR (A)LL"; 5390 CMD$="DECA":GOSUB 2000 'get_cmd 5400 IF FCMD=QRET OR FCMD=QSAV OR FCMD=ESC THEN RETURN 5410 IF FCMD THEN 5370 'sels_loop 5420 ON CMD GOSUB 5440,5480,5510,5520 'sel_del;sel_add;sel_clr;sel_all 5430 GOTO 5370 'sels_loop 5440 GOSUB 5540:IF FCMD<>0 THEN RETURN 'SEL_DEL;get_sel 5450 IF SELJ=0 THEN GOSUB 2990:PRINT "SUBSET NOT SELECTED";:GOSUB 2160:GOTO 5440'putprompt;get_cr;sel_del 5460 FOR J = SELJ TO S(SVEC,0)-1:S(SVEC,J)=S(SVEC,J+1):NEXT 5470 S(SVEC,0)=S(SVEC,0)-1:RETURN 5480 GOSUB 5540:IF FCMD THEN RETURN 'SEL_ADD;get_sel 5490 IF SELJ<>0 THEN GOSUB 2990:PRINT "DUPLICATE SUBSET";:GOSUB 2160:GOTO 5480'putprompt;get_cr;sel_add 5500 J=S(SVEC,0)+1:S(SVEC,J)=SEL:S(SVEC,0)=J:RETURN 5510 S(SVEC,0)=0:RETURN 'SEL_CLR 5520 FOR J = 1 TO NSUBS:S(SVEC,J)=J:NEXT 'SEL_ALL 5530 S(SVEC,0)=NSUBS:RETURN 5540 GOSUB 2990 'GET_SEL;putprompt 5550 IF NSUBS=0 THEN PRINT "NO SUBSETS DEFINED":GOSUB 2160:FCMD=QRET:RETURN'get_cr 5560 PRINT "ENTER SUBSET NUMBER"; 5570 MAXLIN=3:GOSUB 2190:IF FCMD THEN RETURN 'getlin 5580 SEL=VAL(LIN$):IF SEL>=1 AND SEL<=NSUBS THEN 5610 'get_sel_ 5590 GOSUB 2990:PRINT "BAD SUBSET NUMBER"; 'putprompt 5600 GOSUB 2160:GOTO 5540 'get_cr;get_sel 5610 SELJ=0:FOR J = 1 TO S(SVEC,0) 'GET_SEL_ 5620 IF SEL=S(SVEC,J) THEN SELJ=J:J=S(SVEC,0) 5630 NEXT:RETURN 5640 REM DISPLAY SELECT VECTOR 5650 GOSUB 3020 'SEL_KEY;clf 5660 PRINT "SELECT VECTOR";SJ+1 5670 PRINT:PRINT NFL$; 5680 K=S(SJ,0):IF K=0 THEN PRINT "ALL CASES WILL BE SELECTED":RETURN 5690 L=0 5700 IF F1<1 OR F1>K THEN F1=1 5710 F2=F1+FW:IF F2>K THEN F2=K 5720 FOR J = F1 TO F2 5730 JJ=S(SJ,J) 5740 LSET FD$=MID$(STR$(JJ),2) 5750 PRINT "s"FD$": "W$(BSUBS+JJ); 5760 L=L+1 5770 IF L MOD FJ = 0 THEN PRINT:PRINT NFL$; 5780 NEXT 5790 RETURN 5800 REM<UNK! {0009}>GET_ARG 5810 GOSUB 2990:PRINT PROMPT$; 5815 MAXLIN=4:GOSUB 2190 'GET_ARG;getlin 5820 IF FCMD THEN RETURN 5830 IF LIN$="" THEN GOTO 5810 'get_arg 5840 G1=1:G2=LEN(LIN$):GOSUB 5860 'scanarg 5850 RETURN 5860 FOR ARGPTR = G1 TO G2 'SCANARG 5870 X$=MID$(LIN$,ARGPTR,1):GOSUB 2460 'tolowerx 5880 K=INSTR("xd",X$) 5890 IF K>0 THEN GOSUB 5940:ARGPTR=G2 'scanarg_ 5900 NEXT 5910 IF K THEN RETURN 5920 LIN$="":GOSUB 2990:PRINT "BAD ARGUMENT";:GOSUB 2160 'putprompt;get_cr 5930 RETURN 5940 IF ARGPTR=G2 THEN K=0:RETURN 'SCANARG_ 5950 ARGPTR=ARGPTR+1:U=VAL(MID$(LIN$,ARGPTR)) 5960 L=NVARS:IF K=2 THEN L=NDEFS 5970 IF U<1 OR U>L THEN K=0:RETURN 5980 ARG$=X$+MID$(STR$(U),2) 5990 FPTR=BVARS+U+(K-1)*MAXVARS 6000 RETURN 6010 LOCATE FP+1+P,FQ+2+Q 'PUT_WCUR 6020 RETURN 6030 IF FPTR>BDEFS THEN F$="d":J=FPTR-BDEFS 'PUT_ARG 6040 IF FPTR<BDEFS THEN F$="x":J=FPTR-BVARS 6050 PRINT F$;MID$(STR$(J)+" ",2,3); 6060 RETURN 6070 REM<UNK! {0009}>HYPOTHESIS TESTING 6080 REM 'TEST_DATA 6090 DATA "HYPOTHESIS TESTING" 6100 DATA "12345" 6110 DATA " " 6120 DATA " " 6130 DATA " 1 SINGLE MEAN" 6140 DATA " " 6150 DATA " 2 TWO MEANS" 6160 DATA " " 6170 DATA " 3 SINGLE VARIANCE" 6180 DATA " " 6190 DATA " 4 TWO VARIANCES" 6200 DATA " " 6210 DATA " 5 RETURN TO MAIN MENU" 6220 DATA "" 6230 IF FILSPEC$="" THEN GOSUB 4090:RETURN 'TEST;openfilemsg 6240 MD=TEST:RESTORE 6080:READ X$:READ CMD$ 'test_data 6250 GOSUB 2490:GOSUB 3170:GOSUB 2120 'putchdr;putdata;getchoice 6260 IF CMD=5 OR FCMD=QRET OR FCMD=ESC THEN RETURN 6265 IF FCMD THEN GOTO 6240 6270 TCMD=CMD:MD=CMD+3:X$=THDR$(CMD):GOSUB 2490 'putchdr 6280 GOSUB 7700:IF FCMD=QRET THEN RETURN 'get_params 6290 IF FCMD THEN GOTO 6230 'test 6300 IF TCMD=1 OR TCMD=3 THEN U(1,0)=0 6310 GOSUB 3460 'read_casefile 6320 GOSUB 2990 'putprompt 6330 PRINT "COMPUTING TEST VALUES..."; 6340 GOSUB 7980 'do_test 6350 GOSUB 3020 'clf 6360 GOSUB 6450 'put_ndx 6370 GOSUB 6540 'put_sstats 6380 GOSUB 6880 'put_tst 6390 GOSUB 6990 'put_cfd 6400 GOSUB 7080 'put_hyp 6410 GOSUB 2990 'END_TEST;putprompt 6420 PRINT "FUNCTION COMPLETED"; 6430 GOSUB 2160 'get_cr 6440 GOTO 6230 'test 6450 SJ=0:GOSUB 6490 'PUT_NDX;put_ndx_ 6460 IF TCMD=1 OR TCMD=3 THEN RETURN 6470 SJ=1:GOSUB 6490 'put_ndx_ 6480 RETURN 6490 FPTR=U(SJ,0):IF FPTR=0 THEN RETURN 'PUT_NDX_ 6500 P=1:Q=1:IF SJ THEN Q=42 6510 GOSUB 6010:PRINT "VARIABLE "; 'put_wcur 6520 GOSUB 6030:PRINT ": "W$(FPTR); 'put_arg 6530 RETURN 6540 P=3:SJ=0 'PUT_SSTATS 6550 IF TCMD=1 OR TCMD=3 THEN GOTO 6560 ELSE GOTO 6700 'put_1ss;put_2ss 6560 Q=1 'PUT_1SS 6570 LSET WBUF$="SAMPLE MEAN: "+STR$(U(SJ,4)) 6580 GOSUB 6010:PRINT WBUF$ 'put_wcur 6590 Q=42 6600 LSET WBUF$="SAMPLE STD.DEV.:"+STR$(U(SJ,6)) 6610 GOSUB 6010:PRINT WBUF$ 'put_wcur 6620 P=P+1 6630 Q=1 6640 LSET WBUF$="SAMPLE VARIANCE:"+STR$(U(SJ,5)) 6650 GOSUB 6010:PRINT WBUF$ 'put_wcur 6660 Q=42 6670 LSET WBUF$="SAMPLE STD.ERR.:"+STR$(U(SJ,7)) 6680 GOSUB 6010:PRINT WBUF$ 'put_wcur 6690 RETURN 6700 Q=1:SJ=0:GOSUB 6820 'PUT_2SS;put_sm 6710 Q=42:SJ=1:GOSUB 6820 'put_sm 6720 P=P+1 6730 Q=1:SJ=0:GOSUB 6850 'put_sd 6740 Q=42:SJ=1:GOSUB 6850 'put_sd 6750 P=P+1:Q=1:GOSUB 6010 'put_wcur 6760 IF TCMD=2 THEN LSET WBUF$= "DIFFERENCE: "+STR$(T(11)) ELSE LSET WBUF$="RATIO: "+STR$(T(11)) 6770 PRINT WBUF$; 6780 Q=42:GOSUB 6010 'put_wcur 6790 LSET WBUF$="STANDARD ERROR: "+STR$(T(10)) 6800 PRINT WBUF$; 6810 RETURN 6820 LSET WBUF$="SAMPLE MEAN: "+STR$(U(SJ,4)) 'PUT_SM 6830 GOSUB 6010:PRINT WBUF$ 'put_wcur 6840 RETURN 6850 LSET WBUF$="SAMPLE STD.DEV.:"+STR$(U(SJ,6)) 'PUT_SD 6860 GOSUB 6010:PRINT WBUF$ 'put_wcur 6870 RETURN 6880 P=6:Q=1:GOSUB 6010: 'PUT_TST;put_wcur 6890 IF TCMD=3 THEN PRINT "CHI SQ. TEST USED: CHI SQ=";:GOTO 6930'put_tst_ 6900 IF TCMD=4 THEN PRINT "F-TEST USED: F =";:GOTO 6930 'put_tst_ 6910 IF T(7)=1 THEN PRINT "T-TEST USED: T =";:GOTO 6930 'put_tst_ 6920 PRINT "NORMAL TEST USED: Z ="; 6930 PRINT T(8); 'PUT_TST_ 6940 IF TCMD<3 AND T(7)=0 THEN RETURN<UNK! {0009}> 6950 Q=42:GOSUB 6010 'put_wcur 6960 LSET WBUF$="DEGREES OF FREEDOM:"+STR$(T(9)) 6970 PRINT WBUF$; 6980 RETURN 6990 IF T(1)=-1 THEN RETURN 'PUT_CFD 7000 P=7:Q=1:GOSUB 6010 'put_wcur 7010 PRINT MID$(STR$(T(1)),2);"% CONFIDENCE LEVEL ON "; 7020 IF TCMD=2 THEN PRINT "DIFFERENCE OF "; 7030 IF TCMD=4 THEN PRINT "RATIO OF "; 7040 IF TCMD<3 THEN PRINT "MEAN"; ELSE PRINT "VARIANCE"; 7050 IF TCMD=2 OR TCMD=4 THEN PRINT "S"; 7060 PRINT ":";T(5)" TO";T(6) 7070 RETURN 7080 COLOR 1,0 'PUT_HYP 7090 P=9 7100 Q=1:GOSUB 6010:PRINT "NULL HYPOTHESIS" 'put_wcur 7110 Q=30:GOSUB 6010:PRINT "ALTERNATIVE" 'put_wcur 7120 Q=55:GOSUB 6010:PRINT "SIGNIFICANCE LEVEL" 'put_wcur 7130 COLOR 7,0 7140 IF TCMD=1 THEN X$="MEAN" ELSE IF TCMD=2 THEN X$="DIFFERENCE" ELSE IF TCMD=3 THEN X$="VARIANCE" ELSE X$="RATIO" 7150 Q=1 7160 P=P+1:Y$=">=":GOSUB 7330 'put_hyp_ 7170 P=P+1:Y$="<=":GOSUB 7330 'put_hyp_ 7180 P=P+1:Y$=" =":GOSUB 7330 'put_hyp_ 7190 P=P-3 7200 Q=31 7210 IF TCMD=2 THEN Q=Q-3 ELSE IF TCMD=3 THEN Q=Q-2 7220 P=P+1:Y$=" <":GOSUB 7330 'put_hyp_ 7230 P=P+1:Y$=" >":GOSUB 7330 'put_hyp_ 7240 P=P+1:Y$="<>":GOSUB 7330 'put_hyp_ 7250 P=P-3 7260 Q=61 7270 P=P+1:J=2:GOSUB 7310 'put_sigl 7280 P=P+1:J=3:GOSUB 7310 'put_sigl 7290 P=P+1:J=4:GOSUB 7310 'put_sigl 7300 RETURN 7310 GOSUB 6010:PRINT USING "#.###";T(J); 'PUT_SIGL;put_wcur 7320 RETURN 7330 GOSUB 6010:PRINT X$;" ";Y$;T(0); 'PUT_HYP_;put_wcur 7340 RETURN 7350 PROMPT$="ENTER INDEX OF"+PROMPT$+" VARIABLE TO TEST" 7360 GOSUB 5810 7370 IF FCMD THEN RETURN 'get_arg 7380 REM 7390 U(SVEC,0)=FPTR:SJ=SVEC:GOSUB 6450 'put_ndx 7400 RETURN 7410 GOSUB 2990:PRINT "ENTER STANDARD DEVIATION OF ";ARG$;" (ENTER ALONE=NONE)";'GET_SD;putprompt 7420 MAXLIN=8:GOSUB 2190:IF FCMD THEN RETURN 'getlin 7430 IF LIN$="" THEN U(SVEC,1)=-1:RETURN 7440 U(SVEC,1)=VAL(LIN$) 7450 IF U(SVEC,1)<=0 THEN GOSUB 7580:GOTO 7410 'param_err;get_sd 7460 LSET WBUF$="STANDARD DEV.: "+STR$(U(SVEC,1)) 7470 P=3:Q=1:IF SVEC THEN Q=42 7480 GOSUB 6010:PRINT WBUF$; 'put_wcur 7490 RETURN 7500 GOSUB 2990:PRINT "ENTER HYPOTHESIZED ";PROMPT$; 'GET_HYP;putprompt 7510 MAXLIN=8:GOSUB 2190:IF FCMD THEN RETURN 'getlin 7520 T(0)=VAL(LIN$) 7530 IF TCMD>2 AND T(0)<0 THEN GOSUB 7580:GOTO 7500 'param_err;get_hyp 7540 IF TCMD=4 AND T(0)=0 THEN GOSUB 7580:GOTO 7500 'param_err;get_hyp 7550 P=4:Q=1:GOSUB 6010 'put_wcur 7560 PRINT "HYPOTHESIZED ";PROMPT$;T(0);SPACE$(10) 7570 RETURN 7580 GOSUB 2990 'PARAM_ERR;putprompt 7590 PRINT "BAD PARAMETER VALUE"; 7600 PRINT " <CR> TO CONTINUE "; 'get_cr 7605 X$=INPUT$(1) 7606 IF X$<>CHR$(13) AND X$<>CHR$(27) THEN GOTO 7605 7610 RETURN 7620 GOSUB 2990:PRINT "ENTER CONFIDENCE LEVEL(75%-99%) (ENTER ALONE=NONE)";'GET_CFD;putprompt 7630 MAXLIN=4:GOSUB 2190:IF FCMD THEN RETURN 'getlin 7640 IF LIN$="" THEN T(1)=-1:RETURN 7650 T(1)=VAL(LIN$) 7660 IF T(1)<75 OR T(1)>99 THEN GOSUB 7580:GOTO 7620 'param_err;get_cfd 7670 P=5:Q=1:GOSUB 6010 'put_wcur 7680 PRINT MID$(STR$(T(1)),2);"% CONFIDENCE LEVEL "; 7690 RETURN 7700 GOSUB 3020 'GET_PARAMS;clf 7710 SVEC=0 7720 U(0,0)=0:U(1,0)=0<UNK! {0009}> 7730 U(0,1)=-1:U(1,1)=-1<UNK! {0009}> 7740 T(0)=0<UNK! {0009}> 7750 T(1)=-1<UNK! {0009}> 7760 T(7)=0<UNK! {0009}> 7770 IF TCMD=2 OR TCMD=4 THEN PROMPT$=" FIRST" ELSE PROMPT$="" 7780 GOSUB 7950:IF FCMD=QRET OR FCMD=ESC THEN RETURN 'get_params1 7790 IF FCMD THEN 7700 'get_params 7800 IF TCMD=1 OR TCMD=3 THEN GOTO 7840 'get_params2 7810 SVEC=1:PROMPT$=" SECOND" 7820 GOSUB 7950:IF FCMD=QRET THEN RETURN 'get_params1 7830 IF FCMD THEN GOTO 7700 'get_params 7840 IF TCMD=1 THEN PROMPT$="MEAN" 'GET_PARAMS2 7850 IF TCMD=2 THEN PROMPT$="DIFFERENCE" 7860 IF TCMD=3 THEN PROMPT$="VARIANCE" 7870 IF TCMD=4 THEN PROMPT$="VALUE OF VARIANCE RATIO" 7880 GOSUB 7500:IF FCMD=QRET THEN RETURN 'get_hyp 7890 IF FCMD THEN GOTO 7700 'get_params 7900 GOSUB 7620:IF FCMD=QRET THEN RETURN 'get_cfd 7910 IF FCMD THEN GOTO 9340 'get_param2 7920 GOSUB 2990:PRINT "OK TO PROCEED WITH TEST"; 'putprompt 7930 GOSUB 2140:IF X$="Y" OR FCMD=QRET THEN RETURN 'getyesno 7940 GOTO 7700 'get_params 7950 GOSUB 7350:IF FCMD THEN RETURN 'GET_PARAMS1;get_ndx 7960 IF TCMD<3 THEN GOSUB 7410 'get_sd 7970 RETURN 7980 SX=U(0,1) 'DO_TEST 7990 N1=U(0,3) 8000 M1=U(0,4) 8010 S1=U(0,6) 8020 IF N1=0 THEN GOTO 8140 'abort_test 8030 IF SX+S1=-1 THEN GOTO 8180 '0variance 8040 IF TCMD=1 OR TCMD=3 THEN GOTO 8110 'do_test_ 8050 SY=U(1,1) 8060 N2=U(1,3) 8070 M2=U(1,4) 8080 S2=U(1,6) 8090 IF N2=0 THEN 8140 'abort_test 8100 IF SY+S2=-1 THEN GOTO 8180 '0variance 8110 HV=T(0):PP=T(1) 'DO_TEST_ 8120 ON TCMD GOSUB 8220,8420,8580,8800 '1mean;2mean;1var;2var 8130 RETURN 8140 GOSUB 2990 'ABORT_TEST;putprompt 8150 PRINT "NO CASE SELECTED: CANNOT PERFORM TEST."; 8160 GOSUB 2160 'get_cr 8170 GOTO 6410 'end_test 8180 GOSUB 2990 '0VARIANCE;putprompt 8190 PRINT "VARIANCE = 0: CANNOT PERFORM TEST."; 8200 GOSUB 2160 'get_cr 8210 RETURN 8220 D1=1 '1MEAN 8230 IF SX<=0 THEN D2=N1-1 ELSE D2=1E+20 8240 IF PP<=0 THEN GOTO 8280 '1mean_ 8250 P=(100+PP)/2 8260 GOSUB 9010 '20000 8270 T=SQR(F) 8280 IF SX<=0 THEN SS=S1/SQR(N1) ELSE SS=SX/SQR(N1) '1MEAN_ 8290 Z=M1-HV 8300 Z=Z/SS 8310 F=Z*Z 8320 GOSUB 9180 '30000 8330 IF SX<=0 THEN T(7)=1 ELSE T(7)=0<UNK! {0009}> 'MEAN 8340 T(8)=Z<UNK! {0009}> 8350 T(9)=D2<UNK! {0009}> 8360 T(10)=SS<UNK! {0009}> 8370 IF M1>HV THEN T(2)=1-A/2 ELSE T(2)=A/2<UNK! {0009}> 8380 IF M1<HV THEN T(3)=1-A/2 ELSE T(3)=A/2 8390 T(4)=A 8400 IF PP>0 THEN T(5)=M1-SS*T:T(6)=M1+SS*T<UNK! {0009}> 8410 RETURN 8420 D1=1 '2MEAN 8430 IF SX<=0 THEN D2=N1+N2-2 ELSE D2=1E+20 8440 IF PP<=0 THEN GOTO 8480 '2mean_ 8450 P=(100+PP)/2 8460 GOSUB 9010 '20000 8470 T=SQR(F) 8480 IF SX<=0 THEN SS=SQR((((N1-1)*S1^2+(N2-1)*S2^2)/D2)*(N1+N2)/(N1*N2))'2MEAN 8490 IF SX>0 THEN SS=SQR(S1^2/N1+S2^2/N2) 8500 Z=M1-M2-HV 8510 Z=Z/SS 8520 F=Z*Z 8530 GOSUB 9180 '30000 8540 M1=M1-M2 8550 GOSUB 8330 'mean 8560 T(11)=M1 8570 RETURN 8580 D1=N1-1 '1VAR 8590 D2=1E+20 8600 IF PP<=0 THEN GOTO 8670 '1var_ 8610 P=(100+PP)/2 8620 GOSUB 9010 '20000 8630 T=F 8640 P=(100-PP/2)<UNK! {0009}> 8650 GOSUB 9010 '20000 8660 T1=F 8670 SS=S1/SQR(N1) '1VAR_ 8680 F=S1^2/HV 8690 Z=F*D1 8700 GOSUB 9180 '30000 8710 T(8)=Z 8720 T(9)=D1<UNK! {0009}> 8730 T(10)=SS 8740 T(11)=S1^2<UNK! {0009}> 8750 T(2)=1-A<UNK! {0009}> 8760 T(3)=A<UNK! {0009}> 8770 IF A<0.5 THEN T(4)=2*A ELSE T(4)=2*(1-A) 8780 IF PP>0 THEN T(5)=S1^2/T:T(6)=S1^2/T1 8790 RETURN 8800 D1=N1-1 '2VAR 8810 D2=N2-1<UNK! {0009}> 8820 IF PP<=0 THEN GOTO 8890 '2var_ 8830 P=(100+PP)/2 8840 GOSUB 9010 '20000 8850 T=F 8860 P=(100-PP)/2 8870 GOSUB 9010 '20000 8880 T1=F 8890 SS=SQR(S1^2/N1+S2^2/N2)<UNK! {0009}> '2VAR_ 8900 F=(1/HV)*S1^2/S2^2 8910 GOSUB 9180 '30000 8920 T(8)=F 8930 T(9)=D2<UNK! {0009}> 8940 T(10)=SS 8950 T(11)=(S1/S2)^2<UNK! {0009}> 8960 IF F>HV THEN T(2)=1-A ELSE T(2)=A 8970 IF F<HV THEN T(3)=1-A ELSE T(3)=A 8980 IF A<0.5 THEN T(4)=2*A ELSE T(4)=2*(1-A) 8990 IF PP>0 THEN T(5)=F*T1:T(6)=F*T<UNK! {0009}> 9000 RETURN 9010 P=(100-P)/100 '20000 9020 B1=10 9030 FOR LL = 1 TO 10 9040 F=B1 9050 GOSUB 9180 '30000 9060 IF A<P THEN LL=10 9070 B1=B1*10 9080 NEXT 9090 L1=0.05 9100 B1=1024 9110 FOR LL = 1 TO 100 9120 F=(L1+B1)/2 9130 GOSUB 9180 '30000 9140 IF ABS(A-P)<0.000999999 THEN RETURN 9150 IF A>P THEN L1=F ELSE B1=F 9160 NEXT 9170 RETURN 9180 IF D1*D2*F<=0 THEN A=1:RETURN '30000 9190 IF F<1 THEN GOTO 9240 '34000 9200 V1=D1 9210 V2=D2 9220 F1=F 9230 GOTO 9270 '35000 9240 V1=D2 '34000 9250 V2=D1 9260 F1=1/F 9270 V3=2/(9*V1) '35000 9280 V4=2/(9*V2) 9290 ZZ=ABS(((1-V4)*F1^(1/3)-1+V3)/SQR(V4*F1^(2/3)+V3)) 9300 IF V2<4 THEN ZZ=ZZ*(1+0.08*ZZ^4/V2^3) 9310 A=0.5/(1+ZZ*(0.196854+ZZ*(0.115194+ZZ*(0.000343999+ZZ*0.019527))))^4 9320 IF F<1 THEN A=1-A 9330 RETURN 9340 STOP 'NULL LABEL