Category : BASIC Source Code
Archive   : QB_CODE.ZIP
Filename : TESTSTAT.BAS

 
Output of file : TESTSTAT.BAS contained in archive : QB_CODE.ZIP
DECLARE FUNCTION Integer.In.Range% (Msg$, Lo%, Hi%)
DECLARE FUNCTION YesNo$ (Msg$)
DECLARE SUB Center.Message (Msg$, L%)
DECLARE SUB Blank.Lines (N%)
'------------------- from BASTAT ------------------
DECLARE SUB Initialize.Bastat ()
DECLARE SUB Sum.Data (D#(), Index%, IndxFreq%, N%)
DECLARE SUB Mean.Sdev (Mean#, Sdev#)
DECLARE SUB Moments (Mean#, Mom2#, Mom3#, Mom4#, _
SkewCoeff#, KurtCoeff#)

' QuickBASIC 4.0 program to test module BASTAT.BAS
' Copyright (c) 1988 Namir C. Shammas

' Modules Required:
' BASTAT.BAS
' TOOLBOX0.BAS

OPTION BASE 1

DIM X#(100, 1)

Message$ = "How many random numbers to generate (10->100)"

DO
CLS ' clear screen
CALL Center.Message("BASIC STAT FOR RANDOM NUMBER", 1)
CALL Center.Message("----------------------------", 2)
CALL Blank.Lines(3)

N% = Integer.In.Range%(Message$, 10, 100)

RANDOMIZE

FOR I% = 1 TO N%
X#(I%, 1) = 100 * RND(1)
NEXT I%


' Initialize summations and control variable
CALL Initialize.Bastat

' Accumlate statistical data
CALL Sum.Data(X#(), 1, 0, N%)

' calculate basic statistics
CALL Mean.Sdev(Mean#, Sdev#)

PRINT
PRINT "Mean = "; Mean#
PRINT
PRINT "Sdev = "; Sdev#

' Calculate the first four moments and the coefficients
' of skewness and kurtosis
CALL Moments(Mean#, Mom2#, Mom3#, Mom4#, SkewCoeff#, KurtCoeff#)

PRINT
PRINT "Third moment = "; Mom3#
PRINT
PRINT "Fourth moment = "; Mom4#
PRINT
PRINT "Skewness coefficient = "; SkewCoeff#
PRINT
PRINT "Kurtosis coefficient = "; KurtCoeff#
PRINT

OK$ = YesNo$("Process another set")

LOOP UNTIL OK$ = "N"

END



  3 Responses to “Category : BASIC Source Code
Archive   : QB_CODE.ZIP
Filename : TESTSTAT.BAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/