Reading, storing and statistical calculation of weight data

Reading, storing and statistical calculation of weight data

Computer Methods and Programs in Biomedicine 24 (1987) 73-75 Elsevier 73 CPB 00814 Reading, storing and statistical calculation of weight data Mich...

155KB Sizes 1 Downloads 33 Views

Computer Methods and Programs in Biomedicine 24 (1987) 73-75 Elsevier

73

CPB 00814

Reading, storing and statistical calculation of weight data Michael Schliack Department of Biochemistry, Klinge Pharma, Mfinchen, F.R.G.

A BASIC program is described which reads and computes weight data. Tara and gross weight data are read from an analytical balance. The net weights are calculated and stored on a disc. A statistical test (e.g. unpaired t-test or unpaired Wilcoxon test) can then be carried out with the weight data. The program calculates a descriptive statistic before the tests. Balance; Microcomputer; Weight data; t-Test; Wilcoxon test

1. Introduction

3. Algorithm for reading

T a r a a n d gross weights of s a m p l e s were e s t i m a t e d o n an analytical balance. T a k i n g these weights, net weights a n d statistical e v a l u a t i o n can b e o b t a i n e d b y linking an analytical b a l a n c e to a m i c r o - c o m puter. The c o m p u t e r r e a d s the b a l a n c e d a t a a n d stores t h e m on disc.

C o m m o d o r e ' s 8032 B A S I C 4 i n t e r p r e t e r requires exact c o m p l i a n c e with the r e g u l a t i o n of overlay [1]. T h e r e f o r e it is necessary to l o a d the largest p r o g r a m m o d u l e first. All following m o d u l e s are smaller, allowing p r o g r a m s to be c h a n g e d without the loss of data. T h e use of C o m m o d o r e ' s I N P U T s t a t e m e n t is d a n g e r o u s because the p r o g r a m is i n t e r r u p t e d when an I N P U T w i t h o u t d a t a takes place. In m o s t p r o g r a m m o d u l e s we therefore use a s u b r o u t i n e to simulate an I N P U T statement. W h e n a file n u m b e r b e t w e e n 1 a n d 127 is used, B A S I C 4 will send o n l y C R (chr$ (13)) after a P R I N T # statement. T h e r e f o r e we use a file n u m ber between 128 a n d 255; B A S I C 4 then sends C R a n d L F [2]. W h e n B A S I C 4 I N P U T # receives a d a t a string f r o m the interface, a L F will stay in the interface buffer. W h e n the next I N P U T ~ tries to get a new d a t a s t r i n g this d a t a s t r i n g c o n t a i n s the old L F . This L F m u s t be r e a d in a d u m m y string b e f o r e the next I N P U T # is executed. F o r this reason GETTY, H$ follows the I N P U T # , H H $ when d a t a are r e a d f r o m the interface [3]. Devices i n t e g r a t e d into the IEEE-488 bus m u s t

2. Hardware T h e b a l a n c e used is a M e t t l e r A E 1 6 0 (Mettler, Switzerland). It c a n be linked with a c o m p u t e r b y using the 013 d a t a interface option. The interface can b e a d d r e s s e d as a ' t a l k e r ' a n d ' l i s t e n e r ' to achieve b i d i r e c t i o n a l d a t a transfer. The c o m p u t e r is a C B M 8032 ( C o m m o d o r e , Braunschweig, F . R . G . ) , the disc unit a C B M 4040 a n d the p r i n t e r an A d c o m p X132SP ( A d c o m p D a t a Systems, M u n i c h , F . R . G . ) . All units are i n t e g r a t e d into an IEEE-488 bus.

Correspondence: M. Schliack, Department of Biochemistry, Klinge Pharma Gmbh, Weihenstephaner Stral3e 28, 8000 Mtinchen 80, F.R.G.

0169-2607/87/$03.50 © 1987 Elsevier Science Publishers B.V. (Biomedical Division)

74 answer within 64 ms after an I N P U T # statement, but Mettler's balance interface needs more time. To prevent program interrupt, the ' time out' which controls this interruption is switched off with POKE1020,128, allowing the I N P U T # statement to read the weight. Later 'time out' is switched on with POKE1020,0. The correct algorithm to get a good data transfer is: 100 110 120 130 140 150 160

OPEN128,15 POKE1020,128 P R I N T ~ 128,"s" I N P U T # 128,HH$ G E T # 128,H$ POKE1020,0 CLOSE128

Floppy status (ST) will be checked after every file opening to the disc. If ST is unequal to zero then the program branches to an error statement, enabling the operator to check the disc without incurring a program interruption. When the program is started the M E N U of the program is printed on the screen. The desired module can be called by input of the appropriate number. The program returns to M E N U when a module has finished.

4. Program description Tara weights are determined using module 1.WEIGHT. The computer asks for the number of groups of samples and for the maximum numbers of samples per group. To declare this datamatrix in the printouts of the statistical tests, groups must be defined with an abbreviated word of maximum 6 characters. All weights are measured in mg. Before reading the first sample weight, the balance is set to zero by the computer. The computer prints on the screen the number of the group and the number of the sample which is to be put on the balance. When the balance has stabilised, the computer receives the weight of the sample. Commodore's BASIC 4 interpreter does not exactly conform with the iEEE-488 norm. Thus, the balance some-

times sends a 12-character data string to the computer and sometimes a 14-character string. The weight of the sample is located in the 12-character string between characters 4 and 11 and in the 14-character string between 6 and 13. When the relevant sample weight is correct, the computer prints the result on the screen. Missing samples can be defined by keying in '999'. The computer will take this into account when it computes the net weights and the statistics. After measuring all samples a raw data output can be carried out if required. The data are then stored on disc. In 2 . W E I G H T the computer reads the tara weights from the disc. The initiation procedure of balance operation and the reading of sample weights are similar to that in module 1.WEIGHT. A raw data output of gross weights can again be listed. Then the computer calculates net weights and stores them on the disc. From the menu the user can select a test for computing the statistics. In the case of a Gaussian dispersion of sample weights, the unpaired t-test may be best. However, most samples have no Gaussian dispersion, so the Mann-Whitney U-test for unpaired samples (Wilcoxon test) must be used. If data are not present in the memory the data file is loaded from the disc. Before the desired statistical test is computed a module is loaded which calculates a descriptive statistic. For comment on the calculations the user can now enter headlines and footnotes to be printed on the statistic printouts. The descriptive statistics program prints the number of samples per testing group and the mean, standard deviation, maximum value of samples, minimum value, lower quartile, median and upper quartile. The table can be printed on the screen or on the printer. Using the printer, all net weights of the samples can be listed. When the unpaired t-test is chosen, the computer prints a table which contains the number of the samples, the mean, standard deviation, standard error (error of mean), t-value, and the probability in comparison to the first group [4,5]. In the case of the Wilcoxon test, when the rank sum test is performed, a table is printed which contains the number of the samples, ¢, and the probability [4,5].

75

5. Compatibility and availability

References

This p r o g r a m is written in B A S I C on a C B M 8032 m i c r o - c o m p u t e r . It also will run on C B M 8096 m i c r o - c o m p u t e r u n d e r L O S 96-BASIC. The complete listing of the p r o g r a m is available on request. By sending a 5.25-inch diskette, a c o p y of the p r o g r a m ( C B M 8250 or C B M 4040 format) can be o b t a i n e d which can be l o a d e d directly into a C B M 8032.

[1] [2] [3] [4]

Commodore 8032 Manual, Part IV, pp. 179-185. Mettler, Applikation Note ME-701166, p. 4. Mettler, Applikation Note ME-701166, p. 7. H. Immich, Medizinische Statistik (Schattauer Verlag, Stuttgart, 1974) [5] L. Sachs, Angewandte Statistic, 6th edn. (Springer Verlag, Berlin, 1984).