home *** CD-ROM | disk | FTP | other *** search
Wrap
GW-BASIC | 1984-08-01 | 18.0 KB | 350 lines
30 CLS:WIDTH 80:KEY OFF:LOCATE 1,30:COLOR 0,7:PRINT" >>> STATLIB 1 <<< ":COLOR 7,0:LOCATE 3,24:PRINT"Volume One -- Descriptive Statistics";:COLOR 0,7:X$=CHR$(186) 70 LOCATE5,10,0:PRINTCHR$(201)+STRING$(59,205)+CHR$(187):LOCATE19,10:PRINTCHR$(200)+STRING$(59,205)+CHR$(188):FORW=6TO18:LOCATEW,10:PRINTX$:LOCATEW,70:PRINTX$:NEXT:COLOR0,15:COLOR7,0:LOCATE7,29:PRINT"Designed by Dale Benzer 120 LOCATE9,26:PRINT"Programmed by Peter Schlaifer":LOCATE11,37:PRINT"For":LOCATE13,25:PRINT"THE PC DISK LIBRARY OF SOFTWARE":LOCATE15,32:PRINT"Copyright 1984 ":LOCATE17,26:PRINT"ZIFF-DAVIS PUBLISHING CO., INC. 170 LOCATE22,26:PRINT"PRESS ANY KEY TO CONTINUE 180 A$=INKEY$:IFA$=""THEN180 190 LOCATE22,26,0:PRINTSPACE$(40):LOCATE22,26:CLEAR,,2500:PRINT"initializing STATLIB 1 ...":GOSUB1090:GOSUB1220:ONERRORGOTO4020 1060 GOSUB1600:GOSUB2140:MD=-1:GOTO3900 1090 KEYOFF:FORJ=1TO10:KEYJ,"":NEXT:LOCATE,,0:CR$=CHR$(13):ESC$=CHR$(27):NL$=CHR$(13):RS$=CHR$(28):LS$=CHR$(29):US$=CHR$(30):DS$=CHR$(31):DEFFNK$(J)=CHR$(0)+CHR$(J):F1$=FNK$(59):F2$=FNK$(60):F3$=FNK$(61):F4$=FNK$(62):F5$=FNK$(63) 1140 ECMD$="F1 HELP F2 QUIT/RETURN F3 CONTINUE/SAVE F4 REDO F5 VIEW":RETURN 1220 DEFINTA-Z:DEFSNGA,U,V:I=0:J=0:K=0:L=0:P=0:Q=0:ARG=0:ARG1=0:ARG2=0:U=0:V=0:X$="":Y$="":W$="":LIN$="":ARG$="":NVARS=0:NDEFS=0:NSUBS=0:NCASE=0<UNK! {0009}>:BPTR=0:FPTR=0:NPTR=0:MAXPTR=0<UNK! {0009}>:F0=0:F1=0:F2=0:FF=0:VFLAG=0<UNK! {0009}>:FCMD=0:CMD=0:CMD$=""<UNK! {0009}> 1290 FPROMPT$="":FTYP$="":FTYP=0:ZPTR=0:JJ=0:CCASE=0:MD=0:U1=0:U2=0:V1=0:V2=0:UHIGH=-1E+06:ULOW=1E+06:VLOW=ULOW:VHIGH=UHIGH:MAIN=0:OPIN=1:SELS=2:FREQ=3:HIST=4:SCAT=5:FUNC=6:PRNT=7:EXIT=8:HELP=1:QRET=2:QSAV=3:REDO=4:VYEW=5:ESC=-1:FC=12<UNK! {0009}>:FD=6<UNK! {0009}> 1360 FJ=4:FL=14:FW=FL*FJ:NC=(FC+FD)*FJ:FP=4:FQ=((78-NC)/2)-1:MAXLIN=FC:MAXSTEPS=FL-4:FC$=SPACE$(FC):FD$=SPACE$(FD-3):FE$=SPACE$(FC+FD):FL$=SPACE$(NC):NW$=NL$+STRING$(FQ+2,RS$):FILSPEC$="":FILDESC$="" 1370 LCHAR$=CHR$(219):HLCHAR$=CHR$(220) 1510 NOCHAR$=" ":NOT0CHAR$="_":MAXBUF=127:BVARS=0:BUFSIZ=MAXBUF:GOSUB2720:K=BVARS+MAXLBLS+1:DIMW$(K):FORJ=1TOK-1:W$(J)=FC$:NEXT:DIMS(MAXSUBS+1),V(MAXVARS+MAXDEFS+1):DIMC(MAXSTEPS+2)<UNK! {0009}>:MAXCASE=4000:DIMU(MAXCASE)<UNK! {0009}>:RETURN 1600 CLS:RETURN 1610 LOCATEP,Q:RETURN 1620 LOCATE,,1:X$=INKEY$:IFX$=""THEN1620 1630 GOSUB1650:IFX$=""THEN1620 1640 LOCATE,,0:RETURN 1650 FCMD=0:IFX$>=" "ORX$=CR$ORX$=CHR$(8)THENRETURN 1660 IFX$=F1$THENGOSUB3210:X$=ESC$ 1670 IFX$=F2$THENFCMD=QRET:RETURN 1680 IFX$=F3$THENFCMD=QSAV:RETURN 1690 IFX$=F4$THENFCMD=REDO:RETURN 1700 IFX$=F5$THENGOSUB3610:X$=ESC$ 1710 IFX$=ESC$THENFCMD=ESC:RETURN 1720 X$="":RETURN 1730 PROMPT$="Your choice":GOSUB2260:GOSUB1740:RETURN 1740 GOSUB1620:CMD=0:IFFCMD<>0THENRETURN 1750 GOSUB1920:CMD=INSTR(CMD$,X$):IFCMDTHENRETURN 1760 GOTO1740 1770 GOSUB2260:PRINT" Y/N ";:CMD$="YN":GOSUB1740:RETURN 1790 GOSUB2260:PRINT"...CR to continue...";:CMD$=CR$:GOSUB1740:RETURN 1810 GOSUB2260:LIN$="":GOSUB1820:RETURN 1820 GOSUB1620:IFX$>=" "THENGOSUB1880:GOTO1820 1840 IFX$=CHR$(8)THENGOSUB1900:GOTO1820 1850 IFX$=CR$THENRETURN 1860 IFFCMD<>0THENLIN$="":RETURN 1870 GOTO1820 1880 IFLEN(LIN$)<MAXLINTHENLIN$=LIN$+X$:PRINTX$; 1890 RETURN 1900 J=LEN(LIN$):IFJ>0THENPRINTLS$" "LS$;:LIN$=LEFT$(LIN$,J-1) 1910 RETURN 1920 IFX$=""THENRETURN 1930 J=ASC(X$):IFJ>96ANDJ<123THENJ=J-32 1940 X$=CHR$(J):RETURN 1950 IFX$=""THENRETURN 1960 J=ASC(X$):IFJ>64ANDJ<91THENJ=J+32 1970 X$=CHR$(J):RETURN 1980 P=1:Q=20:GOSUB1610:PRINTSPACE$(40);:X$=">>> "+X$+" <<<":Q=40-LEN(X$)\2:GOSUB1610:COLOR0,7:PRINTX$;:COLOR7,0:RETURN 2030 P=FP-1:Q=40:GOSUB1610:PRINTSPACE$(40-FQ);:Q=80-FQ-LEN(X$):GOSUB1610:PRINTX$;:RETURN 2050 P=FP-1:Q=FQ+1:GOSUB1610:PRINTSPACE$(40-FQ-1):GOSUB1610:PRINTX$;:RETURN 2070 X$=FILSPEC$:IFX$=""THENX$="NO FILE OPENED":GOSUB2050:X$="":GOSUB2030:RETURN 2090 IFFILDESC$<>""THENX$=X$+"/"+FILDESC$ 2100 X$="FILE: "+X$:GOSUB2050:X$="NO":IFNCASE<>0THENX$=STR$(NCASE) 2120 IFNCASE<>1THENX$=X$+" CASES ENTERED":GOSUB2030:RETURN 2130 X$="1 CASE ENTERED":GOSUB2030:RETURN 2140 P=FP:K=FP+1+FL:FORQ=FQ+1TO79-FQ:GOSUB1610:COLOR0,7:PRINTCHR$(205);:NEXT:GOSUB1610:PRINTCHR$(187);:FORP=FP+1TOK:GOSUB1610:PRINTCHR$(186);:NEXT:GOSUB1610:PRINTCHR$(188);:FORQ=79-FQTOFQ+1STEP-1:GOSUB1610:PRINTCHR$(205);:NEXT 2200 GOSUB1610:PRINTCHR$(200);:FORP=KTOFP+1STEP-1:GOSUB1610:PRINTCHR$(186);:NEXT:GOSUB1610:PRINTCHR$(201);:COLOR7,0:RETURN 2230 P=21:Q=FQ+2:GOSUB2290:Q=40-LEN(X$)\2:GOSUB1610:PRINTX$;:RETURN 2260 P=23:Q=FQ+2:GOSUB2290:PRINTPROMPT$" ";:RETURN 2270 PROMPT$=PROMPT$+"...CR to continue":GOSUB2260:CMD$=CR$:GOSUB1740:RETURN 2290 GOSUB1610:PRINTSPACE$(79-Q);:GOSUB1610:RETURN 2300 GOSUB2320:FORL=1TOFL:GOSUB2330:PRINTFL$;:NEXT:GOSUB2320:RETURN 2320 P=FP+1:Q=FQ+2:GOSUB1610;:RETURN 2330 PRINTNL$STRING$(FQ+2,RS$);:RETURN 2340 IFF2=F0-1THENGOSUB2480:RETURN 2350 GOSUB2320:F1=FW*(F1\FW):IFF1>(F2-F0+1)ORF1<0THENF1=0 2360 K=F0+F1:FORL=1TOFL:GOSUB2330:IFK<=F2THENGOSUB2420 ELSEPRINTFL$; 2400 NEXT:RETURN 2420 FORJ=KTOK+FJ-1:IFJ<=F2THENGOSUB2470 ELSEPRINTFE$; 2440 NEXT:K=K+FJ:RETURN 2470 LSETFD$=MID$(STR$(J-F0+1),2):PRINTF$FD$": "W$(J);:RETURN 2480 X$=FL$:LSETX$="Nothing entered":GOSUB2320:GOSUB2330:PRINTX$;:FORJ=2TOFL:GOSUB2330:PRINTFL$;:NEXT:RETURN 2500 GOSUB2320:Y$=FL$:READX$:FORL=1TOFL:GOSUB2330:IFX$<>""THENGOSUB2550 ELSEPRINTFL$; 2530 NEXT:RETURN 2550 LSETY$=X$:READX$:PRINTY$;:RETURN 2570 FCMD=0:ONERRORGOTO2690 2580 PROMPT$="LOADING "+FILNAM$:GOSUB2260:LIN$=FILSPEC$+".STL":OPEN "I",#1,LIN$:INPUT#1,FILNAM$,FILDESC$,BUFSIZ:GOSUB2720:INPUT#1,NVARS,NDEFS,NSUBS,NCASE:FORJ=1TONVARS:INPUT#1,X$:LSETW$(BVARS+J)=X$:NEXT 2630 FORJ=1TONDEFS:INPUT#1,X$:LSETW$(BDEFS+J)=X$:NEXT:FORJ=1TONSUBS:INPUT#1,X$:LSETW$(BSUBS+J)=X$:NEXT:CLOSE#1:GOSUB2070:CCASE=0:LIN$=FILSPEC$+".DAT":OPEN "R",#1,LIN$,BUFSIZ:FIELD#1,BUFSIZ AS CB$ 2680 ONERRORGOTO4020:RETURN 2690 PROMPT$="CAN'T OPEN "+LIN$:GOSUB1790:FILSPEC$="":CLOSE:FCMD=REDO:RESUME2680 2720 MAXVARS=BUFSIZ:MAXDEFS=BUFSIZ\4:MAXSUBS=BUFSIZ:MAXLBLS=MAXVARS+MAXDEFS+MAXSUBS:BDEFS=BVARS+MAXVARS:BSUBS=BDEFS+MAXDEFS:BVALS=BSUBS+MAXSUBS:RETURN 2760 SEL=0:IFCCASE<0THENRETURN 2770 WHILESEL=0ANDCCASE<NCASE:SEL=1:CCASE=CCASE+1:GET#1,CCASE*4:FORJ=1TOS(0):IFMID$(CB$,S(J),1)="0"THENSEL=0:J=S(0) 2810 NEXT:WEND:IFSEL>0THENNSEL=NSEL+1:GOSUB2900:RETURN 2840 IFNSEL>2THENX$=STR$(NSEL)+" CASES 2850 IFNSEL=1THENX$="ONE CASE 2860 IFNSEL=0THENX$="NO CASES 2870 X$=X$+" SELECTED":GOSUB2030:CCASE=-1:RETURN 2900 GET#1,CCASE*4-3:X$=CB$:GET#1:X$=X$+CB$:FORJ=1TONVARS:V(BVARS+J)=CVI(MID$(X$,J+J-1)):NEXT:GET#1:FORJ=1TONDEFS:V(BDEFS+J)=CVS(MID$(CB$,J*4-3)):NEXT:V(0)=CCASE:X$="SELECTED CASE NUMBER"+STR$(CCASE):GOSUB2030:RETURN 2960 GOSUB3040:IFFCMD=QRETTHENRETURN 2970 IFFCMD<>0THEN2960 2980 GOSUB3110:IFFCMD=QRETTHENRETURN 2990 IFFCMD<>0THEN2960 3000 CLOSE:FILSPEC$="":X$=FILNAM$:IFFILDRV$<>""THENX$=FILDRV$+":"+X$ 3020 FILSPEC$=X$:RETURN 3040 PROMPT$="Enter filename":MAXLIN=8:GOSUB1810:IFFCMD=ESCTHEN3040 3060 IFFCMD<>0THENRETURN 3070 IFLIN$<=SPACE$(8)THENLIN$=FILNAM$ 3080 FILNAM$=LIN$:IFFILNAM$=""THENFCMD=QRET 3090 RETURN 3110 PROMPT$="On drive ":GOSUB2260:GOSUB1620:IFFCMD=ESCTHEN3110 3130 IFFCMD<>0ORX$=CR$THENRETURN 3140 GOSUB1920:IFINSTR("ABCD",X$)THENFILDRV$=X$:RETURN 3160 IFX$=" "THENFILDRV$="":RETURN 3170 GOTO3110 3190 PROMPT$="File must be first opened from main menu":GOSUB2270:RETURN 3210 IFMD=MAINTHENRESTORE3320 3220 IF MD=OPIN THEN RESTORE 3370 3230 IFMD=SELSTHENRESTORE3400 3240 IFMD=FREQTHENRESTORE3430 3250 IFMD=HISTTHENRESTORE3460 3260 IFMD=SCATTHENRESTORE3490 3270 IFMD=FUNCTHENRESTORE3520 3280 IFMD=PRNTTHENRESTORE3550 3290 IFMD=EXITTHENRESTORE3580 3300 GOSUB 2500:PROMPT$="":GOSUB 1790:GOSUB 2300:RETURN 3320 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 3354 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" 3370 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" 3387 DATA"After a file is opened, the variable labels are displayed and the":DATA"and the program will return to the Main Menu.":DATA" 3400 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 3414 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" 3418 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. 3423 DATA" 3430 DATA"FREQUENCY HELP SCREEN":DATA" ":DATA"This routine will plot the frequency of values for a variable which":DATA"you specify.":DATA" ":DATA"The program will calculate the frequency, the percent, the cumulative 3446 DATA"count and the cumulative percent.":DATA" ":DATA"By pressing the <SHIFT> and <PrtSc> keys at the same time, a printout":DATA"may be obtained.":DATA" ":DATA"Note that only selected cases are counted.":DATA" 3453 DATA"A histogram may also be selected without returning to the Main Menu.":DATA" 3460 DATA"HISTOGRAMS HELP SCREEN":DATA" ":DATA"This routine will draw a histogram for a specified variable.":DATA" ":DATA"The program will plot half intervals as specified by the user." 3465 DATA " ":DATA "After the histogram has been displayed, a frequency table may be":DATA "obtained without returning to the Menu.":DATA "" 3490 DATA"SCATTERGRAMS HELP SCREEN":DATA" ":DATA"This routine will plot a scattergram for two specified variables.":DATA" ":DATA"The values plotted are the standard deviations from the mean. The 3505 DATA"plot increments are one standard deviation each, and 3.0 are plotted":DATA"on each axis." 3510 DATA " ":DATA "Values are plotted to the nearest 1/2 standard deviation.":DATA "" 3520 DATA"STATISTICAL ROUTINES HELP SCREEN":DATA" ":DATA"These routines are several of the standard set of descriptive ":DATA"statistics. You may specify as many as 10 variables for evaluation.":DATA " " 3535 DATA"The VAR. is the standard deviation squared. The standard deviation":DATA"is computed with the formula <0xE5!> = <UNK! {00FB}>(<0xE4!>x<UNK! {FD2D}>((<0xE4!>x)<UNK! {FD2F}>n)/n).":DATA" ":DATA"Since computing the median requires a sort, you have the option 3539 DATA"to skip this value. A large data base may require some time to ":DATA"compute the median.":DATA" 3550 DATA"PRINT SELECTED CASES HELP SCREEN":DATA" ":DATA"This option will print all cases for which the subsets specified":DATA"evaluate as true.":DATA"You may use option 2 to de-select certain subsets, and then print":DATA"those cases.":DATA" 3580 DATA"EXIT HELP SCREEN":DATA" ":DATA"Exiting the program will return you to BASIC with all functions ":DATA"restored.":DATA" 3610 PROMPT$="(L)ABELS (D)EFS (S)UBS (U)p do(W)n":CMD$="LDSUW":GOSUB2260:IFFF<1ORFF>3THENFF=1:F1=0 3640 X$=INKEY$:IFX$=""THEN3640 3650 IFX$=ESC$ORX$=CR$THENRETURN 3660 GOSUB1920:CMD=INSTR(CMD$,X$):ONCMDGOSUB3710,3720,3730,3690,3700:GOTO3640 3690 F1=F1-FW:GOSUB2340:RETURN 3700 F1=F1+FW:GOSUB2340:RETURN 3710 FF=1:F0=BVARS:F2=F0+NVARS:F0=F0+1:F$="x":GOSUB2340:RETURN 3720 FF=2:F0=BDEFS:F2=F0+NDEFS:F0=F0+1:F$="d":GOSUB2340:RETURN 3730 FF=3:F0=BSUBS:F2=F0+NSUBS:F0=F0+1:F$="s":GOSUB2340:RETURN 3760 DATA"STATLIB LIBRARY":DATA"123456789":DATA" ":DATA" ":DATA" 1 Open Case File 5 Frequency Plot":DATA" ":DATA" 2 Select Subsets 6 Histogram":DATA" 3840 DATA" 3 Help 7 Scatterplot":DATA" ":DATA" 4 Print Selected Cases 8 Stats Routines":DATA" ":DATA" ":DATA" 9 Exit Program":DATA" 3900 MD=MAIN:RESTORE3760:READX$:READCMD$:GOSUB1980:GOSUB2070:GOSUB2500:X$=ECMD$:GOSUB2230:GOSUB1730:IFCMD=9THEN3950 3930 ONCMDGOSUB4060,4150,4040,4630,5180,5270,7030,6310:GOTO3900 3950 MD=EXIT:PROMPT$="Do you want to test another file":GOSUB1770:IFX$="Y"THEN3900 3970 CLOSE:FILSPEC$="":FOR J=1 TO 500:NEXT:PROMPT$="goodbye...":GOSUB 2260:FOR J=1 TO 2200:NEXT:GOSUB 1600 3990 KEY ON:KEY 1,"LIST":KEY 2,"RUN"+CHR$(13):KEY 3,"LOAD"+CHR$(34):KEY 4,"SAVE"+CHR$(34):KEY 5,"CONT"+CHR$(13):KEY 6,","+CHR$(34)+"LPT1:":KEY 7,"TRON"+CHR$(13):KEY 8,"TROFF"+CHR$(13):KEY 9,"KEY":KEY 10,"SCREEN 0,0,0"+CHR$(13):NEW:END 4020 PROMPT$="Error"+STR$(ERR)+"in line"+STR$(ERL):GOSUB1790:RESUMENEXT 4040 GOSUB3210:RETURN 4060 MD=OPIN:X$="OPEN FILE":GOSUB1980:GOSUB2960:IFFCMD=QRETTHENRETURN 4080 IFFCMD<>0THEN4060 4090 GOSUB2570:IFFCMD<>0THEN4060 4100 GOSUB3710:PROMPT$="":GOSUB1790:FORJ=1TONSUBS:S(J)=J:NEXT:S(0)=NSUBS:IFNCASE=0THENPROMPT$="NO CASES ENTERED":GOSUB2270 4130 RETURN 4150 IFFILSPEC$=""THENGOSUB3190:RETURN 4160 MD=SELS:X$="SELECT SUBSET DEFINITIONS":GOSUB1980 4170 GOSUB4460:PROMPT$="(D)ELETE (E)NTER (C)LEAR (A)LL":CMD$="DECA":GOSUB2260:GOSUB1740:IFFCMD=QRETORFCMD=QSAVTHENRETURN 4200 IFFCMD<>0THEN4170 4210 ONCMDGOSUB4240,4290,4330,4340:IFCMD=0THENGOSUB2270 4230 GOTO4170 4240 GOSUB4370:IFFCMD=ESCTHEN4240 4250 IFFCMD<>0THENCMD=0:RETURN 4260 IFSELJ=0THENPROMPT$="SUBSET NOT SELECTED":GOTO4240 4270 FORJ=SELJTOS(0)-1:S(J)=S(J+1):NEXT:S(0)=S(0)-1:RETURN 4290 GOSUB4370:IFFCMD=ESCTHEN4290 4300 IFFCMD<>0THENCMD=0:RETURN 4310 IFSELJ<>0THENPROMPT$="DUPLICATE SUBSET":GOTO4290 4320 J=S(0)+1:S(J)=SEL:S(0)=J:RETURN 4330 S(0)=0:RETURN 4340 FORJ=1TONSUBS:S(J)=J:NEXT:S(0)=NSUBS:RETURN 4370 PROMPT$="ENTER SUBSET NUMBER":MAXLIN=3:GOSUB1810:IFFCMD=ESCTHEN4370 4390 IFFCMD<>0THENRETURN 4400 SEL=VAL(LIN$):IFSEL>=1ANDSEL<=NSUBSTHEN4420 4410 PROMPT$="BAD SUBSET NUMBER":GOSUB2270:GOTO4370 4420 SELJ=0:FORJ=1TOS(0):IFSEL=S(J)THENSELJ=J:J=S(0) 4440 NEXT:RETURN 4460 GOSUB2320:J=1:K=S(0):IFK=0THENGOSUB4580:RETURN 4480 FORL=1TOFL:GOSUB2330:IFJ<=KTHENGOSUB4530 ELSEPRINTFL$; 4510 NEXT:RETURN 4530 FORI=1TOFJ:IFJ<=KTHENGOSUB4570 ELSEPRINTFE$; 4550 NEXT:RETURN 4570 JJ=S(J):LSETFD$=MID$(STR$(JJ),2):PRINT"s"FD$": "W$(BSUBS+JJ);:J=J+1:RETURN 4580 X$=FL$:LSETX$="All cases will be selected.":GOSUB2330:PRINTX$;:FORL=2TOFL:GOSUB2330:PRINTFL$;:NEXT:RETURN 4630 IFFILSPEC$=""THENGOSUB3190:RETURN 4640 MD=PRNT:X$="PRINT SELECTED CASES":GOSUB1980:GOSUB4830:CCASE=0:NSEL=0:SEL=1:WHILESEL<>0:GOSUB2760:IFSEL<>0THENGOSUB4730 4690 WEND:GOSUB4950:PROMPT$="FUNCTION COMPLETED":GOSUB2270:RETURN 4730 X$=SPACE$(7):LSETX$=STR$(V(0)):LPRINT:LPRINTX$;:K=1:Y$=FC$:L=BVARS:FORJ=1TONVARS:GOSUB4800:NEXT:L=BDEFS:FORJ=1TONDEFS:GOSUB4800:NEXT:IFKMOD6<>1THENLPRINT 4790 RETURN 4800 LSETY$=STR$(V(L+J)):LPRINTY$;:K=K+1:IFKMOD6=1THENLPRINT:LPRINTSPACE$(7); 4820 RETURN 4830 LPRINT:LPRINTFILNAM$;:IFFILDESC$<>""THENLPRINT":"FILDESC$" "; 4850 IFS(0)=0THENLPRINT" NO SUBSETS SELECTED":GOTO4880 4860 LPRINT" SUBSETS SELECTED: ";:FORJ=1TOS(0):LPRINTW$(BSUBS+S(J));:NEXT:LPRINT 4880 LPRINT:X$=SPACE$(7):LSETX$="CASE#":LPRINTX$;:K=1:L=BVARS:FORJ=1TONVARS:GOSUB4930:NEXT:L=BDEFS:FORJ=1TONDEFS:GOSUB4930:NEXT:IFKMOD6<>1THENLPRINT 4920 RETURN 4930 LPRINTW$(L+J);:K=K+1:IFKMOD6=1THENLPRINT:LPRINTSPACE$(7); 4940 RETURN 4950 LPRINT:IFNSEL=0THENLPRINT"NO CASES SELECTED OF"STR$(NCASE)" IN FILE":RETURN 4960 LPRINT"SELECTED"STR$(NSEL)" CASE";:IFNSEL>1THENLPRINT"S"; 4970 LPRINT" OF"STR$(NCASE)" IN FILE":RETURN 4980 MAXLIN=4:W$=PROMPT$ 4990 PROMPT$=W$:GOSUB1810:IFFCMD<>0THENRETURN 5000 IFLIN$=""ANDARG$<>""THENRETURN 5010 G1=1:G2=LEN(LIN$):GOSUB5030:IFCMD>0THENRETURN 5020 GOSUB2270:GOTO4990 5030 ARG=0:ARG$="":FORARGPTR=G1TOG2:X$=MID$(LIN$,ARGPTR,1):GOSUB1950:K=INSTR("xd",X$):IFK>0THENGOSUB5110:ARGPTR=G2 5080 NEXT:IFK=0THENCMD=0:PROMPT$="Bad argument 5100 RETURN 5110 IFARGPTR=G2THENK=0:RETURN 5120 ARGPTR=ARGPTR+1:U=VAL(MID$(LIN$,ARGPTR)):L=NVARS:IFK=2THENL=NDEFS 5140 IFU<1ORU>LTHENK=0:RETURN 5150 ARG$=X$+MID$(STR$(U),2):FPTR=BVARS+U+(K-1)*MAXVARS:RETURN 5180 IFFILSPEC$=""THENGOSUB3190:RETURN 5190 MD=FREQ:X$="FREQUENCY TABLE":GOSUB1980:GOSUB5430:IFFCMD=QRETTHENRETURN 5210 GOSUB5780:GOSUB5860:PROMPT$="PRINT HISTOGRAM":GOSUB1770:IFFCMD=QRETTHENRETURN 5250 IFX$="Y"THENGOSUB6010 5255 PROMPT$="FUNCTION COMPLETED":GOSUB1790:GOTO5180 5270 IFFILSPEC$=""THENGOSUB3190:RETURN 5280 MD=HIST:X$="HISTOGRAM":GOSUB1980:GOSUB5430:IFFCMD=QRETTHENRETURN 5300 GOSUB5780:GOSUB6010:PROMPT$="PRINT FREQUENCY TABLE":GOSUB1770:IFFCMD=QRETTHENRETURN 5340 IFX$="Y"THENGOSUB5860 5345 PROMPT$="FUNCTION COMPLETED":GOSUB1790:GOTO5270 5360 J=LEN(STR$(MIN)):K=LEN(STR$(MAX)):MAXLIN=J:IFK>JTHENMAXLIN=K 5370 W$=PROMPT$+" ["+STR$(MIN)+" ,"+STR$(MAX)+" ] 5380 PROMPT$=W$:GOSUB1810:IFFCMD<>0THENRETURN 5390 IFLIN$=""THENNUM=MIN:RETURN 5400 J=VAL(LIN$):IFJ>=MINANDJ<=MAXTHENNUM=J:RETURN 5410 PROMPT$="OUT OF RANGE":GOSUB2270:GOTO5380 5430 GOSUB2300:PROMPT$="VARIABLE TO PLOT":GOSUB4980:IFFCMD=QRETTHENRETURN 5460 IFFCMD<>0THEN5430 5470 P=1:GOSUB7010:PRINTPROMPT$" "ARG$" "W$(FPTR); 5490 PROMPT$="LOW RANGE START":MIN=-9999:MAX=9999:GOSUB5360:IFFCMD=ESCORFCMD=REDOTHEN5430 5520 IFFCMD=QRETTHENRETURN 5530 IFLIN$<>""THENLOW=NUM 5540 P=2:GOSUB7010:PRINTPROMPT$" "STR$(LOW)" "; 5560 PROMPT$="HIGH RANGE END":MIN=LOW:MAX=9999:GOSUB5360:IFFCMD=ESCTHEN5490 5590 IFFCMD=REDOTHEN5430 5600 IFFCMD=QRETTHENRETURN 5610 IFLIN$<>""THENHIGH=NUM 5620 P=3:GOSUB7010:PRINTPROMPT$" "STR$(HIGH)" "; 5640 PROMPT$="INCREMENT":MAX=HIGH-LOW:U=MAX/MAXSTEPS:IFU>FIX(U)THENU=U+1 5660 MIN=INT(U):GOSUB5360:IFFCMD=ESCTHEN5560 5680 IFFCMD=REDOTHEN5430 5690 IFFCMD=QRETTHENRETURN 5700 IFLIN$<>""THENINCR=NUM 5710 NSTEPS=1:IFINCR>0THENNSTEPS=INT(MAX\INCR)+1 5720 P=4:GOSUB7010:PRINTPROMPT$" "STR$(INCR)" ";:GOSUB2330:PRINT"NUMBER OF STEPS "STR$(NSTEPS)" ";:PROMPT$="":GOSUB1790:IFFCMD=ESCTHEN5640 5760 IFFCMD=REDOTHEN5430 5770 RETURN 5780 FORJ=0TONSTEPS:C(J)=0:NEXT:CCASE=0:NSEL=0:SEL=1:WHILESEL<>0:GOSUB2760:IFSEL<>0THENGOSUB5820 5810 WEND:RETURN 5820 U=V(FPTR):IFU<=LOWTHENJ=0:GOTO5850 5830 IFU>HIGHTHENJ=NSTEPS:GOTO5850 5840 U=(U-LOW)/INCR:J=FIX(U):IFJ<UTHENJ=J+1 5850 C(J)=C(J)+1:RETURN 5860 GOSUB5910:JJ=0:X$=SPACE$(5):GOSUB2330:PRINTFL$;:FORJ=0TONSTEPS:GOSUB5960:NEXT:FORJ=NSTEPS+4TOFL:GOSUB2330:PRINTFL$;:NEXT:RETURN 5910 GOSUB2320:X$="\ \ COUNT PERCENT CUM. COUNT CUM. PERCENT":Y$=" \ \ ##### ###.# ##### ###.# ":GOSUB2330:W$=SPACE$(4):RSETW$=ARG$:PRINTUSINGX$;W$+": "+W$(FPTR);:RETURN 5960 GOSUB2330:K=C(J):JJ=JJ+K:IFJ=0THENRSETX$=STR$(LOW):W$=" - "+X$:GOTO6000 5980 IFJ=NSTEPSTHENRSETX$=STR$(LOW+(J-1)*INCR):LSETW$=X$+"+ -":GOTO6000 5990 RSETX$=STR$(LOW+(J-1)*INCR):W$=X$:RSETW$=STR$(LOW+J*INCR):W$=X$+"+ "+W$ 6000 PRINTUSINGY$;W$,K,K*100/NSEL,JJ,JJ*100/NSEL;:RETURN 6010 GOSUB6220:GOSUB2320:GOSUB2330:PRINTFL$;:LSETFL$="":GOSUB2330:PRINTFL$;:U=NSEL/MAXSTEPS:X$=SPACE$((NC-6)\(NSTEPS+1)):FORL=MAXSTEPSTO1STEP-1:GOSUB2330:GOSUB6140:PRINTUSING" ### ";L*100/MAXSTEPS;:PRINTLEFT$(FL$,NC-5);:NEXT 6110 GOSUB6230:GOSUB2330:PRINTFL$;:LSETFL$="":GOSUB2330:PRINTFL$;:RETURN 6140 V=U*L:Y$="":FORK=0TONSTEPS:GOSUB6160:Y$=Y$+X$:NEXT:LSETFL$=Y$:RETURN 6160 I=C(K):IFI>(V-U/2)THENRSETX$=LCHAR$:RETURN 6170 IFI>(V-U)THENRSETX$=HLCHAR$:RETURN 6180 IFI<=(V-U)ORL>1THENRSETX$=NOCHAR$:RETURN 6190 IFI>0ANDI<=U/2ANDL=1THENRSETX$=NOT0CHAR$:RETURN 6200 PROMPT$="hist_prt error":GOSUB2270:RETURN 6220 W$=SPACE$(4):RSETW$=ARG$:LSETFL$=" % "+W$+": "+W$(FPTR):RETURN 6230 Y$=SPACE$(5):RSETY$=ARG$+" ":FORK=0TONSTEPS:IFK<NSTEPSTHENRSETX$=STR$(LOW+K*INCR) 6260 IFK=NSTEPSTHENRSETX$=STR$(LOW+(K-1)*INCR):X$=X$+"+ 6270 Y$=Y$+X$:NEXT:LSETFL$=Y$:RETURN 6310 IFFILSPEC$=""THENGOSUB3190:RETURN 6320 MD=FUNC:X$="STATISTICAL ROUTINES":GOSUB1980:GOSUB6800:IFFCMD=QRETTHENRETURN 6350 IFFCMD<>0THEN6310 6360 GOSUB6660:FORZPTR=1TOC(0):FPTR=C(ZPTR):GOSUB6410:GOSUB6710:NEXT:FORJ=C(0)+3TOFL:GOSUB2330:PRINTFL$;:NEXT:PROMPT$="FUNCTION COMPLETED":GOSUB1790:IFFCMD=QRETTHENRETURN 6400 GOTO6310 6410 V1=0:V2=0:VLOW=1E+06:VHIGH=-1E+06:CCASE=0:NSEL=0:SEL=1:WHILESEL>0:GOSUB2760:IFSEL>0THENGOSUB6480 6450 WEND:IFMFLAG<>0THENGOSUB6550 6470 RETURN 6480 V=V(FPTR):V1=V1+V:V2=V2+V*V:IFV>VHIGHTHENVHIGH=V 6500 IFV<VLOWTHENVLOW=V 6510 IFMFLAG=0THENRETURN 6520 IFNSEL<MAXCASETHENU(NSEL-1)=V:RETURN 6530 PROMPT$="CAN'T CALCULATE MEAN:TOO MANY CASES":GOSUB2260:MFLAG=0:RETURN 6550 GAP=NSEL\2:WHILEGAP>0:FORI=GAPTONSEL-1:FORJ=I-GAPTO0STEP-GAP:IFU(J)>U(J+GAP)THENSWAPU(J),U(J+GAP) ELSEJ=0 6600 NEXT:NEXT:GAP=GAP\2:WEND:J=NSEL\2:IFJ<1THENRETURN 6640 IFNSELMOD2=0THENARG=(U(J)+U(J-1))/2:RETURN 6650 ARG=U(J):RETURN 6660 GOSUB2320:GOSUB2330:X$="VARIABLE VAR. MEAN STD.DEV. SM. LG. ":Y$="\ \ #.#^^^^ #####.# #####.# #####.# #####.#":PRINTX$;:IFMFLAG<>0THENPRINT" MEDIAN"; 6700 RETURN 6710 IFFPTR>BDEFSTHENF$="d":J=FPTR-BDEFS 6720 IFFPTR<BDEFSTHENF$="x":J=FPTR-BVARS 6730 W$=SPACE$(18):RSETW$=F$+MID$(STR$(J),2)+": "+W$(FPTR):P=ZPTR:GOSUB7010:IFNSEL<1THENPRINTW$" NO CASES SELECTED";:RETURN 6760 V=(V2-(V1*V1)/NSEL)/NSEL:PRINTUSINGY$;W$,V,V1/NSEL,SQR(V),VLOW,VHIGH;:IFMFLAG<>0THENPRINTUSING" ####.#";ARG; 6790 RETURN 6800 GOSUB2300:FORJ=0TOMAXSTEPS:C(J)=0:NEXT:GOSUB6930:IFFCMD=QRETTHENRETURN 6820 IFFCMD=ESCORFCMD=REDOTHEN6800 6830 PROMPT$="CALCULATE MEDIAN":GOSUB1770:IFFCMD=QRETTHENRETURN 6850 IFFCMD=REDOTHEN6800 6860 MFLAG=0:IFX$="Y"THENMFLAG=1 6870 P=C(0)+2:GOSUB7010:IFMFLAG=1THENPRINTPROMPT$; 6890 IFMFLAG=0THENPRINT"DO NOT CALCULATE MEDIAN 6900 PROMPT$="":GOSUB1790:IFFCMD=REDOTHEN6800 6920 RETURN 6930 PROMPT$="ENTER VARIABLE":GOSUB4980:IFFCMD=ESCTHEN6930 6950 IFFCMD<>0THENRETURN 6960 J=C(0)+1:C(J)=FPTR:C(0)=J:W$=SPACE$(6):RSETW$=ARG$+": ":P=J:GOSUB7010:PRINTW$W$(FPTR);:IFC(0)=MAXSTEPSTHENRETURN 7000 GOTO6930 7010 P=FP+P+3:Q=FQ+3:GOSUB1610:RETURN 7030 IFFILSPEC$=""THENGOSUB3190:RETURN 7040 MD=SCAT:X$="SCATTERPLOT":GOSUB1980 7050 GOSUB7210:IFFCMD=QRETTHENRETURN 7060 IFFCMD=ESCTHEN7030 7070 U1=0:U2=0:V1=0:V2=0:UHIGH=-1E+06:ULOW=1E+06:VLOW=ULOW:VHIGH=UHIGH:CCASE=0:NSEL=0:SEL=1:WHILESEL>0:GOSUB2760:IFSEL>0THENGOSUB7340 7110 WEND:IFNSEL=0THENPROMPT$="NO CASES SELECTED":GOSUB1790:GOTO7050 7120 U=SQR((U2-(U1*U1)/NSEL)/NSEL):V=SQR((V2-(V1*V1)/NSEL)/NSEL):U1=U1/NSEL:V1=V1/NSEL:GOSUB7410:CCASE=0:NSEL=0:SEL=1:WHILESEL>0:GOSUB2760:IFSEL>0THENGOSUB7480 7170 WEND:GOSUB7510:PROMPT$="FUNCTION COMPLETED":GOSUB1790:IFFCMD=QRETTHENRETURN 7200 GOTO7030 7210 GOSUB2300:PROMPT$="VARIABLE TO PLOT ON X-AXIS":GOSUB4980:IFFCMD<>0THENRETURN 7240 C(1)=FPTR:W$=SPACE$(6):RSETW$=ARG$+": ":P=1:GOSUB7010:PRINTPROMPT$" "W$W$(FPTR);:PROMPT$="VARIABLE TO PLOT ON Y-AXIS":GOSUB4980:IFFCMD=ESCTHEN7210 7280 IFFCMD=QRETTHENRETURN 7290 C(2)=FPTR:W$=SPACE$(6):RSETW$=ARG$+": ":P=2:GOSUB7010:PRINTPROMPT$" "W$W$(FPTR);:PROMPT$="":GOSUB1790:IFFCMD=ESCORFCMD=REDOTHEN7210 7330 RETURN 7340 U=V(C(1)):V=V(C(2)):U1=U1+U:U2=U2+U*U:V1=V1+V:V2=V2+V*V:IFU<ULOWTHENULOW=U 7370 IFV<VLOWTHENVLOW=V 7380 IFU>UHIGHTHENUHIGH=U 7390 IFV>VHIGHTHENVHIGH=V 7400 RETURN 7410 GOSUB2300:FPTR=C(1):GOSUB7520:P=6:Q=26:GOSUB1610:PRINTW$;:Q=37:P=7:GOSUB1610:PRINT"+3";:X$="||":Q=40:FORP=7TO19:GOSUB1610:PRINTX$;:NEXT:Q=43:P=19:GOSUB1610:PRINT"-3";:FPTR=C(2):GOSUB7520:P=13:Q=FQ+2:GOSUB1610:PRINTW$; 7445 Q=28:P=14:GOSUB1610:PRINT"-3";:X$="| ":P=13:FORQ=28TO38STEP2:GOSUB1610:PRINTX$;:NEXT:X$=" |":P=13:FORQ=42TO52STEP2:GOSUB1610:PRINTX$;:NEXT:Q=52:P=12:GOSUB1610:PRINT"+3";:RETURN 7480 IFV=0THENP=0:GOTO7490 7485 ARG=(V(C(2))-V1)/V:P=FIX((0.25*SGN(ARG)+ARG)*2):IFABS(P)>5THENP=SGN(P)*5 7490 IFU=0THENQ=0:GOTO7500 7495 ARG=(V(C(1))-U1)/U:Q=FIX((0.25*SGN(ARG)+ARG)*2):IFABS(Q)>5THENQ=SGN(Q)*5 7500 P=-P+13:Q=40+2*Q:GOSUB1610:PRINT"<>";:RETURN 7510 P=12:GOSUB7010:PRINTFL$;:RETURN 7520 IFFPTR>BDEFSTHENF$="d":J=FPTR-BDEFS 7530 IFFPTR<BDEFSTHENF$="x":J=FPTR-BVARS 7540 W$=SPACE$(18):RSETW$=F$+MID$(STR$(J),2)+": "+W$(FPTR):RETURN