Chronobiology International Vol. 9, No. 6 , pp. 403-412 0 1992 International Society of Chronobiology

Chronolab: An Interactive Software Package for Chronobiologic Time Series Analysis Written for the Macintosh Computer Chronobiol Int Downloaded from informahealthcare.com by University of Auckland on 12/06/14 For personal use only.

Artemio Mojbn, Josk R. Fernindez, and Ram6n C. Hermida Bioengineering and Chronobiology Laboratories, E. T.S.I. Telecomunicacio'n, University of Vigo, Campus Universitario, Vigo, Spain

Summary: Methods based on periodic regression have been designed for the detection of periodic components in short, noisy, and nonequidistant time series (as they are usually present in medicine and biology). The procedure consists of fitting a set of (cosine) curves to the data, with the analyst choosing the domain of trial periods to be analyzed and the distance between consecutive trial periods. We here describe an interactive program for least-squares rhythmometry written in C language for the Macintosh computer. For any given number of time series to be analyzed at once, the program is able to perform two different kinds of analyses: ( a ) linear in time, for the sequential fit of trial periods; and ( b ) linear in frequency, for the sequential fit of harmonic components from an initial fundamental period. For each series and for each trial period fitted to the data, the program gives the following information: fitted period; percent rhythm; p value from testing the assumption of zero amplitude; rhythm-adjusted mean or mesor, amplitude, and acrophase, each with corresponding standard errors and 95% confidence intervals when the component is statistically significant; and (when required by the analyst) p values from tests of sinusoidality, normality of residuals, and homogeneity of variance. Additionally, the program provides a summary report for each time series analyzed, including descriptive statistics such as the number of data analyzed for that series, minimum, maximum, arithmetic mean, standard deviation, standard error, 90%range, and 50%range. The analyst is also able to transform the data before doing any rhythmometric analysis. Transformations already integrated in the program include square root, logarithm, inverse, data as percentage of mean, data as percentage of mesor, and elimination of values outside 2 3 SD from the mean. When several periods are suspected to be statistically significant, a multiple-component analysis can be also used by the concomitant least-squares fit of several harmonics. The program allows the simultaneous analysis of several periods in several variables from several individuals, with limitations depending solely on internal memory availability and speed requirements from the user. When series from different subjects or different variables in the same subject are available for analysis, a parameter test also included in the program can be used

Received July 1991; accepted with revisions January 27, 1992. Address correspondence and reprint requests to Prof. R. C . Hermida, Bioengineering and Chronobiology Labs., E.T.S.I. Telecomunicacibn, University of Vigo, Campus Universitario, Vigo (Pontevedra) 36280, Spain.

403

A . MOJON ET AL.

404

Chronobiol Int Downloaded from informahealthcare.com by University of Auckland on 12/06/14 For personal use only.

for comparison of rhythm characteristics at any given period. All information required in a single analysis is given by the analyst in the form of self-explanatory commands grouped in different “menus.” This program is an expandable tool designed for general use in chronobiologic applications, including modeling and simulation of biologic time series, chronobiologic signal processing, and rhythmometric parameter testing. Key Words: Rhythmometry-Macintosh computerInteractive program-Multiple-component analysis-Parameter test-Linear least squares-Nonlinear least squares.

The study of biologic time series necessarily involves mathematical techniques for purposes of data collection and signal processing that, in combination with physiologic considerations, also serve for the interpretation of results. Methods used for estimating the period of a rhythmic biologic function include the periodogram, autocorrelogram, power spectra ( 1 ), and linear-nonlinear rhythmometry ( 1-6). The latter approach, with regression techniques applicable to nonequidistant data, was introduced in chronobioengineering in preference to classic spectral analysis, usually restricted to equidistant and dense time series. Whenever values are available only at unequal intervals, provided a reasonably uniform sampling, linear least-squares (LLS) techniques for fitting relatively simple models are attractive. Moreover, a method for testing an assumed period based on the Taylor series expansion was also developed (7 ). It requires little more than the calculation of two LLS analyses. Alternatively, nonlinear least-squares (NLLS) can be applied. In this case, the linear analysis provides parameter estimates used as initial values in the nonlinear procedure. This combined approach provides point and interval estimates for all parameters of each periodic component, including the period itself ( 1,3,8,9). We here describe the so-called “Chronolab,” a software package for linear rhythmometric analysis of time series written for the Macintosh computer. This interactive program amplifies and generalizes currently available software ( 10- 12 ) originally designed for use in other computers. The program here described can be obtained upon request from the authors (please send an unformatted double-sided 3;-in diskette and a self-addressed hard envelope for mailing).

THE LLS APPROACH Methods of LLS rhythmometry have been designed for the detection of periodic components in short and noisy time series [as they are usually present in clinical situations involving patients ( 13)]. This approach is based on regression techniques and, as such, it is applicable to the analysis of nonequidistant data. The procedure consists of fitting, one at a time, a set of (cosine) curves to the data, with the analyst choosing the domain of trial periods to be analyzed and the distance between consecutive trial periods. LLS rhythmometry is usually implemented in regions of trial periods fixed a priori on the basis of empirical physiologic information, and it serves to identify a previously unknown single period ( 1,2,4,8). For a given period, the procedure amounts to fitting the model y, = M + A c o s ( w t , + + ) + g f i = 1, . . . , N to the data by least squares. Thus, one obtains, for each period considered, an estimate of ( a ) the rhythm-adjusted mean or mesor ( M ;midline estimating statistic of

Chronohiol In!. Vol. 9, N o 6 , 1992

INTERACTIVE PROGRAM FOR TIME SERIES ANALYSIS

405

rhythm), defined as the average value of the rhythmic function (e.g., cosine curve) fitted to the data; (b) the amplitude ( A ), half the extent of rhythmic change in a cycle approximated by the fitted cosine curve; and (c) the acrophase (4),lag from a defined reference timepoint of the crest time in the cosine curve fitted to the data ( 1-3,14,15). Given the period and hence the angular frequency, the model is fitted in its equivalent linear form: y, = M + pcos(wt,) + y sin(wt,) + e l i = 1 , . . . ,N where 0 = A cos 4 and y = -A sin 6.The least-squares approach solves the following normal equations: Chronobiol Int Downloaded from informahealthcare.com by University of Auckland on 12/06/14 For personal use only.

2y,

=

M N + 0Z cos ( w t , ) + yZ sin ( w t , )

+ PZ cos2 ( w t , ) + 7 2 sin (wt,)cos ( w t , ) Zy, sin (at,) = Mz1 sin (at,) + PZ sin (ot,) cos ( w t , ) + yZ sin2 ( w t , )

Zy, cos ( w t , ) = Mz1 cos ( w t , )

or, in matrix notation, b Solving the system, we can compute,

=

Sx

,

(f)

=Cb

where

c = s-1

The goodness of fit is indicated by minimizing the sum of squares of the residuals from the analysis ( R S S = 2, that is, the differences between the actual measurements and the estimated functional form or best-fitting curve. Provided that the residuals around the fitted curve are normally distributed, it can be shown (4,15 ) that estimates of (3 and y follow a bivariate normal distribution characterized by an F ( 2, N - 3) statistic, where N is the total number of data in the time series. Conservative confidence intervals can thus be obtained for A and 6 separately (derived from a joint confidence ellipse). Nonconservative confidence intervals can also be computed for A and 4,as well as for M , by the use of their respective standard errors ( 4 ) : SEM = G& SEA

=

S E =~

~ [ c , ,cos2 ($1 + 2c2, sin ($1 cos ($1 U

A

+ cS3sin2 < $ ) I ’ / ~

[c,, sin2 ($1 - 2~~~sin ($) cos ($) + c33cos2 ( $ ) I ” ~

where

and cij are elements from the matrix C defined above. The F statistic can also be used to test the zero-A hypothesis for determining whether or not the data can be described by a cosine function at a given probability level.

Chronobiol In!, Vol 9. No. 6. 1992

A. MOJON ET AL.

Chronobiol Int Downloaded from informahealthcare.com by University of Auckland on 12/06/14 For personal use only.

406

When a time series of appropriate length is available, we can estimate parameters by repeatedly fitting the cosinor model to the data, incrementing and/or decreasing the period of the cosine function over an appropriate range, and performing tests for statistical significance at each period. The choice of trial periods usually involves first the scanning of a broad spectral region. Whenever the length and density of the series permit it, the scanning of several domains (ultradian to infradian) is recommended ( 1,6). In any case, the LLS analysis requires that the time series be reasonably well represented by a cosine curve, and nonsinusoidality limits the applicability of the method. For a meaningful rhythmometric analysis by LLS, it is important, therefore, to determine the approximate sinusoidality of the data. This requires at least the inspection of the chronogram (display of data as a function of time) before application of the rhythmometric procedure, as well as a mathematical test for sinusoidality. In keeping with assumptions from regression analysis, tests for normality of residuals and homogeneity of variance are also required and should always be incorporated into any computer program for LLS rhythmometry ( 16,17) . When one or more of these tests yields p values of m standard deuiations

Oy=a*x+b

FIG. 4. Dialog window for the command “Transformations” in the menu “Variables” of Chronolab.

0y = lOglO(H) 0y = In(x) oy=x-2

a

=

~

,

b

=

409

m=

~

z=m

0y = explx)

[Cancel)

OY=l/H

0y = sqrt(x) 0y = 1 0 0 * ~ / p (percent o f mean) (percent 01 MESOR) 0y = IOO*X/MESOR 0LJ = ( - 1 +H“S)/S (BOH-COX) I= Chronobiol Int Downloaded from informahealthcare.com by University of Auckland on 12/06/14 For personal use only.

0

fundamental period, to fit a number n of selected harmonics from the fundamental period, or to fit a number n of selected components (not necessarily harmonics from the fundamental period). The variable n is also indicated by the user in each possible case (Fig. 3 ) . The menu “Variables” (Fig. 1 ) allows the analyst to transform the data before doing any rhythmometric analysis. Transformations already integrated in the program (Fig. 4 ) include square root, logarithm, inverse, data as percentage of mean, data as percentage of M , and elimination of values outside +3 SD from the mean. Additionally, the command “Operations” will compute basic arithmetic operations between a pair of selected variables. The menu “Method” will actually run the program according to the selected method for LLS rhythmometry. Finally, the menu “Results” allows the user to select the tables that, as separate and independent windows, will be created in running the program. Those tables can be edited and/or printed using the commands in the menus “File” and “Edit.” The program uses all the features and advantages of the Macintosh interface. Results are given in tables simultaneously available in different windows. Moreover, the use of menus for groups of commands eliminates the need of a setup file, specification of format to read times and data, etc. When series from different subjects or different variables in the same subject are available for analysis, a parameter test [the so-called “Bingham test” (4)], also included in the program, can be used for comparison of rhythm characteristics at any given period. This option will be active and a table of results generated when selecting “Bingham test” in the “Results” menu.

DISCUSSION Fourier analysis consists of a decomposition of a time series into a sum of sinusoidal components. If and only if statistical tests validate peaks in the spectrum of biological time series, these peaks are indicative of the presence of periodic components at the corresponding frequency. Spectral analysis offers a powerful tool to detect hidden periodicities (rhythms with unknown period) but usually requires data to be sampled at regular intervals (23). One approach to deal with nonequidistant data is to rely on regression techniques such as linear-nonlinear rhythmometry ( 15). In this sense, periodic regression has been used to model the rhythmic behavior of

Chrnnobiol Int. Vol 9, No. 6, I992

Chronobiol Int Downloaded from informahealthcare.com by University of Auckland on 12/06/14 For personal use only.

410

A . MOJON ET AL.

biological variables. These techniques of fitting relatively simple models by leastsquares estimation are particularly attractive in view of the usual need to analyze nonequidistant data. Least-squares methods are, however, sensitive to outliers, in the sense that the presence of one or a few “bad data” influences the estimation of the parameters and their confidence intervals and spreads the error over the entire data set (13). Methods of LLS rhythmometry presently in use include the single and populationmean cosinor ( 1,4,15). The single cosinor is a method applicable to single biologic time series anticipated to be rhythmic with a given period ( 1 ). This procedure amounts to fitting a cosine function of fixed (and anticipated) period to the data by least squares. To summarize results obtained for different individuals belonging to the same population, the rhythm parameters obtained by the single cosinor procedure may serve as input for a population-mean cosinor for further quantification ( 1,15,18,19). The rhythm characteristics obtained by the single cosinor are then considered as imputations or first-order statistics. The population-mean cosinor, in turn, constitutes a second-order statistic, applied to derive confidence intervals for rhythm parameters pertaining to the whole population. The parameter estimates are based on the means of estimates obtained from individuals in the sample, and their confidence intervals depend on the variability among individual parameter estimates. The rejection of the zero-A assumption by single cosinor (“rhythm detection”) refers to the given data set and does not allow extrapolation to the whole population. As the name implies, the population-mean cosinor aims at the extrapolation beyond the given sample to the population as a whole. If the sample is to be characterized without further inference to others in the population, a single cosinor is much more efficient; however, when inference is to be drawn on the basis of the sample for the entire population, the population-mean cosinor is indicated ( 1,13). Accordingly, a population-mean cosinor program compatible with our LLS rhythmometry module has also been developed for the Macintosh. Moreover, methods for comparing rhythm parameters for the population-mean cosinor method have been described (4)and the software modules also developed, extending the parameter test developed and implemented for the single cosinor method. All modules from this analytical and interactive package complement others for graphical display, including chronograms and polar plots for either single series or populations. The polar plot serves to illustrate two of the rhythm parameters of the cosine curve fitted to the data. In this presentation, the A and 4 are represented as a directed line (vector). The length of that line indicates the A of the rhythm. The orientation of the line, i.e., its direction with respect to the circular scale, indicates the 4 of the rhythm. The circular scale covers one period (360 angular degrees). A 95% confidence region for the pair ( A , 4) is shown in the plot by an error ellipse around the tip of the vector. An ellipse not overlapping the center of the circle indicates that the A differs from zero and that the rhythm is thus statistically significant ( 1-3,15). The polar plot is also complemented by a histogram, used for visual comparison of M values when several series are represented concomitantly. The software here presented is a powerful and expandable tool applicable for chronobiologic time series analysis and designed for general use in biomedical appli-

ChronobiolInt, Val. 9, No. 6, I992

Chronobiol Int Downloaded from informahealthcare.com by University of Auckland on 12/06/14 For personal use only.

INTERACTIVE PROGRAM FOR TIME SERIES ANALYSIS

411

cations, including modeling and simulation of biologic time series, signal processing, and rhythmometric parameter testing. A new module for NLLS rhythmometry has already been implemented and will soon be introduced in Chronolab. Limitations as to the number of series to be analyzed at once or the number of trial periods or harmonic components to be fitted for each series depend solely on internal memory availability and speed requirements from the user. In this sense, Chronolab can be used in any Macintosh, from the Plus to the new IIfx. Moreover, analytical modules for single and population-cosinor analysis as well as for parameter comparisons can also be compiled and used in either an IBM or a VAX computer. The advantages in using the Macintosh are clear. The analytic results are given in a text format and, as such, they can be directly transferred for further editing to any of the available Macintosh editors (Mac Write 11, Ms Word, Write Now, etc.). The graphic outputs are given in a MacPaint format. This and many other plotting programs (Canvas, MacDraw, Adobe Illustrator, etc.) can be used for further editing. Acknowledgment: This research was supported in part by Direccibn General de Investigacibn Cientifica y TCcnica, DGICYT, Ministerio de Educacibn y Ciencia (PB88-0546);Consellena de Educacibn e Ordenacibn Universitaria, Xunta de Galicia (XUGA-709-0289 and XUGA-3220 1 B90); and Comisi6n Interministerial de Ciencia y Tecnologia, Plan Nacional de Salud (SAL90-0500).

REFERENCES 1. Hermida RC. Chronobiologic data analysis systems with emphasis on chronotherapeutic marker

2. 3. 4. 5. 6. 7.

8. 9. 10.

I I.

12. 13.

rhythmometry and chronoepidemiologic risk assessment. In: Scheving LE, Halberg F, Ehret CF, eds. Chronobiotechnology and chronobiological engineering. Dordrecht: Martinus Nijhoff, 1987:88- 1 19. (NATO AS1 series; no 120). Ayala DE, Hermida RC. Modelling of biologic times series by least squares rhythmometry. In: Hamza MH, ed. Proc 39th ISMM Int Conf Mini and Microcomputers and Their Applications. Anaheim: Acta Press, 1989:XO-3. Ayala DE, Hermida RC. Combined linear-nonlinear approach for biologic signal processing. In: Hamza MH, ed. Proc IASTED Int Symp Applied Informatic.s. Anaheim: Acta Press, 1989:67-70. Bingham C, Arbogast B, Cornelissen G, Lee JK, Halberg F. Inferential statistical methods for estimating and comparing cosinor parameters. Chronobiologia 1982;9:397-439. Halberg E, Halberg F, Shankaraiah K. Plexo-serial linear-nonlinear rhythmometry of blood pressure, pulse and motor activity by a couple in their sixties. Chrnnobiologia 198 1;8:351-66. Halberg F, Halberg E, Nelson W, Teslow T, Montalbetti N. Chronobiology and laboratory medicine in developing areas. Proc 1st African and Mediterranean Congress for Clinical Chemistry, Milan, Italy, 1980, pp 113-56. Bingham C, Cornelissen G, Halberg E, Halberg F. Testing period for single cosinor: extent of human 24-h cardiovascular “synchronization” on ordinary routine. Chronobiologia 1984;1 1:263-74. Ayala DE, Hermida RC, Arrbyave RJ. Sequential approach for analysis of sparse biologic time series, illustrated for the incidence of giardiasis. In: Hamza MH, ed. Proc IASTED Int Symp Signs/ Processing and Digital Filtering. Anaheim: Acta Press, 1990:241-4. Ayala DE, Hermida RC, Garcia L. Circannual variation in the incidence of giardiasis assessed by linear-nonlinear rhythmometry. In: Morgan E, ed. Chronobiology and chronomedicine: basic research and applications. Frankfurt am Main: Peter Lang, 1990: 1 5 1-6 1. Cornelissen G, Halberg F, Stebblings J, Halberg E, Carandente F, Hsi B. Data acquisition and analysis by computers and pocket calculators. Ric Clin Lab 1980;10:333-85. Monk TH, Fort A. “Cosina”: a cosine curve fitting program suitable for small computers. Int J Chronobiol 1983;8:193-224. Vokac M. A comprehensive system ofcosinor treatment programs written for the Apple I1 microcomputer. Chronobiol Int 1984;1:87-92. Haus E, Nicolau GY, Lakatua D, Sackett-Lundeen L. Reference values for chronopharmacology. In:

Chronobiol hi.Vol. 9, No. 6. 1992

412

14. 15.

16. 17.

Chronobiol Int Downloaded from informahealthcare.com by University of Auckland on 12/06/14 For personal use only.

18. 19.

20.

A . MOJON ET AL.

. Reinberg A, Smolensky M, Labrecque G, eds. Annual review ofchronopharmacology, ~ 0 1 4Oxford: Pergamon Press, 1988:333-424. Halberg F, Carandente F, Cornelissen G, Katinas GS. Glossary of chronobiology. Chronobioiogiu 1977;4(suppl 1):189. Nelson W, Tong YL, Lee JK, Halberg F. Methods for cosinor rhythmometry. Chronobiologia I979;6:305-23. Fernandez JR, Hermida RC. A software package for linear least-squares rhythmometry written for the MacintoshTMcomputer. I Interdisc Cycle Res 1990;21:186-9. Mojon A, Fernandez JR, Hermida RC. An interactive program for chronobiologic time series analysis written for the Macintosh '' computer. Proc 20th Int Conf Chronobiology, Tel Aviv, Israel, June 16-21, 1991, p 11.2. Ayala DE, Hermida RC, Fernandez JR, Garcia L. Software system for biological signal processing and risk evaluation in pediatrics. Proc 2nd Ann IEEE Symp Computer-Based Medical Systems, Minneapolis, MN, June 26-27, 1989, pp 203-5. Hermida RC, Garcia L, Fernandez JR, Ayala DE. Software system for marker rhythmometry in pediatrics. Proc 7th IASTED Int Symp Applied Informatics, Grindelwald, Switzerland: February 8-10, 1989, pp 238-42. Ayala DE, Hermida RC, Fernandez JR, Garcia L. Modelling ofgrowth hormone variability by multiple linear least-squares rhythmometry. In: Hamza MH, ed. Proc IASTED Int Conf Computers and Advanced Technology in Medicine. Healthcare and Bioengineering. Anaheim: Acta Press, 1990:2831.

21. Ayala DE, Hermida RC, Garcia L, Iglesias T, Lodeiro C. Multiple component analysis of plasma growth hormone in children with standard and short stature. Chronobiol Int 1990;7:217-20, 22. Tong YL, Nelson W, Sothern RB, Halberg F. Estimation of the orthophase (timing of high values) on a non-sinusoidal rhythm-illustrated by the best timing for experimental cancer chronotherapy. Proc XI1 Int Conf Int Soc Chronobiol, II Ponte, Milan. 1977, pp 765-9. 23. De Prins J , Cornelissen G , Malbecq W. Statistical procedures in chronobiology and chronopharmacology. Annu Rev Chronopharmacol 1986;2:21-141.

Chronobiol Ini. Vol. Y , No. 6 , 1992

Chronolab: an interactive software package for chronobiologic time series analysis written for the Macintosh computer.

Methods based on periodic regression have been designed for the detection of periodic components in short, noisy, and nonequidistant time series (as t...
669KB Sizes 0 Downloads 0 Views