Animals, including humans, exhibit a variety of biological rhythms. This article describes a method for the detection and simultaneous comparison of multiple nycthemeral rhythms.

A statistical method for detecting periodic patterns in time-related data via harmonic regression is described. The method is particularly capable of detecting nycthemeral rhythms in medical data. Additionally a method for simultaneously comparing two or more periodic patterns is described, which derives from the analysis of variance (ANOVA). This method statistically confirms or rejects equality of periodic patterns. Mathematical descriptions of the detecting method and the comparing method are displayed.

Nycthemeral rhythms of incidents of bodily harm in Middle Franconia are analyzed in order to demonstrate both methods. Every day of the week showed a significant nycthemeral rhythm of bodily harm. These seven patterns of the week were compared to each other revealing only two different nycthemeral rhythms, one for Friday and Saturday and one for the other weekdays.

Analysis of biological activities that fluctuate throughout the day is common in various
fields of medicine. Blood pressure and heart rate as well as the occurrence of acute
cardiovascular disease are subject to a twenty-four hour rhythm (also referred to as
circadian or nycthemeral rhythm) [

Much mathematical effort was invested to detect and model the dependency on the time of
day [

The cosinor analysis is a common approach [

A modification of the analysis of variance (ANOVA) is used to compare two or more time series with periodic patterns. The typical ANOVA tests whether the means of several groups are equal. The scope of ANOVA is extended to periodic patterns by combining it with Fourier analysis. This new test rejects or confirms equality of multiple oscillating time series.

To demonstrate both methods, the oscillations of violent crimes in Middle Franconia, Bavaria/Germany from 2002 to 2005, were analyzed. Nycthemeral rhythms of bodily harm were identified on all seven days of the week. The seven patterns of the week were compared to each other revealing only two different nycthemeral rhythms. We demonstrate that the nycthemeral rhythms on Friday and Saturday are equal and differ significantly from the rhythms of the other weekdays, which are then equal again.

To compare our method with the cosinor method an analysis of the same data is performed and yields no strong evidence of different rhythms.

The simultaneous comparison of a greater number of nycthemeral rhythms is made possible by the use of the mathematical methods described in this study. A need for such procedures derives from the prospect of developing a prediction model for violent crime rates which is of immediate interest for public services such as social facilities, police departments and hospitals.

The section detection method contains a procedure to find the inherent frequencies of the data, the section Fourier Anova describes the comparison method, the results section illustrates both methods by analyzing nycthemeral rhythms of offenses against the person causing bodily harm and in the conclusion limitations, modifications and alternatives to our methods are discussed.

A statistical test for finding the frequencies of oscillating data is described. Using
harmonic frequencies the data are modeled as a sum of sine and cosine oscillations and a
Fourier transform is performed. In our case the Fourier transform equals an ordinary
least squares. All frequencies are tested for significance. The ratio of explained
variance of a frequency and remaining variance acts as test statistic. Model selection
is carried out by a Bonferroni-Holm Method (see [

Fitting harmonic models to nycthemeral rhythms is a common procedure [

The model for our data is

with white noise ϵ. Constant terms are omitted. So a time series sampled

By this choice the regressors cos(2_{j}t_{j}t^{n}

The null hypotheses are _{j }_{j }_{j }

is calculated, mimicking a periodogram. The value _{j}_{j }

which is tested on the corrected significance level _{j }_{i }_{F }

The Fourier approximation filters the periodic components out of the data; it is a denoising procedure. The data is decomposed in a fundamental frequency and its multiple, the harmonics. The Fourier coefficients indicate the strength, i.e. the amplitude of these oscillations. Usually the fundamental frequency has the highest amplitude and the strength decreases for greater harmonics. The influence of the harmonics can reach from only small adjustments of the fundamental oscillations to generating additional maxima, minima or plateaus.

A statistical test for comparing periodic patterns of grouped data is described. The test determines if the rhythm of the groups are equal or not. The mathematical concept of the ANOVA is transferred to periodic patterns by substituting the mean estimators for Fourier approximations. This test compares the periodic patterns in its entirety. The orthogonal regressors mentioned in the section Detection method are necessary for this test.

Suppose data divided in _{t,j }

To compare not the means but the periodic pattern of every group we substitute the mean estimators for the Fourier approximation (see 5):

The frequencies _{1 }= 2_{2 }=

The test uses the same idea as the ANOVA: Calculate the variance within the groups, i.e. the deviation of the data from its Fourier approximation within every group. Furthermore calculate the variance between the groups, i.e. the deviation the Fourier approximation of the single groups and the Fourier approximation of the whole data. If all groups show the same rhythm then the variance between the groups should have roughly the same magnitude as the variance within the groups. Conversely a large variance between the groups argues for an impact of a group on the rhythm.

In the following we will scrutinize the distribution of the test statistic in equation
7: We show that the test statistic _{F }^{2 }distribution of
the nominator and the denominator of equation 7. To apply this theroem the test
statistic needs a matrix representation.

The Fourier approximation in equation 5 has a matrix representation: For

with normalization constants _{c}_{s}

Let _{F}

Furthermore pile the columns of the data ^{n,k }one below the other and call this
vector ^{nk}

and

Because _{1 }and _{2 }are symmetric
projections the test statistic _{F }

Now the test statistic has a representation suitable for Cochran's Theorem. All that is
left is the orthogonality assumption for the projections _{2
}- _{1 }and _{1 }is spanned by _{2 }is spanned by the vectors ^{n}

By definition of the harmonic frequencies (see equation 2) the following equation holds except for normalization factor:

So the image of _{1 }is a subset of the image of
_{2 }and it holds:

This equation shows the orthogonality of the projections of Cochran's Theorem.

Nycthemeral rhythm of violent crime rates are analyzed to demonstrate both the detection and comparison method.

The study included 15881 crimes of violent behavior (without suicides) which were filed
at the Police Department of Middle Franconia, Bavaria/Germany between January 1, 2002 and
December 31, 2005, and gathered into the EVioS (Erlangener Violence Studies [^{®}, Matlab^{® }and R.
Significance level was set to 0.05.

In the following, the detection method shows the existence of nycthemeral rhythms of
bodily harm on all seven days of the week. A comparison of these seven rhythms reveals
only two different nycthemeral rhythms, one describing crime rates on Friday and Saturday,
the other on Sunday to Thursday. In order to analyze a more homogeneous sample, only
crimes committed by male offenders and not occurring on holidays such as New Year's Eve
are further surveyed; this sample consists of 11402 cases. The investigated data ^{24 × 7 }are the number of violent acts

The histogram in Figure ^{24 × 7}. So every
column of

The assumptions of our model in equation 1 are satisfied by the data _{h = 1
... 24,d = 1 ... 7 }is assumed to be independent, because sites of
crimes are spatially separated or offenders don't even know each other. Homoscedasticity
(constant variance of the residuals) and Poisson distributions do not make a good match:
For Poisson random variable the mean equals the variance and we assume a oscillating
number of crimes. So the residuals will not automatically be homoscedastic and are
afterwards tested for „whiteness“ by a Kolmogorov-Smirnov test [

Applying the detection method to the columns of

Applying the comparison method to _{1 }= 24,
_{2 }= 140). So there are at least two different periodic
patterns in the data. This finding is verified in the 10 randomly-generated subsamples:
comparing the period of the subsamples yields p-values within the interval [1.04 ·
10^{-10}, 1.3 · 10^{-3}].

Comparing _{1 }= 4, _{2 }= 40). So there is
no significant difference between

We found that nycthemeral rhythm of _{P }^{-11}. Bonferroni's inequality yields
an upper bound for the p-value of the hypothesis ∪ _{P
}_{P }^{-11 }

Comparing only _{1 }= 16, _{2 }= 100). Applying
this test to the 10 subsamples yields p-values within [0.0457, 0.93], one p-value was
lower than 5%. Testing the 26 partitions of {1 ... 5}, which have at least two elements
yields p-values ranged from 0.0047 to 0.9908, none was smaller than Bonferroni-corrected
significance level

Now the „whiteness“ of the residuals of the fit of _{ks }

Autocorrelation of the residuals biases the estimation of the coefficients and is a
evidence for a misspecified model. A Breusch-Godfrey test for autocorrelation up to order
23 does also not reject the null hypothesis (

Stationarity is a property often desired in time series analysis, particular in
econometrics [_{ks }

Though our Fourier approximation underestimates the peaked crime rates around midnight the coefficient of determination of the single days is within [0.86, 0.96]. Overall the model is satisfying.

Two statistical methods that will enlarge the scientists toolbox for analyzing multi-harmonic oscillations were described. As the example demonstrated the methods can be used to detect and compare multi-harmonic patterns in biological rhythm data.

The orthogonality of the sine and cosine vectors is intensively used to calculate the exact distribution of certain test statistics, not just the approximate distribution for large sample sizes. But this orthogonality also limits the set of frequencies in our multi-harmonic model. In this special case our detection method is an extension of the cosinor-method to multi harmonic models. It also includes a model selection process. Our comparison method uses the whole periodic patterns instead of single parameters. This is an enhancement of the commonly used ANOVA with single parameter „mean“. Furthermore the exact distribution of the test statistic is known, not just an approximate or a limiting distribution for large sample sizes. This can in some cases increase the tests power. In addition the method allows a simultaneous comparison of several time series. This allows to test the hypothesis if „at least one time series shows a different rhythm“ without having any a priori knowledge which one could be deviant (this situation can occur if for example the study design or the data does not allow a partition in a control group and a treatment group).

Problems may occur with missing values (no ON-basis), trends in the data (model is not valid) or the choice of the number of samples, when no a priori knowledge of the inherent periods of the data is available. To derive a more robust version of the statistical test use the rank of the residuals instead the residuals analogous to the ANOVA on ranks. Identifying the method's limitations will help improve it and make it more universal, which is one of the reasons for providing a detailed description of the method calculation steps.

Likelihood ratio tests are in common use for model selection or hypothesis testing and
could be an alternative to our tests. Least squares estimates of the coefficients coincide
with the maximum likelihood estimates, if the residuals are normal distributed and
homoscedastic. Our tests confirm, that the residuals have these properties. So there is
neither a gain nor a loss in switching to likelihood ratio tests, which are based on
maximum likelihood estimates. Furthermore only the limiting distribution of the likelihood
ratio test statistic for large sample sizes is known, whereas the exact distribution of
our test statistics is specified. The described detection method uses all harmonic
frequencies, because potentially all frequencies could be inherent in the data. However
this approach can increase the false negative rate of the test, because the corrected
significance level becomes too small. So we are using a conservative test. As Albert and
Hunsberger [

We compared our methods with the cosinor method [

The findings of a 24 hour period on every day could be for example associated with the
hormones testosteron and serotonin. Both of them show a nycthemeral rhythm [

The authors declare that they have no competing interests.

AS contributed to the conception and the design of the study, analyzed the data and drafted the manuscript. UR contributed to the conception and the design of the study. TB acquired the data. IK contributed to the analysis. JK contributed to the intellectual content. TG, MB and all other authors read and approved the final version of the article.

This work was supported by the Interdisciplinary Center of Clinical Research (IZKF) at the University hospital of the University of Erlangen-Nuremberg. The authors wish to thank Joanne Eysell for proofreading the manuscript.