Basic Statistics

Author(s): Imre Auersbacher
Publication: The Plotter
Pub Details: The Plotter v10 n6 (Volume 10, Issue 6)
Pages: 4-5

This program was written by I. Auersbacher in 1985 and published in the CTM magazine. It has some interesting programming for the 2068 user.

People involved or interested in statistics can use a lot of computer time as this is a complex subject. Such a program as this one may be of interest to some of our readers. The purpose of this short program is to print out from data (any amount) various statitical values for specific statistical calculations.

The screen displays the complete list of data, such as perhaps the points of of a curve, that must be entered (any amount). From this the screen displays the following:

Minimum value
Maximum value
Sum of the values
Average value
Sum of the squares of the values
Variance
Standard deviation
Variation coefficient

I don’t pretend to know the subject of statistics but find the program interesting to follow through and check equations. I did find that to terminate the data input just key in “s” or “S” or “q” for the last x. From then on your answers are right there on the screen.

There is one odd variable value, s=-987.1234. It appears that the only place “s” is used is in this termination step. The calculations do not include this number, so what is it for? I did find that a value for s such as -1 will work, but a + will not work.

   2 REM basic STATISTICS  2068
4 REM by I. Auersbacher 1985
10 ON ERR GO TO 900: LET ss=0: LET sum=0: LET s=-987.1234: LET q=s: LET n=0: BEEP .05,23
12 BORDER 5: POKE 23609,10
14 PRINT PAPER 6;" Basic Statistics Package 2068 ": PRINT
16 PRINT "Enter Data Points:"
18 PRINT : PRINT "x=";
20 INPUT x: IF x=s THEN BEEP 0.5,-15: BEEP 0.6,-20: GO TO 20
22 PRINT x,: LET max=x: LET min=x: GO SUB 60
25 PRINT "x=";: INPUT x: IF x=s THEN PRINT "S": GO TO 100
30 PRINT x,: GO SUB 50
35 GO TO 25
50 IF x> max THEN LET max=x
55 IF x< min THEN LET min=x
60 LET sum=sum+x: LET ss=ss+x*x: LET n=n+1: RETURN
100 LET ave=sum/n
110 LET var=(ss-(sum*sum)/n)/n
120 LET std=SQR (var*n/(n-1))
130 LET vc=std/ave: BEEP .1,22
200 CLS : PRINT PAPER 6;AT 1,2;"** Solution **": PRINT
210 PRINT "Number/points: ";n
220 PRINT "Minimum value: ";min
230 PRINT "Maximum value: ";max
240 PRINT "Sum of values: ";sum
250 PRINT "Average value: ";ave
260 PRINT "Sum / squares: ";ss
270 PRINT "Variance : ";var
280 PRINT "Std Deviation: ";std
290 PRINT "V Coefficient: ";vc
300 PRINT : PRINT : PRINT TAB 1; PAPER 6;"** End Solution **"
310 ON ERR RESET : STOP : STOP
900 ON ERR RESET
910 BEEP 0.5,-15: BEEP 0.6,-20
920 ON ERR GO TO 900
930 ON ERR CONTINUE

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.