Solved

Looking for BASICA

Posted on 1997-04-02
4
241 Views
Last Modified: 2012-06-21
I am looking for either a copy of BASICA, or instructions on how to
convert some BASICA programs into something that will run on a normal,
modern computer.  

My preference would be running these in their native environment, as I
am not a programmer and know very little about this process of
conversion - I only need to run some specialized programs on my machine.
I attempted conversion using QBASIC but recieved error messages I was
unable to deal with, so instructions on conversion would have to be very
BASIC!  I do have access to a Visual C++ compiler, if that helps.

The programs have been saved as ASCII files.  remline.bas is not present on my computer, but I removed the line numbers manually.  They can be opened with QBASIC. The problem is knowing what to do when clicking 'run' or 'step' causes QBASIC to stop and indicate a problem.

Here is a SAMPLE PROGRAM:

10 CLS
20 PRINT"          STATISTICAL ECOLOGY:  A PRIMER ON METHODS AND COMPUTING "
30 PRINT
40 PRINT "           I N T E R A C T I V E    B A S I C    P R O G R A M  "
45 PRINT
50 PRINT "                        S P A S S O C . B A S                    "
60 PRINT
70 PRINT "         --------------------------------------------------------"
80 PRINT "         THIS PROGRAM COMPUTES:"
90 PRINT"                  1. Variance Ratio Test for Detecting Presence of "
100 PRINT"                     OVERALL Associations in a Group of Species  "
110 PRINT"                  2. Chi-Square Test for Detecting Association   "
120 PRINT"                     between PAIRS of Species based on 2x2       "
130 PRINT"                     Contingency Table.  Statistics computed:    "
140 PRINT"                        A. UNCORRECTED CHI-SQUARE                "
150 PRINT"                        B. CORRECTED CHI-SQUARE (YATE'S)         "
160 PRINT"                  3. Indices that Measure the DEGREE of          "
170 PRINT"                     Association between pairs of species:       "
180 PRINT"                        A. Ochiai Index                          "
190 PRINT"                        B. Dice Index                            "
200 PRINT"                        B. Jaccard's Index                       "
210 PRINT"          --------------------------------------------------------"
220 PRINT
230 PRINT"PRESS ANY KEY TO CONTINUE"
240 IF INKEY$="" THEN 240
250 CLS
260 PRINT "- - - - - - - - - -PART I. DATA ENTRY- - - - - - - - - - ":PRINT ""
270 PRINT "This program utilizes PRESENCE/ABSENCE data of S species found  "
280 PRINT "   in N sampling units (SUs) (plots, stands, locations, etc.)   "
290 PRINT "                                                       "
300 PRINT "These data are organized into a DATA MATRIX where the  "
310 PRINT "   PRESENCE of a species in a SU is indicated by a 1   "
320 PRINT "   and its ABSENCE by a 0.                             "
330 PRINT "                                                       "
340 PRINT "                        SU                             "
350 PRINT "                1  2  3  4  5  6  7   ... N              "
360 PRINT "        SPECIES                                        "
370 PRINT "            1   1  1  0  1  1  1  0   ... 1            "
380 PRINT "            2   0  0  0  0  0  1  1   ... 0            "
390 PRINT "            3   1  1  1  1  1  0  0   ... 0            "
400 PRINT "                                                       "
410 PRINT "            S   1  1  0  0  0  1  0   ... 1            "
420 REM FOR I=1 TO 1:PRINT "":NEXT I
430 REM PRINT"PRESS ANY KEY TO CONTINUE"
440 REM IF INKEY$="" THEN 430
450 REM CLS
460 GOSUB 1750
470 CLS
480 PRINT "- - - -PART II.  VARIANCE RATIO TEST - - - - - - - ":PRINT ""
490 PRINT "This Section of the program computes 'V', an INDEX of ASSOCIATION.  "
500 PRINT "   Under the NULL hypothesis of NO ASSOCIATION between the S        "
510 PRINT "   SPECIES, the EXPECTED value of V is 1.0.                         "
520 PRINT "     If V > 1, possible OVERALL POSITIVE association                "
530 PRINT "     If V < 1, possible OVERALL NEGATIVE association                "
540 PRINT "   This test is a method for assessing simultaneously whether   "
550 PRINT "   the species in the group are associated (Schluter, Ecology 65:"
560 PRINT "   998-1005, 1984)                                 ":PRINT
570 PRINT "A statistic,'W', is computed that may be used to test whether    "
580 PRINT "   deviations from 1 are significant. For example, if the species   "
590 PRINT "   are NOT associated, then there is a 90% probability that W       "
600 PRINT "   lies between limits given by the CHI-SQUARE distribution:        "
610 PRINT "          2                     2                               "
620 PRINT "         X      <=   W    <=   X                                "
630 PRINT "          .05,N                 .95,N                           "
640 REM COMPUTE Tj=#species in jth SU, Ni=# SUs where ith species found
650 FOR SP=1 TO S:  FOR SU=1 TO N
660     IF F(SP,SU)=1 THEN NI(SP)=NI(SP)+1
670 NEXT SU: NEXT SP
680 FOR SU=1 TO N:  FOR SP=1 TO S
690     IF F(SP,SU)=1 THEN TJ(SU)=TJ(SU)+1
700 NEXT SP: NEXT SU
710 REM COMPUTE SUM OF VARS FOR OCCURRANCES OF INDIV SPECIES IN SUs
720 SUMIVAR=0
730 FOR SP=1 TO S
740     SUMIVAR=SUMIVAR + NI(SP)/N * (1!-NI(SP)/N)
750 NEXT SP
760 REM COMPUTE SUM OF VAR IN TOTAL SPECIES NUMBER
770 SUMT=0  : FOR SU=1 TO N
780     SUMT=SUMT+TJ(SU)
790 NEXT SU : MEANT = SUMT/N                :' MEAN # SPECIES/SU
800 SUMTVAR=0: FOR SU=1 TO N
810     SUMTVAR=SUMTVAR + (TJ(SU)-MEANT)^2
820 NEXT SU
830 TSPVAR = (1/N)*SUMTVAR
840 REM COMPUTE V RATIO: INDEX OF SPECIES ASSOCIATION
850     V = TSPVAR/SUMIVAR
860 PRINT"VR, Index of OVERALL Association..............";V
870 IF V>1 THEN PRINT" (Since V > 1 possible POSITIVE association)"
880 IF V<1 THEN PRINT" (Since V < 1 possible NEGATIVE association)"
890 PRINT"W, Test Statistic............................";V*N
900 PRINT
910 PRINT"PRESS ANY KEY TO CONTINUE"
920 IF INKEY$="" THEN 920
930 CLS
940 PRINT "- - -PART III. CHI-SQUARE TEST FOR PAIR-WISE SPECIES- - - ":PRINT
950 PRINT "This portion of the program computes a CHI-SQUARE statistic for "
960 PRINT "   testing the NULL hypothesis that a PAIR OF SPECIES are       "
970 PRINT "   independently distributed among the sampling units.":PRINT
980 PRINT "This statistic is computed from a 2 X 2 CONTINGENCY TABLE       "
990 PRINT "   and is compared to a Chi-Square TABLE with 1 df;              "
1000 PRINT "   This critical value is 3.84. A CORRECTED Chi-Square value   "
1010 PRINT "   is also computed using Yates correction factor":PRINT
1020 PRINT "NOTE:  If any cell in the CONTINGENGY TABLE has an expected     "
1030 PRINT "   frequency < 1 OR if more than 2 of the cells have expected   "
1040 PRINT "   frequencies < 5, then the resulting CHI-SQUARE will be biased"
1050 PRINT "   (Zar, Biostatistical Analysis, Prentice-Hall 1984 pp 70)     "
1060 PRINT "   SUCH BIASED CHI-SQUARE VALUES ARE SO-INDICATED IN THIS PROGRAM"
1070 PRINT
1080 PRINT "NOTE:  If any species is present or absent in ALL of the sampling"
1090 PRINT "   units, it is considered INDETERMINANT and a Chi-Square value"
1100 PRINT "   cannot be computed."
1110 FOR I=1 TO 2:PRINT "":NEXT I
1120 PRINT"PRESS ANY KEY TO CONTINUE"
1130 IF INKEY$="" THEN 1130
1140 CLS
1150 PRINT"CHI-SQ STATISTIC, OCHIAI, DICE, & JACCARD'S ASSOCIATION INDICES     "
1160 PRINT
1170 GOSUB 2340
1180 REM COMPUTE 2 X 2 CONTINGENCY TABLE FOR EACH PAIR OF SPECIES
1190     COUNTER=0                             'INITIALIZE COUNTERS
1200     FOR SP=1 TO S-1: FOR SPP=SP+1 TO S
1210     A=0: B=0: C=0: D=0                    'INIT. CELLS OF 2X2 TABLE
1220     FOR SU=1 TO N
1230     IF F(SP,SU)=1 AND F(SPP,SU)=1 THEN A=A+1
1240     IF F(SP,SU)=1 AND F(SPP,SU)=0 THEN B=B+1
1250     IF F(SP,SU)=0 AND F(SPP,SU)=1 THEN C=C+1
1260     IF F(SP,SU)=0 AND F(SPP,SU)=0 THEN D=D+1
1270     NEXT SU
1280     MM=A+B: NN=C+D: RR=A+C: SS=B+D:       'ROW & COLUMN TOTALS
1290     DET = A*D - B*C                       'DETERMINANT OF 2X2 TABLE
1300     IF MM=N OR NN=N OR RR=N OR SS=N THEN GOTO 1540 'CK FOR INDETER SP
1310 REM COMPUTE EXPECTED VALUES FOR CELLS OF 2 X 2 TABLE
1320     EXPA=MM*RR/N
1330     EXPB=MM*SS/N
1340     EXPC=RR*NN/N
1350     EXPD=SS*NN/N
1360 REM CHECK FOR BIAS IN CHI-SQUARE
1370     BIA=0: IF EXPA<5 THEN BIA=BIA+1
1380            IF EXPB<5 THEN BIA=BIA+1
1390            IF EXPC<5 THEN BIA=BIA+1
1400            IF EXPD<5 THEN BIA=BIA+1
1410     BIS=0: IF EXPA<1 THEN BIS=1
1420            IF EXPB<1 THEN BIS=1
1430            IF EXPC<1 THEN BIS=1
1440            IF EXPD<1 THEN BIS=1
1450     IF BIA>1 OR BIS=1 THEN BIAS$="*" ELSE BIAS$=" "
1460 REM COMPUTE ASSOCATION INDICES & CHI SQUARE
1470     OCHIAI =A/(SQR(A+B)*SQR(A+C))
1480     DICE   =2*A/(2*A+B+C)
1490     JACCARD=A/(A+B+C)
1500     IF A*D >=B*C THEN ASSOC$="+"  ELSE ASSOC$="-"     'DETER ASSOC
1510     CHISQ=(N*DET^2)/(MM*NN*RR*SS):                    'CHI-SQUARE
1520     CHISQC=(N*(ABS(DET)-N/2)^2)/(MM*NN*RR*SS):        'CHI-SQ YATES CORR
1530 GOTO 1600
1540 REM SET CHI-SQ OF INDETERMINANT SPECIES EQUAL TO 0
1550     CHISQ=0 : CHISQC=0
1560     BIAS$="INDETERMINATE SPECIES
1570 PRINT USING "####";SP,SPP;
1580 PRINT"                  ";BIAS$
1590 GOTO 1640
1600 PRINT USING "####";SP,SPP;
1610 PRINT"        ";ASSOC$;"        ";BIAS$;
1620 PRINT USING "####.###";CHISQ;
1630 PRINT USING "#######.###";CHISQC;OCHIAI,DICE,JACCARD
1640 COUNTER=COUNTER+1: IF COUNTER<18 THEN GOTO 1690
1650     COUNTER=0
1660     PRINT"PRESS ANY KEY TO CONTINUE"
1670     IF INKEY$="" THEN 1670
1680     GOSUB 2340
1690 NEXT SPP: NEXT SP
1700 PRINT:PRINT"NOTE: Chi-Square values are considered BIASED if: "
1710 PRINT"     (1) The EXPECTED FREQ of ANY cell in 2X2 TABLE < 1 and/or "
1720 PRINT"     (2) The EXPECTED FREQ of MORE than 2 CELLS < 5 (Zar 1984) "
1730 END
1740 REM -----------SUBROUTINE FOR DATA ENTRY---------------------------
1750 PRINT"Data INPUT options:                                            "
1760 PRINT"     Option 1 - Data already exists in a STORED data file      "
1770 PRINT"     Option 2 - Data is to be manually entered from keyboard   "
1780 PRINT"                (and subsequently STORED, if desired)          "
1790 INPUT"Choose OPTION:  Enter 1 OR 2  "; OPT
1800 IF OPT=1 THEN GOTO 2050 ELSE IF OPT <> 2  THEN GOTO 1790
1810 INPUT"INPUT Number of SUs.......",N
1820 INPUT"INPUT Number of Species...",S
1830 DIM F(S,N),TJ(N),NI(S)
1840 PRINT ""
1850 PRINT"The data matrix is created one COLUMN (or SU) at a time.      "
1860 PRINT" ENTER 1 for PRESENCE and 0 for ABSENCE of a species in a SU   "
1870 PRINT
1880 FOR SU=1 TO N
1890 FOR SP=1 TO S
1900 PRINT "SPECIES ";SP;" in SU ";SU;
1910 INPUT " = ";F(SP,SU)
1920 NEXT SP: NEXT SU
1930 INPUT "STORE This DATASET ON DISK ? (ENTER Y for YES / N for NO) ";A$
1940 IF A$="N" OR A$="n" THEN GOTO 2170 GOTO 1930
1950 INPUT "Specify a name for this DATASET (e.g., ASSOC.DAT) ";OUTDAT$
1960 INPUT "Specify DISK drive: ENTER A, B, C, etc.  ";DD$
1970 DD$=DD$+":"
1980 OUTDAT$=DD$+OUTDAT$
1990 OPEN OUTDAT$ FOR OUTPUT AS #1
2000 FOR SU=1 TO N
2010 FOR SP=1 TO S
2020 WRITE #1,F(SP,SU)
2030 NEXT SP: NEXT SU
2040 GOTO 2170
2050 INPUT"Specify name of DATA File (e.g., ASSOC.DAT) "; DATAFIL$
2060 INPUT"Specify DISK DRIVE where located: A, B, C, etc. ";DD$
2070 DD$=DD$+":"
2080 INPUT"INPUT Number of SUs.......",N
2090 INPUT"INPUT Number of Species...",S
2100 DIM F(S,N),TJ(N),NI(S)
2110 FILENAM$ = DD$ + DATAFIL$
2120 OPEN "I",#1,FILENAM$
2130 FOR SU=1 TO N
2140 FOR SP=1 TO S
2150 INPUT #1, F(SP,SU)
2160 NEXT  SP: NEXT SU
2170 INPUT"Would you like to list the DATA ? (Y for Yes / N for NO) ";A$
2180 IF A$="Y" OR A$="y" THEN GOTO 2190 ELSE GOTO 2290
2190 PRINT"LISTING OF THE DATA SET. ROWS=species, COLUMNS=SUs        "
2200 PRINT " "
2210 FOR SP=1 TO S
2220 FOR SU=1 TO N
2230 PRINT F(SP,SU);
2240 NEXT SU:PRINT
2250 NEXT SP
2260 FOR I=1 TO 2:PRINT "":NEXT I
2270 PRINT"PRESS ANY KEY TO CONTINUE"
2280 IF INKEY$="" THEN 2280
2290 CLOSE #1
2300 RETURN
2310 RETURN
2320 REM -----------SUBROUTINE FOR PRINTING OUTPUT ---------------------
2340 PRINT"                                     Chi-Square                     "
2350 PRINT"  SPECIES  ASSOCIATION  Chi-Square   (Continuity  |-----ASSOCIATION INDICES----|"
2360 PRINT"   PAIR     ( + OR -)   (* = biased) correction)  OCHIAI      DICE       JACCARD"
2370 PRINT"  -------  -----------  ------------ -----------  -----------------------------"
2380 RETURN

0
Comment
Question by:suobs
  • 2
4 Comments
 
LVL 1

Expert Comment

by:asmcmrr
ID: 1425001

  Could you show me an example of BASICA source that won't work in QBASIC?  I'm assuming you got it to "almost" compile, and that there were a few errors.  (and that you had saved the BASICA source file as ASCII text, rather than as a binary source file)
If it is in a binary saved format... you'd pretty much have to load it with BASICA (on some old machine)  and save it as an ascii file (I think, but I'm no BASICA/QBASIC expert)
SAVE "WHATEVER.BAS",A

  As for BASICA for MS-DOS... that died at version 3.30 or so, didn't it?  Running it on a modern computer would simply give an "incorrect DOS version" error. (I've tried it on MS-DOS v6.20)

  I've never experienced problems porting from GWBASIC, BASICA, BASIC, etc to QBASIC though...




0
 

Author Comment

by:suobs
ID: 1425002
Edited text of question
0
 
LVL 1

Expert Comment

by:asmcmrr
ID: 1425003

  I took this sample code and tried to compile it.  The code wasn't properly formatted to my knowledge, and even a BASICA shouldn't have compiled it properly.  It fixed it up here are there and got it to run without much understanding of what was what (I didn't spend much time at all, just tried to get it to compile).  The code compiled by re-arranging some lines which were causing problems. (The code dealing with arrays was a problem).  There are some other minute details, but with a little working it shouldn't be a problem compiling in QBASIC.

  As for a translator... I don't know of any direct conversion program.

0
 
LVL 2

Accepted Solution

by:
marcus_williamson earned 100 total points
ID: 1425004

This should work fine with QBASIC. Just leave the line numbers
in then use QBASIC.EXE


0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now