home *** CD-ROM | disk | FTP | other *** search
/ Play and Learn 2 / 19941.ZIP / 19941 / EDUCMATH / STATS / EPISTAT.BAS (.txt) < prev    next >
Encoding:
GW-BASIC  |  1994-02-04  |  10.9 KB  |  159 lines

  1. 1  '                    INTRODUCTION TO EPISTAT
  2. 2  '               Copyright Tracy L. Gustafson, M.D.
  3. 3  '              Round Rock, Texas. Version 3.2, 1985
  4. 5  CLEAR,,1024:OPTION BASE 1:DEFINT A-C,N,T,Z:DEFSTR D
  5. 10  DEF SEG=64:A=PEEK(23):IF NOT(A AND 32) THEN POKE 23,(A OR 32)
  6. 15  DEF SEG:KEY OFF:WIDTH 80:SCREEN 0,0,0:COLOR 7,0,0:CLS
  7. 20  PRINT TAB(14);"THENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENUSER-SUPPORTED SOFTWARETHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHEN"
  8. 25  LOCATE 4,8,1,1,13:PRINT STRING$(61,178)
  9. 30  PRINT TAB(8);"WENDWEND                                                         WENDWEND"
  10. 35  PRINT TAB(8);"WENDWEND      EPISTAT is a statistical package designed for      WENDWEND"
  11. 40  PRINT TAB(8);"WENDWEND             the analysis of small data sets.            WENDWEND"
  12. 45  PRINT TAB(8);"WENDWEND   If, after using the programs, you find them useful,   WENDWEND"
  13. 50  PRINT TAB(8);"WENDWEND  your contribution ($25 suggested) will be appreciated. WENDWEND"
  14. 55  PRINT TAB(8);"WENDWEND                                                         WENDWEND"
  15. 60  PRINT TAB(8);"WENDWEND  Send contributions to:                                 WENDWEND"
  16. 65  PRINT TAB(8);"WENDWEND              Tracy L. Gustafson, M.D.                   WENDWEND"
  17. 70  PRINT TAB(8);"WENDWEND              1705 Gattis School Road                    WENDWEND"
  18. 75  PRINT TAB(8);"WENDWEND              Round Rock, Texas  78664                   WENDWEND"
  19. 80  PRINT TAB(8);"WENDWEND                                                         WENDWEND"
  20. 85  PRINT TAB(8);"WENDWEND    All users may copy and distribute these programs     WENDWEND"
  21. 90  PRINT TAB(8);"WENDWEND                     provided:                           WENDWEND"
  22. 95  PRINT TAB(8);"WENDWEND  1.)  The programs are not altered in any way.          WENDWEND"
  23. 100  PRINT TAB(8);"WENDWEND  2.)  No fee is charged for copying or distribution.    WENDWEND"
  24. 105  PRINT TAB(8);"WENDWEND                                                         WENDWEND"
  25. 110  PRINT TAB(8);"WENDWEND         Copyright (c) 1985 Tracy L. Gustafson           WENDWEND"
  26. 115  PRINT TAB(8);STRING$(61,178):PLAY "MS O3 L64 G O2 GE L9 E"
  27. 120  FOR Z=1 TO 100:NEXT:CLR1=7:CLR2=0:CLR3=0:SCRN=0:ON ERROR GOTO 760
  28. 125  PRINT:PRINT TAB(10);:INPUT "Do you want to change COLORS or hardware configuration? ",A$:IF A$<>"y" AND A$<>"Y" THEN 265
  29. 130  CLS:DEF SEG=0:IF (PEEK(1040) AND 48)<>48 THEN 150
  30. 135  DEF SEG=&HB800:POKE 0,0:IF PEEK(0)<>0 THEN 190
  31. 140  INPUT "Select COLOR (C) or MONOCHROME (M) adapter:  ",A$
  32. 145  IF A$="M" OR A$="m" THEN 190 ELSE IF A$<>"C" AND A$<>"c" THEN BEEP:GOTO 140
  33. 150  DEF SEG=0:POKE 1040,(PEEK(1040) AND 207) OR 32
  34. 155  DEF SEG:SCREEN 0,1,0:LOCATE 5,10:COLOR 0,7:PRINT 0;:COLOR ,0:PRINT TAB(45);:COLOR 8:PRINT 8;STRING$(25,219)
  35. 160  FOR Z=1 TO 7:LOCATE 5+Z,10:COLOR Z,0:PRINT Z;STRING$(25,219);:COLOR 7,0:PRINT TAB(45);:COLOR Z+8:PRINT USING "##";Z+8;:PRINT" ";STRING$(25,219):NEXT
  36. 165  COLOR 7,0:PRINT:PRINT TAB(15);:INPUT "ENTER your color choices for:  FOREGROUND = ",CLR1
  37. 170  PRINT TAB(46);:INPUT "BACKGROUND = ",CLR2
  38. 175  PRINT TAB(50);:INPUT "BORDER = ",CLR3
  39. 180  IF CLR1=7 AND CLR2=0 AND CLR3=0 THEN SCRN=0 ELSE SCRN=1
  40. 185  SCREEN 0,SCRN,0:COLOR CLR1,CLR2,CLR3:PRINT
  41. 190  DEF SEG:PRINT "1.) Epson";TAB(15);"2.) IBM";TAB(28);"3.) Okidata";TAB(43);"4.) Prowriter";TAB(60);"5.) Other make";TAB(79)
  42. 195  PRINT TAB(20);:INPUT "Enter your printer make:   ",PMAK:IF ABS(PMAK-3)>2 THEN BEEP:GOTO 195 ELSE PRINT
  43. 200  PRINT TAB(15);:INPUT "Is your printer (A) 10, or (B) 15 inches wide?  ",A$
  44. 205  IF A$="A" THEN PRNT=80 ELSE IF A$="B" THEN PRNT=132 ELSE BEEP:GOTO 200
  45. 210  PRINT TAB(6);:INPUT "Do you want (1) pica, (2) elite or (3) compressed type?  ",AD:IF ABS(AD-2)>1 THEN BEEP:GOTO 210
  46. 215  IF PMAK <5 THEN 235 ELSE PRINT " Enter your printer's BASIC codes for ";:RESTORE 240:FOR Z=1 TO AD:READ D,XF:NEXT:PRINT D;" type:"
  47. 220  AR=CSRLIN:PRINT:LOCATE 24,5:PRINT "Enter CHR$()'s by pressing <Alt> and entering NUMBER on numeric keypad.";:LOCATE 25,19:PRINT "Press <Enter> when complete code entered.";
  48. 225  LOCATE AR-1,9,1:PRINT " ASCII CODE:  ";
  49. 230  A$=INKEY$:IF A$="" THEN 230 ELSE IF A$=CHR$(13) THEN TYP$=DT:GOTO 250 ELSE DT=DT+A$:PRINT ASC(A$);:GOTO 230
  50. 235  RESTORE 245:FOR Z=1 TO (PMAK-1)*3+AD:READ XF,A1,A2:NEXT
  51. 240  DATA "pica",1,"elite",1.2,"compressed",1.7
  52. 245  DATA 1,27,64,1.2,27,77,1.7,15,0,1,27,64,1.2,27,77,1.7,15,0,1,24,0,1.2,28,0,1.7,29,0,1,27,78,1.2,27,69,1.7,27,81
  53. 250  PRNT=INT(PRNT*XF):TYP$=CHR$(A1)+CHR$(A2)
  54. 255  OPEN "EPISETUP.DAT" FOR OUTPUT AS #1
  55. 260  WRITE #1,CLR1,CLR2,CLR3,SCRN,PRNT,TYP$,PMAK:CLOSE #1:GOTO 280
  56. 265  OPEN "EPISETUP.DAT" FOR INPUT AS #1
  57. 270  INPUT #1,CLR1,CLR2,CLR3,SCRN,PRNT,TYP$,PMAK:CLOSE #1
  58. 275  SCREEN 0,SCRN,0:COLOR CLR1,CLR2,CLR3
  59. 280  CLS:PRINT TAB(25);"KEY";STRING$(29,205);"CLOSE":PRINT TAB(25);"OPEN EPISTAT STATISTICAL PACKAGE OPEN"
  60. 285  PRINT TAB(25);"SCREEN";STRING$(29,205);"LOAD"
  61. 290  LOCATE 6,5:PRINT"Would you like to:":PRINT
  62. 295  PRINT TAB(19);"1.)  List the tests and functions available.":PRINT
  63. 300  PRINT TAB(19);"2.)  Determine the best test for your data.":PRINT
  64. 305  PRINT TAB(19);"3.)  Exit to run a specific test program."
  65. 310  LOCATE 15,24:INPUT "Enter choice:    ",ASUB:IF ABS(2-ASUB)>1 THEN BEEP:GOTO 310
  66. 315  CLS:ON ASUB GOTO 320,420,680
  67. 320  PRINT TAB(28);"TESTS AVAILABLE IN EPISTAT":PRINT TAB(28);STRING$(26,205)
  68. 325  PRINT:PRINT TAB(29);"PROGRAM";TAB(69);"PROGRAM"
  69. 330  PRINT "TEST OR FUNCTION";TAB(30);"NAME";TAB(42);"TEST OR FUNCTION";TAB(70);"NAME"
  70. 335  PRINT STRING$(16,196);TAB(29);"SOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUND";TAB(42);STRING$(16,196);TAB(69);"SOUNDSOUNDSOUNDSOUNDSOUNDSOUNDSOUND"
  71. 340  PRINT "Analysis of variance........ANOVA*";TAB(42);"McNemar's test.............MCNEMAR"
  72. 345  PRINT "Bayes' theorem..............BAYES";TAB(42);"Mean, Median and S.Dev.....DATA-ONE*"
  73. 350  PRINT "Binomial distribution.......BINOMIAL";TAB(42);"Normal distribution........NORMAL*"
  74. 355  PRINT "Chi-square test.............CHISQR";TAB(42);"Poisson distribution.......POISSON"
  75. 360  PRINT "Correlation coefficients....CORRELAT*";TAB(42);"Random sample generator....RANDOMIZ"
  76. 365  PRINT "Crosstab reports............XTAB*";TAB(42);"Rank sum test..............RANKTEST*"
  77. 370  PRINT "F Distribution..............ANOVA*";TAB(42);"Rates adjusted.............RATEADJ*"
  78. 375  PRINT "Fisher's exact test.........FISHERS";TAB(42);"Sample size determination..SAMPLSIZ"
  79. 380  PRINT "Graph histogram.............HISTOGRM*";TAB(42);"Select specific records....SELECT*"
  80. 385  PRINT "Graph scattergram...........SCATRGRM*";TAB(42);"Signed rank test...........RANKTEST*"
  81. 390  PRINT "Linear regression...........LNREGRES*";TAB(42);"Student's T test...........T-TEST*"
  82. 395  PRINT "Mantel-Haenszel Chi-square..MHCHISQR";TAB(42);"Transfer data between"
  83. 400  PRINT "Mantel-Haenszel for";TAB(45);"two EPISTAT files.......FILETRAN*"
  84. 405  PRINT TAB(3);"multiple controls/case....MHCHIMLT*";TAB(42);"Transfer data from"
  85. 410  PRINT TAB(45);"FORTRAN datafiles.......FORTRANS*"
  86. 415  LOCATE 24,5:PRINT "*Starred programs can evaluate data entered and saved using DATA-ONE.";:GOTO 740
  87. 420  CLS:PRINT TAB(22);"DETERMINING THE BEST STATISTICAL TEST":PRINT TAB(22);STRING$(37,205)
  88. 425  LOCATE 5,5:PRINT "Do you want to consider:":PRINT
  89. 430  PRINT TAB(24);"1.)  Tests for a single sample":PRINT
  90. 435  PRINT TAB(24);"2.)  Tests for 2 or more samples":PRINT
  91. 440  PRINT TAB(24);"3.)  Other statistical functions":PRINT
  92. 445  PRINT TAB(24);"4.)  Data handling utilities":PRINT
  93. 450  PRINT TAB(24);"5.)  Return to main menu"
  94. 455  LOCATE 18,29:INPUT "Enter choice:   ",ASUB:IF ABS(ASUB-3)>2 THEN BEEP:GOTO 455
  95. 460  CLS:ON ASUB GOTO 465,495,605,635,280
  96. 465  PRINT TAB(28);"TESTS FOR A SINGLE SAMPLE":PRINT
  97. 470  PRINT "The following tests compare an observed number":PRINT TAB(37);"to the expected (population) rate:":PRINT:PRINT
  98. 475  PRINT "[BINOMIAL]:  The Binomial distribution applies when a dichotomous variable":PRINT TAB(14);"has an equal probability of occurring on each of N trials.":PRINT
  99. 480  PRINT "[NORMAL]  :  The Normal distribution applies to continuous and dichotomous": PRINT TAB(14);"variables when the sample size is >30 and normally distributed."
  100. 485  PRINT TAB(14);"Specifically used when comparing a sample mean with a": PRINT TAB(14);"population mean.":PRINT
  101. 490  PRINT "[POISSON] :  The Poisson distribution applies when a dichotomous variable":PRINT TAB(14);"has a known probability of occurring on each trial,":PRINT TAB(14);"but the number of trials is not known.":GOTO 750
  102. 495  PRINT TAB(27);"TESTS FOR TWO OR MORE SAMPLES":PRINT
  103. 500  INPUT "Is the variable under consideration probably normally distributed? (Y or N)  ",A$
  104. 505  IF A$="Y" OR A$="y" THEN 530 ELSE IF A$="N" OR A$="n" THEN 510 ELSE BEEP:GOTO 500
  105. 510  PRINT:PRINT:PRINT "[RANKTEST]:   The Signed Rank Test compares the medians of paired samples."
  106. 515  PRINT TAB(15);"The Rank Sum Test compares the medians of independent samples.":PRINT
  107. 520  PRINT "[CORRELAT]:   Includes Spearman's Rank Correlation":PRINT
  108. 525  PRINT:PRINT " (NOTE: Both the T-TEST and ANOVA usually can be safely applied to":PRINT TAB(9);"nonparametric data sets that contain more than 30 observations/sample.":GOTO 750
  109. 530  PRINT:PRINT TAB(27);"NORMALLY DISTRIBUTED SAMPLES":PRINT
  110. 535  PRINT TAB(12);:INPUT"Are these samples paired (P) or independent (I)?   ",A$
  111. 540  IF A$="P" OR A$="p" THEN 545 ELSE IF A$="i" OR A$="I" THEN 575 ELSE BEEP:GOTO 535
  112. 545  PRINT:PRINT "[ANOVA]   :  TWO-WAY Analysis of Variance evaluates the combined effects":PRINT TAB(14);"of two variables on a third (ROW and COLUMN effects)"
  113. 550  PRINT:PRINT "[CORRELAT]:  Includes Pearson's correlation coefficient.":PRINT
  114. 555  PRINT "[LNREGRES]:  Linear Regression analysis evaluates linear association.":PRINT
  115. 560  PRINT "[MCNEMAR] :  McNemar's test compares paired dichotomous variables.":PRINT
  116. 565  PRINT "[MHCHIMLT]:  Mantel-Haenszel Chi-square for multiple controls compares":PRINT TAB(14);"dichotomous variables with several controls per case.":PRINT
  117. 570  PRINT "[T-TEST]  :  The paired T-Test compares means of continuous variables.":GOTO 750
  118. 575  PRINT:PRINT "[ANOVA]  :   ONE-WAY Analysis of Variance compares the means of":PRINT TAB(14);"3 or more samples."
  119. 580  PRINT TAB(14);"TWO-WAY Analysis of Variance evaluates the combined effects":PRINT TAB(14);"of 2 variables on a third variable.":PRINT
  120. 585  PRINT "[CHISQR]  :  Chi-square Test compares discrete variables when":PRINT TAB(14);"the expected value for each cell is > 5.":PRINT
  121. 590  PRINT "[FISHERS] :  Fisher's Exact Test compares dichotomous variables.":PRINT
  122. 595  PRINT "[MHCHISQR]:  Mantel-Haenszel Chi-square Test compares a dichotomous":PRINT TAB(14);"variable while controlling for another factor.":PRINT
  123. 600  PRINT "[T-TEST]  :  The unpaired T-Test compares the means of continuous variables.":GOTO 750
  124. 605  PRINT TAB(27);"OTHER STATISTICAL FUNCTIONS":PRINT:PRINT
  125. 610  PRINT "[BAYES]   :  Bayes theorem evaluates the predictive power of a":PRINT TAB(14);"diagnostic test or variable.":PRINT
  126. 615  PRINT "[NORMAL]  :  The Normal distribution calculates the percent of":PRINT TAB(14);"test values expected to fall within a given range.":PRINT
  127. 620  PRINT "[RATEADJ] :  Direct and indirect rate adjustments are performed to":PRINT TAB(14);"make a sample comparable to a standard.":PRINT
  128. 625  PRINT "[RANDOMIZ]:  Selects a random sample for survey or study.":PRINT
  129. 630  PRINT "[SAMPLSIZ]:  Calculates the appropriate sample sizes for surveys,":PRINT TAB(14);"paired and unpaired studies.":GOTO 750
  130. 635  PRINT TAB(27);"DATA HANDLING UTILITIES":PRINT:PRINT
  131. 640  PRINT "[DATA-ONE]:   Input, edit, sort and print data.":PRINT
  132. 645  PRINT "[FILETRAN]:   Transfer samples between EPISTAT datafiles.":PRINT
  133. 650  PRINT "[FORTRANS]:   Transfer data from flat card-image FORTRAN files.":PRINT
  134. 655  PRINT "[HISTOGRM]:   Graph a histogram on screen or printer.":PRINT
  135. 660  PRINT "[LNREGRES]:   Provides data transformations.":PRINT
  136. 665  PRINT "[SCATRGRM]:   Graph a scattergram on screen or printer.":PRINT
  137. 670  PRINT "[SELECT]  :   Generates a new datafile containing selected subset":PRINT TAB(15);"of the original records or cases.":PRINT
  138. 675  PRINT "[XTAB]    :   Produces 1, 2 or 3-way crosstab reports.":GOTO 750
  139. 680  PRINT TAB(24);"RUNNING EPISTAT STATISTICAL PROGRAMS"
  140. 685  PRINT TAB(24);STRING$(36,205):PRINT:PRINT
  141. 690  PRINT TAB(3);"Determine the program name (PROGNAME) from Section 1 or 2, then enter: "
  142. 695  PRINT:PRINT TAB(30);"RUN ";CHR$(34);"PROGNAME";CHR$(34):PRINT
  143. 700  PRINT "Or select the program number below:":PRINT
  144. 705  RESTORE 730:FOR Z=1 TO 10:LOCATE Z+10,10:READ D:PRINT Z;D:NEXT
  145. 710  FOR Z=11 TO 20:LOCATE Z,30:READ D:PRINT Z;D:NEXT
  146. 715  FOR Z=21 TO 25:LOCATE Z-10,50:READ D:PRINT Z;D:NEXT
  147. 720  LOCATE 25,16:INPUT;"Enter choice (Press RETURN to exit):  ",AD
  148. 725  IF AD>0 AND AD<26 THEN RESTORE 730:FOR Z=1 TO AD:READ D:NEXT:RUN D
  149. 730  DATA "EPISTAT","DATA-ONE","ANOVA","BAYES","BINOMIAL","CHISQR","CORRELAT","FILETRAN","FISHERS","FORTRANS","HISTOGRM","LNREGRES","MHCHISQR","MHCHIMLT"
  150. 735  DATA "MCNEMAR","NORMAL","POISSON","RANDOMIZ","RANKTEST","RATEADJ","SAMPLSIZ","SCATRGRM","SELECT","T-TEST","XTAB"
  151. 737  LOCATE 23,1:SYSTEM
  152. 740  LOCATE 25,20:PRINT"Press any key to return to main menu:";
  153. 745  A$=INKEY$:IF A$="" THEN 745 ELSE 280
  154. 750  LOCATE 25,20:PRINT "Press space bar to return to menu:";
  155. 755  A$=INKEY$:IF A$=CHR$(32) THEN 420 ELSE 755
  156. 760  BEEP:IF ERR<>71 AND ERR<>70 AND ERR<>53 THEN 770 ELSE LOCATE 2,10:PRINT "Please place EPISTAT in drive A: (or other default).":PRINT TAB(25);"Press any key to continue:"
  157. 765  A$=INKEY$:IF A$="" THEN 765 ELSE RESUME
  158. 770  ON ERROR GOTO 0
  159.