Abstract
Circular statistics and Rayleigh tests are important tools for analyzing cyclic events. However, current methods are not robust to significant measurement bias, especially incomplete or otherwise non-uniform sampling. One example is studying 24-cyclicity but having data not recorded uniformly over the full 24-hour cycle. Our objective is to present a robust method to estimate circular statistics and their statistical significance in the presence of incomplete or otherwise non-uniform sampling. Our method is to solve the underlying Fredholm Integral Equation for the more general problem, estimating probability distributions in the context of imperfect measurements, with our circular statistics in the presence of incomplete/non-uniform sampling being one special case. The method is based on linear parameterizations of the underlying distributions. We simulated the estimation error of our approach for several toy examples as well as for a real-world example: analyzing the 24-hour cyclicity of an electrographic biomarker of epileptic tissue controlled for states of vigilance. We also evaluated the accuracy of the Rayleigh test statistic versus the direct simulation of statistical significance. Our method shows a very low estimation error. In the real-world example, the corrected moments had a root mean square error of < 0.007. In contrast, the Rayleigh test statistic overestimated the statistical significance and was thus not reliable. The presented methods thus provide a robust solution to computing circular moments even with incomplete or otherwise non-uniform sampling. Since Rayleigh test statistics cannot be used in this circumstance, direct estimation of significance is the preferable option for estimating statistical significance.
Keywords: Inference algorithm, inverse problems, nonuniform sampling, parameter estimation
I. Introduction
The analysis of cyclic events is part of the branch of statics called circular, directional, or spherical statistics. These statistics are used in biomedical research to analyze events whose occurrence rate varies with an exogenous cyclic rhythm or other circular quantity. The most obvious case is circadian rhythm, including circadian cyclicity of genes [1], [2], hormones [3], blood sugar [4], and behavior [5], [6]. Other uses cases are broad, spanning from circadian and multiday cycling of seizures in humans with epilepsy [7], [8], to the response of human aortic endothelial cells to cyclic fluid flow [9], to magnetoreception in various species [10].
However, the standard methods of computing circular statistics fail to account for non-uniform and incomplete sampling. By non-uniform sampling, we refer to limitations of the measurement process in which the sampling from various regions of the domain is not consistent. Incomplete sampling is a special case of non-uniform sampling where the measurement process excludes the region of the measurement domain. For example, if one only records events during a subset of the 24-hour period but wants to understand the 24-hour cyclicity of these events, they will have incomplete and non-uniform sampling. If instead, one records over the full 24-hour period but records from the morning hours twice as often as from the afternoon, they will have complete, but still non-uniform, sampling. Non-uniform sampling of any type, including incomplete sampling, can bias the estimation of the cyclicity of these events.
Non-uniformity is a known problem in various fields. For example, non-uniformity is a serious confound in the analysis of the relationship between cortisol levels and stress [3]. Continuous glucose monitors for diabetes are recommended to record at least 70% of a 14-day period to “add confidence” [4]. However, depending on the time of day of the missing data, this non-uniform sampling could drastically alter the estimated average glucose level. For another example, in the context of estimating circadian or multidien cycling of seizures, data are often based on self-reporting. These reports are known to have inaccuracies, including both misalignment of the seizure times and missed seizures, especially during night-time hours.
To give an example directly from our research, we have been actively involved in the analysis of biomarkers of epilepsy that occur in intracranial EEG recordings. We analyze multi-day recordings of hospitalized subjects with epilepsy, and these subjects have highly irregular sleep patterns. We would like to assess if the rate of certain biomarkers has 24-hour cyclicity that is independent of the sleep stage. This can be accomplished by pooling data across days, stratifying data by sleep stage, and then computing the first circular statistic moments. As we then only analyze data a occurring within a given sleep stage, the distribution of that sleep stage over the 24-hour period (Fig. 1) results in extremely non-uniform sampling.
Fig. 1.
Example distributions of state of vigilance versus time of day. Data are shown for an example patient in states of vigilance NREM (a), REM (b), and awake (c). These distributions are the sampling distributions when stratifying data by sleep stage. Notice the extreme non-uniformity, with nearly all REM data coming from hours 0 to 9 and the majority of awake data coming from hours 9 to 24. The y-scale is set so that the maximum value is 1.0.
Techniques to correct for non-uniform and incomplete sampling are extremely common in high energy physics and are based on histograms. For example, see [11], [12], [13], [14]. These methods fail for biomedical research due to two factors. First, we note there can be confounding factors, with their effect being called masking in some biomedical research communities [15]. The histogram method requires explicit measurement of all confounding factors [11], [13], which is generally not possible in biomedical research. Second, incomplete sampling can cause the method to fail due to nuances about how the non-sampled region is treated. In physics, relevant change of variables mitigates this effect, but such change of variables is generally not available in biomedical research.
The goal of this manuscript is to present a method to mitigate the effect of incomplete or otherwise non-uniform sampling when computing circular statistic moments and testing their statistical significance. We first describe how these goals are a special case of a more general situation of correcting for measurement bias, and then present a mathematical derivation of a solution for the general method. Note, the general approach applies to a broad range of situations where one seeks to model data distributions in the presence of non-negligible measurement bias. We then relate the solution to our specific goal of circular statistic moments and their statistical significance and end by presenting several simulations which further elucidate the method.
A brief summary of this unfolding process is as follows. One first simulates data that would have been uniform were it not for the incomplete sampling and measurement bias. This leads to a model of how these imperfections in the measurement process impact the circular moments. This model can then be effectively inverted, allowing one to remove those effects from the circadian moments of the actual experimental data.
Rather than making new terms for various mathematical entities and technical concepts, we use several terms common in the high energy physics community. As these terms may be unfamiliar to many readers, we provide a brief glossary in Table I.
TABLE I.
Glossary of Terms
| Term | Definition |
|---|---|
| Unfolding | The process of mitigating the effect of non-uniform sampling. |
| Experimental, measured, or uncorrected data | These names all refer to the data directly obtained from the measurement process, i.e., the data before unfolding. |
| Acceptance | A term referring to the sampling process: perfect acceptance means to uniform (unbiased) sampling, limited acceptance means incomplete sampling and non-uniform acceptance means non-uniform sampling. |
| Smearing Matrix |
The matrix representing the measurement process, a parametrization of the conditional probability . |
| Cross-talk | Correlation between otherwise independent extracted parameters induced by the non-uniform sampling. |
II. Methods
A. Motivating Example
We begin with a minimal example in which we introduce the histogram technique standard in the physics community, show how it can fail, and introduce our new method. Intuitively, the histogram method is useful in situations such as high energy physics where there are many more data points to allow both small bin sizes and a large number of counts in all bins. However, data that are more sparse, such as is common in biomedical research, can lead to too few counts in some histogram bins. This in turn can make the results either unreliable or can even make it impossible to solve the equations. Our method avoids this issue by directly working with coefficients of basis functions. In the specific case of computing circular moments, these coefficients are the Fourier moments.
Consider a patient with epilepsy keeping a diary of the times at which their seizures occur. If we select to divide the day into 4-hour bins, their data can be represented as a histogram; see Fig. 2(a). The values per bin form a vector, as shown in Fig. 2(b). For this example, the patient records this information perfectly between the hours of 8 AM and midnight. However, from midnight to 4 AM the patient records no information, and between 4 AM and 8 AM, they record an average of 50% of their seizures. In the physics nomenclature, we would state the acceptance of this measurement process was 0 from midnight to 4 AM, 0.5 from 4 AM to 8 AM, and 1.0 the remainder of the day. This data can also be visualized as a histogram; see Fig. 2(c). The physics approach represents this as a matrix, where the diagonal captures the acceptance, the probability that an event gets recorded in the right time bin. The off-diagonal elements capture bias, specifically the probabilities that events from one time bin get recorded in another. In our example, when the patient records times, they always record the correct time, and so the off-diagonal elements of the matrix are zero. Since this matrix captures how counts get mixed across bins, it is called the smearing matrix. The physics approach would then be to solve the straight-forward linear equation , where is the vector of the measured counts per bin, is the smearing matrix, and is the vector of corrected counts per bin. Note however that in our case, the acceptance of 0 from midnight to 4 AM causes the matrix to be non-invertible (in other words, there is no unique solution to the equation), and thus the method cannot be directly applied. Some nuanced adjustments to our choice of binning could alleviate the problem for this example, but that is not always the case in general.
Fig. 2.
Motivating example: histogram approach. (a) Histogram of seizure counts per time of day for a hypothetical patient. (b) The counts per bin from (a) can be represented as a vector . (c) Histogram depicting the acceptance. (d) The acceptance is represented as a 2D smearing matrix. Since all events that are recorded are recorded in the correct time-bin, the matrix is diagonal. (e) The goal of the standard method is to estimate the actual counts per bin, represented by the vector , which is found by solving .
Our method herein is an alternate approach where we instead compute Fourier moments of the data and where the smearing matrix describes how the acceptance (non-uniform sampling) causes mixing between the Fourier moments rather than between histogram bins. Such an approach is depicted in Fig. 3. The matrix is now invertible and we could proceed to solve for the corrected moments. While this approach is conceptually straightforward, the exact details of how to compute the smearing matrix, in this case, are not obvious, and one could rightly ask whether such a method is mathematically justified. Rather than making assumptions about its validity, we seek to mathematically derive a numerical approach based on first principles. This derivation ultimately yields this exact approach.
Fig. 3.
Motivating example: Fourier moment approach. (a) Plot of each Fourier component of the data in Fig. 2(a). The moments are the constant, sine, and cosine terms. (b) Fourier moments as a vector. (c) The actual acceptance. (d) Acceptance is represented as a 2D smearing matrix of Fourier moments. (e) As in the histogram method (Fig. 2), the solution is again obtained by solving a linear equation, this time ; c.f., (19).
B. Background Information
Before introducing our new methods, we first review Monte Carlo integration and some details about circular moments. This allows us to highlight the close relationship between circular moments, Fourier moments, and the Rayleigh test statistic. We note that our specific objective is to provide a solution to estimating circular statistics and their uncertainty in the presence of non-uniform sampling. Addressing how non-uniformity of the measurement process influences other statistics used with circular data is beyond the scope of this paper.
Direct Monte Carlo integration is a common technique for numeric estimation of integrals [16]. Consider an integral of the form
| (1) |
where the integration domain is a real, multidimensional space, is a probability distribution function, and is a generic Lebesgue integrable function. Based on the law of the unconscious statistician (LOTUS), the integral is simply the expectation value of given , i.e., . Given data points drawn from , the numeric estimate of the integral is
| (2) |
[16].
The definition of the th circular moment is
| (3) |
| (4) |
where is a one-dimensional circular probability distribution function (PDF) with domain spanning . Note, (4) follows from (3) due to LOTUS. We also observe from (4) that the circular moments are identical to the Fourier moments of the PDF . Thus, the PDF can be formally written as
| (5) |
Note, normalization of the PDF implies that . Lastly, as is assumed to be real-valued, the and components are equal, and thus we arrive at
| (6) |
We can apply direct Monte Carlo integration to (4) to obtain the standard formula for the numeric estimate of the circular moments. Let be a sample of data points drawn from . Applying direct Monte Carlo integration yields the following formula as an estimate of , the numerical estimate of the true coefficients :
| (7) |
We note, in practice, it is easier to work with the real-valued components
| (8) |
| (9) |
with . Note, if we were to model the PDF as
| (10) |
we then have the relationships
| (11) |
| (12) |
note the factor of 2 consistent with (6). Lastly, the Rayleigh test statistic, often written , is defined as the number of data points times the squared magnitude of the first moment [17],
| (13) |
The statistic follows a -distribution with 2 degrees of freedom [17].
Thus, we see that the standard formula for circular statistics are just estimates of the Fourier moments using the method of direct Monte Carlo integration. The Raleigh test statistic directly follows from the first moment. In the case of complete sampling and non-negligible measurement bias, the standard method is to estimate the Fourier moments using (8)–(9), from which the Rayleigh test statistic can be derived. In the case of incomplete or otherwise non-uniform sampling or non-negligible measurement bias, these Fourier moments cannot be estimated directly from (8)–(9); instead, more advanced techniques are needed—the gap directly addressed by this manuscript. We note that our proposed correction method is more general than just computing Fourier moments, and so we next present this more general case. The specific case of Fourier moments is considered afterward in Section II-C4.
C. The Unfolding Procedure
1). Theoretical Foundations:
We are now ready to present the theoretical basis of our correction method. Consider a general experiment based on measuring the occurrence of events. For each event, let certain qualities be measured, represented by the vector , for example, the time of day the event occurred. Consider also the inaccessible vector of true values . In other words, if a perfect measurement process and the actual measurement process both measured the exact same circumstance, the perfect measurement process would yield and the actual measurement process would either yield or fail to record the event. The difference between and reflects the precision and accuracy of the measurement process. While one can directly estimate the PDF of the measured values, , the goal is to estimate the PDF of the true values, , i.e., the values that would be obtained given a perfect experiment. The relationship between the true and measured PDFs can be expressed as a Fredholm integral equation,
| (14) |
where is the measurement domain with volume . The conditional probability captures both measurement bias and non-uniform (including incomplete) sampling. The factor of is present as an overall scale factor to ensure the PDF on the left is properly normalized in the case of non-uniform sampling. In the Fredholm equation, (14) we consider that and are known quantities and that and are unknown. We note Fredholm integral equations are inherently ill-conditioned [18]. In practice, however, a sufficiently accurate approximation can often be found, but this accuracy must always be checked; see Section II-C5.
We next introduce a generic set of basis functions . We note need not be a complete basis of the entire space of PDF functions (i.e., the space of integrable functions), nor is it required that the basis be orthonormal. It is sufficient that it spans a subset covering the expected domain of and and that the inner product matrix be full rank.
Our approach determines first an estimate of , from which the estimates of and can be derived by noting
| (15) |
We look for solutions of that can be expressed as a linear combination of the chosen set of basis functions. Specifically, we represent by the vector with
| (16) |
Thus, to estimate , it is sufficient to estimate . Next, let matrix and vector be defined according to
| (17) |
| (18) |
The vector is the parametrization of in the chosen basis. The matrix is a generalization of the histogram-based smearing matrix [13]. We can then multiply both sides of the Fredholm integral equation with a basis function and integrate over , which simplifies to
| (19) |
Solving for is then straight-forward linear algebra, with various applicable techniques discussed in Section II-C3. First, however, we describe the estimation of and and their covariance.
2). Estimation of the Known Quantities in the Fredholm Equation:
The quantities considered as known in the Fredholm Equation (14) are and , with parameters in the vector and the matrix . We next estimate this matrix and vector using direct Monte Carlo integration. Let be a set of data points drawn from the distribution . Note, these are the values measured in the experiment. Elements of the vector are estimated using Monte Carlo integration,
| (20) |
where is the set of measured data points.
We note that can be expressed as . Thus, using a numeric simulation, one can generate data according to with a uniform prior, i.e., , where is the volume of the integration domain. In practice, this typically means starting with a data set of drawn uniformly at random over the full measurement domain , redacting data points to mimic the effect of incomplete or otherwise non-uniform sampling, and estimating the measured value for each that was not redacted.
Let be a set of data points drawn from with uniform . Elements of them matrix can be then computed according to
| (21) |
3). Solving the Fredholm Equation (Unfolding):
The process of solving the Fredholm Equation (14) or numeric approximates (19) is often called unfolding in the high energy physics community (see Table I). Based on (19), the solution for can formally be written as
| (22) |
In practice, a more stable estimate of alpha can be determined using methods to solve the linear equation that does not involve the inverse of (such as QR decomposition). We note that if the null-space of is non-trivial, then is not unique. In practice, tends to be full rank but can have eigenvalues near-zero. The condition number of the matrix (ratio of the largest to smallest eigenvalue) thus directly assesses whether the bias and non-uniform sampling preclude a unique estimation of , i.e., .
4). Fourier Basis:
To return to the case of circular statistics and the Rayleigh test, we consider the case of the basis functions being Fourier moments. Let be the maximum order, and we enumerate the basis functions as
| (23) |
When using this basis for unfolding, (16) implies that . The remaining elements of are proportional to and from (10). To recover the circular statistics, we just need to divide by a factor of and focus on indices greater than zero. We define a new ,
| (24) |
We can also transform the circular moments into magnitudes and phases, e.g.,
| (25) |
| (26) |
Note, the Fourier moments are (see Section II-B).
Lastly, the Raleigh test statistic can be computed by substituting the values from (25) into (13). Note, however, that the Rayleigh test statistic does not account for the measurement effects captured in , and thus it may overestimate the significance (i.e., underestimate the -value). See more details in our fourth simulation, described in Section IV-D.
5). Design Considerations:
Given the inherent ill-conditioned nature of the incomplete sampling and measurement bias captured in and the matrix , it is essential that every analysis using this method assess the stability and accuracy of the solution given their unique measurement scenario. This involves two specific tasks. First, the condition number of the matrix must be considered. Secondly, simulated data should be generated with a known true distribution, and then the moments from the known distribution should be compared with the reconstructed values. The method should be repeated for various values of the true distribution as more than one true distribution could result in the same measured distribution if the null space of is approximately non-trivial. In these cases, it is wise to generate a large amount of data—10 times the among of actual experimental data is a common rule of thumb—such that the variance in the estimated parameters from the simulation is much lower than the variance of the parameters extracted from the actual experimental data. Specific examples of conducting these simulations are given in Section IV.
A potentially overlooked aspect of non-uniform or incomplete sampling is that it can induce correlation in measured variables even when the true variables are not correlated. This effect is sometimes called cross-talk. This should be remembered when reporting results, as all extracted coefficients are correlated. This correlation also impacts the selection of the basis functions. For example, if one desires to assess circadian cyclicity, it is sufficient to estimate the true value of the magnitude of the first Fourier moment. One might naively select a basis that only includes the first moment, i.e. a basis of and . However, given the mixing of moments caused by the nontrivial , it is necessary in practice to include the zeroth moment (which should always be included) as well as potentially higher moments. Conceptually, this is similar to aliasing, as the higher moments influence the estimate of the lower moments, although the cause is completely different. Thus, there is a trade-off in the choice of basis functions: too few, and the effect of the mixing between moments will not get accurately unfolded; but too many, and the condition number of will increase. Good design practice is to select enough basis functions to allow the coefficients (moments) of interest to be reconstructed with sufficient accuracy, but not to include so many as to significantly negatively impact the condition number of the smearing matrix . The optimal number of basis functions can potentially vary for each data set considered.
III. Code Availability
Matlab code has been posted to https://github.com/sgliske/unfolding. We also provide a flowchart of the algorithm in Fig. 4.
Fig. 4.
Flowchart. The major processing steps of the unfolding process are provided in this flowchart. Simulated data is used to compute the smearing matrix using Monte Carlo integration, (21). The actual experimental data is used to compute uncorrected moments , also using Monte Carlo integration, (20). These values are then used to compute the corrected moments using linear algebra since , (19). Lastly, the corrected moments can be converted to phases and magnitudes using (24), (25) and (26).
IV. Experiments and Analyses
Each of the following simulations is based on the scenario of measuring the circadian oscillation of the occurrence of some event. For each simulation, we repeated the same general process, which involved the following steps. First, we chose an acceptance to use for the simulation. We note that in actual experiments, the acceptance is generally a known quantity, i.e., we know when data are being collected. We then selected a known true distribution and simulated how data with that true distribution would appear if measured with the chosen acceptance. We also applied the unfolding procedure and compared how well the unfolded parameters matched the true parameters. The process was then repeated for a variety of parameters of the true distribution and/or a variety of choices of acceptance.
A. Simulation 1, First Toy Model
The first simulation is a simplified toy example. For the acceptance, we simulated that the machine stopped recording during the last 6 hours of recording, and thus only the data during the first 18 hours were measured. In other words, the acceptance was modeled as perfect from 0.00 to 18:00 hours and exactly zero from 18:00 to 24:00 hours. We then considered how several different true distributions would appear with this acceptance and how well the unfolding procedure would work. We specifically used an amplitude of 0.3 and selected 12 values for the zenith of the true data distribution, ranging from 1:00 to 23:00 in two-hour steps. The value of 0.3 was chosen arbitrarily. We also investigated other amplitude values, with qualitatively similar results, but for the sake of clarity, we present just results with an amplitude of 0.3. Data were specifically generated using the rejection method [19]: we first generate data (times of day) according to the acceptance distribution; we then rejected events from this set to induce the chosen PDF for the “measured“ events. We used 100,000 events for estimating the smearing matrix and simulated 100,000 “measured” events. We selected large numbers to minimize the impact of random fluctuations on these examples.
From these data, we computed and using (20) and (21). Next, we computed by solving (19). We then transformed these values to Fourier moments and phases using (24), (25), and (26).
Results are shown in Fig. 5. Even though we tested with true distributions having zeniths across the full 24 h period, the measured moments always had a zenith between 6:00 and 12:00, consistent with a nadir always being between 18:00 to 24:00, the period when no data was recorded. The unfolding method recovers the true zenith and amplitude. Over all parameters considered, we observed that the root mean square (RMS) residual between the true and unfolded moments was 0.004, corresponding to a 1% resolution (0.0004/0.3 = 0.013).
Fig. 5.
Results for Simulation 1, First Toy Model. (a) Acceptance. In this simulation, data were recorded uniformly from 0.00 to 18:00 hours, but no data were recorded from 18:00 to 24:00 hours. (b) Data distribution, example 1. The red dotted line represents what would have been measured with ideal acceptance, whereas the blue solid line represents what would have been recorded with the acceptance in (a). Data were generated with an amplitude of 0.3 and a zenith at 3:00 hours. (c) Model fits of the data in (b), i.e. plotting (10) using either moments directly computed from the data (11) and (12) or moments computed via unfolding (24). While the measured data (blue line) does not match the true model (red dotted line), the model using the unfolded parameters matches extremely well. (d) Data distribution, example 2. The nadir of the distribution was set to 21:00, centered in the period with no acceptance. (e) The effect is a measured data distribution that is perfectly out of phase, as the data are now symmetric about 9.00 and 21:00, and there is more data around 9.00 than around 21:00. (f) Results of the full scan over the zenith of the true distribution. The amplitudes, vertical axis, are based in (25), and the zeniths, horizontal axis, are based on (26). We repeated the process for 12 different values of the zenith of the true distribution, spaced every two hours across the 24 h period. The data from (c) and (e) each generate a triplet of true, measured, and unfolded points in this figure, with letters next to the specific points corresponding to those panels. The very large discrepancy between measured values (blue diamonds) and true values (red circles) shows that the non-uniform acceptance causes extreme bias to the measured circadian moments.
B. Simulation 2, Second Toy Model
In the second simulation, we repeated the identical procedure as in the first simulation but with a different choice of acceptance. We modeled that the recording device was started at 18:00 hours, and turned off at 24:00 hours, a recording duration of 30 hours. The acceptance is thus twice as high during 18:00 to 24:00 hours as it is during the rest of the day. See Fig. 6. We observed that depending on the zenith of the true distribution, the acceptance can cause the measured data to have circular moments with amplitudes nearly unchanged (but with a shifted zenith), Fig. 6(b)–(c), or with amplitudes near zero and a zenith that is off by 12 hours, Fig. 6(d)–(e). As in simulation 1, the unfolding procedure recovers the correct parameters with a very lower error: the residual RMS is again 0.004.
Fig. 6.
Results for Simulation 2, Second Toy Model. Data are presented in the same way as they were for simulation 1, Fig. 5. (a) Acceptance. (b) and (d) Data distributions for two examples. (c) and (e) Model fits for two examples. (f) Results for the full scan. The measured data always yield zeniths within a few hours of 21:00 with widely varying amplitudes, even though the true zeniths span the full 24 h period and the true amplitudes were always 0.3. In the first example (b)–(c), the amplitude is nearly unchanged but the zenith is shifted from 5:00 to 0:24 hours. In the second example (d)–(e), the heightened acceptance occurs right at the zenith of the distribution, causing the amplitude of the measured data to be near zero and the zenith to be off by 12 hours. Unfolding can reconstruct the true values with a small residual.
C. Simulation 3: Real World Acceptance
1). Motivation:
For our next simulation, we will use acceptance values from real-world data related to our ongoing epilepsy research. High frequency oscillations (HFOs) are an electrographic element observed in intracranial EEG [20].While healthy tissue can produce HFOs, they have a higher prevalence in tissue-instigating seizures [21],[22],[23].Understanding how HFO rates vary with time of day and with state of vigilance gives insight into their pathophysiology and may also help guide the optimization of their clinical interpretation. However, intracranial EEG monitoring typically involves gaps in the recordings, for example, if the patient needs to have mapping procedures or extra imaging. Thus, the sampling across the 24-hour period is not uniform. Additionally, patients sleep very poorly during intracranial EEG monitoring, and thus restricting HFO analysis to specific stages of sleep results in a highly inconsistent and sporadic sampling of events across the 24-hour daily cycle; see Fig. 1. The acceptance function for analyzing the 24-hour cyclicity of HFOs is the probability that an HFO at a given time would be measured. If we restrict the analysis to just a specific stage of sleep, the acceptance is then the probability that the iEEG recording was being taken and that the patient was in the given stage of sleep. In short, the acceptance for analysing HFOs in a given sleep stage is the distribution of when that sleep stage was recorded. Thus, methods to correct for non-uniform and incomplete sampling are essential to understand the cyclicity of HFOs controlled for states of vigilance.
2). Patient Data:
At the University of Michigan, we have acquired a large database of multi-day, intracranial EEG recordings, the vast majority of which have had sleep scoring performed by a sleep technician based on the scalp EEG [24]. The database was gathered under the approval of the local Institutional Review Board (IRB #HUM00073616), and all subjects in the database have either given their consent (adults) or have assented to participate (children) with consent being provided by a parent, guardian, or legally authorized representative. All subjects meeting the following inclusion criteria as of February 1, 2022, were included in this study: clinical data acquisition with a sampling rate of 4,096 Hz and sleep scoring completed for at least 24 hours of data. This resulted in 58 subjects, with the amount of sleep-scored data ranging from 30.1 to 395.0 hours (median 167 hours). We divided the state of vigilance into 3 categories: awake, REM, and non-REM (NREM). Only data from one subject is used in this simulation, Simulation 3, though data from all subjects are used later in Simulation 4.
3). Experimental Design:
We repeated the process used in simulations 1 and 2 with two minor modifications. First, for the acceptance, we selected that of when NREM sleep occurred in an example patient. Note, in actual experiments, the acceptance is a known, measurable quantity. Second, we increased our parameter scan for the true data distribution. For each of the 12 zenith values, we also considered 5 different amplitude values, ranging from 0.1 to 0.5 in steps of 0.1. See Fig. 7. This type of study is essential when using the unfolding methods because it informs whether the non-uniformity of sampling allows or precludes reconstruction of the actual true values.
Fig. 7.
Results for Simulation 3, Real World Acceptance. Data are presented in the same way as they were for simulation 1 and 2, Figs. 5–6. (a) Acceptance. In this case, the acceptance is the relative amount of NREM sleep over the 24 h period from a multi-day hospital stay of an example subject, the same data are shown in Fig. 1(a). (b) and (d) Data distributions for two example true distributions. (c) and (e) Model fits for two examples. Note, the model fits are not strictly positive, which breaks the positivity constraint for PDFs. (f) Results for the full scan. Due to the density of points, the specific values corresponding to the results in panels (c) and (e) are not indicated. We observe that the acceptance is so extreme that the measured data always yielded circular moments with zeniths between 1:00 and 5:00 hours and with amplitudes that are much too large. Unfolding can reconstruct the true values with a small residual: RMS of residual over all true parameters is 0.007.
4). Results:
Results for simulation 3 are shown in Fig. 7. The NREM sleep in this patient mainly occurred during the hours of 0:00 and 7:00 hours, but the acceptance is highly non-uniform. As with our first two simulations, we observed that circadian moments directly computed from the measured data are extremely inaccurate due to the very non-uniform acceptance. Again, unfolding can reconstruct the true values with low error across the full parameter range.
D. Simulation 4: Assessing Statistical Uncertainty
1). Motivation:
Our first several simulations have demonstrated that our unfolding procedure accurately reconstructs the circular moments. In this last simulation, we seek to assess whether unfolding has mitigated the influence of imperfect acceptance on the Rayleigh test results. Recall, the Rayleigh test is an analytic approach to assess the statistical significance of circular moments being non-zero, against the null hypothesis that the moments are zero. Non-uniform acceptance increases the uncertainty, which is not accounted for in the Rayleigh test statistic. Therefore, we anticipate that the Rayleigh test statistic overestimates statistical significance and is thus not applicable in the case of non-uniform sampling. To assess this, we compared the Rayleigh test statistic with direct numerical estimation.
2). Simulation Design:
The comparison of the Raleigh test statistic (an analytic method) and direct estimation (a numeric method) is much simpler in terms of amplitude thresholds rather than -values. Recall that for any given level of statistical significance ( value) and number of data points, there is a corresponding amplitude that corresponds to that threshold. In other words, amplitudes above that threshold have -values greater than and allow rejecting the null hypothesis, whereas amplitudes below that value have and do not allow rejection of the null hypothesis. Overestimating the -value is the same as underestimating the amplitude threshold for significance.
To compute the threshold numerically, we simulated the null hypothesis 1,000 times for each state of vigilance for each patient. As with simulation 3, the acceptance was the distribution of the state of vigilance for each subject, but in this case, we analyzed all states of vigilance and set the number of events equal to the number of events (HFOs) recorded during each of those states of vigilance in each patient. This provides realistic sample sizes. Among the 1,000 iterations, the 95%-tile of the distribution of those amplitudes gives a direct, numeric estimate of the threshold for statistical significance. By design, this approach includes all the effects of the non-uniform acceptance for the specific acceptance used in the simulations.
To compute the threshold analytically using the Rayleigh statistic, we solved (13) for the magnitude of the amplitude. We then put the value of the inverse distribution for and the number of events (the same number of events as for the numerical estimation) into this equation to yield the threshold.
3). Results:
In Fig. 8, we compare the threshold for significance at the level for the Rayleigh test statistic (“analytic method”) versus the simulation (“numeric method”). As expected, we observed that the thresholds computed by the simulation are either close to or slightly higher than those from the Rayleigh test. At first glance, the magnitude of the difference appears small, but as the circadian moments of the HFOs have not yet been measured, one cannot conclude whether the magnitude of the difference is relatively small or not. The difference between the thresholds from the analytic and numeric methods is strongly correlated with the condition number of the smearing matrix (, less than machine precision, Spearman Correlation Coefficient). Recall the condition number of the smearing matrix is an assessment of how strongly the non-uniform acceptance is limiting the reconstruction of the moments. Thus, we observe that the Rayleigh test statistic overestimates statistical significance in general, with the effect increasing when the acceptance is further from the ideal.
Fig. 8.
Thresholds for distinguishing from the null-hypothesis. (a) The thresholds for the amplitudes of the circular moments being statistically significant at the level. The analytic threshold, based on the Rayleigh test statistic, appears as a straight line (black line) when plotted on a log-log plot. The numeric threshold (blue circles), computed by simulating the null hypothesis, is typically larger than the analytic threshold, demonstrating that the analytic threshold has overestimated statistical significance. (b) Histogram of the difference between the numeric and analytic thresholds. We observe that 95% of the differences are less than 0.032, suggesting that the overestimation of statistical significance in this data set is small but non-negligible. (c) Association between the difference in thresholds and the smearing matrix condition number, a measure of the non-uniformity of the sampling. The Spearman correlation is 0.84, with -values below machine precision, meaning that the Rayleigh test statistic overestimates statistical significance to a greater degree for cases where the sampling is less uniform.
V. Discussion
We have presented a novel method to correct for non-uniform (including incomplete) sampling and measurement bias. We have also shown how these methods apply to the estimation of circular statistical moments and tests of their significance. We have applied these methods to simulations involving acceptances from simplified toy models and real-world data. We find that without unfolding, non-uniformity in the measurement process can have a drastic influence on the estimation of circular moments. Even so, our unfolding methods successfully corrected for incomplete and non-uniform sampling with high accuracy even in fairly extreme cases of incomplete and non-uniform sampling. For example, Simulation 3 includes a complex, real-world example of very limited acceptance. Note how greatly different the directly measured moments are from the true values in Fig. 7(f). Despite these challenges, our method can accurately recover the true Fourier amplitudes and phases: the unfolded moments nearly perfectly match the true values in Fig. 7(f). Given that the method works well in this challenging case, we expect it to also work well in a wide variety of circumstances, such as continuous glucose monitoring, circadian fluctuation of hormones, and cycling of seizures. We thus observe that while circular statistics and Rayleigh tests are not reliable when there is significant non-uniform sampling, the methods we present are highly robust even in the presence of extreme non-uniformity.
The topic of statistical significance requires some discussion. Recall, the Rayleigh test is designed to check the presence of the unimodal deviation from the uniform distribution. An alternate approach is the direct simulation of the statistical significance, although this method has much higher computational complexity and appears to be used less often. We compared the results of both of these approaches in Fig. 8. We observe that in the presence of non-uniform sampling, even when the moments are corrected, the Rayleigh test is still not robust. By construction, direct simulation of the statistical significance is still valid. We also note the existence of other related statistical tests, such as those that assess whether the entire distribution is uniform [25], [26]. These do not easily fit within the framework of basis functions, as, for example, they involve absolute values of the actual data values [25]. Thus, in the presence of non-uniform sampling, the only available, rigorous method for assessing statistical significance is direct simulation, an option we include with our posted code.
In some cases, it is more relevant to know the confidence interval around the unfolded moments rather than whether the null hypothesis can be rejected. This is particularly important when comparing different experiments to see if the circadian moments are consistent across the experiments. An alternate method can be used to estimate these confidence intervals, which is provided in the Appendix.
An important component of the method is selecting an appropriate basis expansion, including the number of basis elements. In the case of circular statistics, the basis functions are sine and cosine functions, but which functions are most relevant should be considered for each use case. For example, some histogram methods used in high energy physics (e.g., [13]), can be represented as a special case of our method using a basis of piecewise constant functions, though spherical harmonics are more appropriate in some circumstances (e.g., [27]). With any choice of basis function, the condition number of the smearing matrix is an essential key to selecting the number of basis elements.
An alternate approach to unfolding is called synthetic sampling. In that approach, one generates additional experimental data to replace the data missed by the non-uniform sampling. This requires a model of what the data would have been during times data were not measured. In our approach, we generate data according to a uniform distribution to learn how the non-uniform sampling impacts the results. If the end goal is to compute circular moments, both approaches assume that the data can be well represented by Fourier moments. However, the synthetic sampling approach has the additional confounding factor of selecting what model to use for the missing data, which our approach does not have. While synthetic sampling might be a sufficient approach for some cases with very little data missing, our method works in a much broader set of circumstances and has fewer assumptions.
One challenge that our method does not directly overcome is related to the concept of aliasing and is ubiquitous to analyses with incomplete sampling. In all cases, one should simulate data with all the moments which are expected to be non-zero to ensure that cross-talk between moments is not unduly influencing the results. Thus, while no method can fully replace what is lost by incomplete sampling, careful use of simulated data allows a rigorous assessment of when the results are expected to be reliable, thus providing high confidence when appropriate.
One advantage of our unfolding method is the large flexibility allowed by the choice of basis functions. The examples in this paper focused on the analysis of circular moments for 24-hour periods. If one wanted to simultaneously analyze both circadian and multidien moments, one could increase the number of basis functions to simultaneously correct the moments for both types of cyclicity. Additionally, modification of the basis functions to include other covariate variables allows for directly modeling how the circular static moments vary with other factors.
Our method overcomes the two noted challenges of the histogram method used in physics: confounding factors and non-invertible smearing matrices. Confounding factors can either be addressed after unfolding (as opposed to the histogram method requiring addressing them before unfolding) or explicitly modeled by adjusting the basis functions. Additionally, the use of basis functions generally avoids the zeros caused by incomplete sampling; c.f., motivating example.
VI. Conclusion
We have developed a novel method to address the problem of incomplete sampling and measurement bias when computing circular statistics. In doing so, we have given a full mathematical derivation from the first principles to establish the rigor and validity of the method. We have also presented several simulations which demonstrate the method can correctly recover the true values even in circumstances with extremely incomplete sampling of data. These methods apply to a wide variety of analyses in basic, translational, and clinical biomedical research.
Acknowledgment
William C. Stacey and Stephen V. Gliske have a licensing agreement with Natus Medical, Inc. for an HFO detection algorithm. Natus had no involvement in this study.
This work was supported by the National Institute of Health (NIH), under Award R01-NS094399. The human database was also developed under this award as well NIH under Awards K01-ES026839, K08-NS069783, and UL1-TR000433 and the Doris Duke Foundation under Award 2015096.
This work involved human subjects or animals in its research. Approval of all ethical and experimental procedures and protocols was granted by the University of Michigan Institutional Review Board under Application No. HUM00073616, and performed in line with the United States Federal Policy for the Protection of Human Subjects (the Common Rule).
Appendix
Derivation of Confidence Intervals
A. Background Information
We note the variance on direct Monte Carlo integration (2) is
| (27) |
in the case of one basis function [16]. When using multiple basis functions, we have
| (28) |
with covariance defined as
| (29) |
B. The Unfolding Procedure
1). General Basis:
The covariance on , (20) is
| (30) |
The covariance of , (21), is the 4-form
| (31) |
Using first-order propagation of covariance, we can estimate the covariance on , (22). Formally, it is
| (32) |
with Jacobians defined as
| (33) |
| (34) |
The first Jacobian is simply
| (35) |
based on (22). The second Jacobian can be obtained by implicit differentiation of (19), which we write out incomponent form as
| (36) |
We then apply the operator to both sides of (36). Noting the left side is zero, we have
| (37) |
| (38) |
| (39) |
Assuming that is invertible, yields
| (40) |
Lastly, for convenience we define matrix as
| (41) |
Substituting (35), 40 and 41 into (32) yields the final equation for the covariance on ,
| (42) |
| (43) |
2). Fourier Basis:
Recall is the normalized version of ,
(24). The Jacobian of this transformation is
| (44) |
The final covariance on is then
| (45) |
which can be directly computed from (43) and (44).
Lastly, we can transform the circular moments into magnitudes and phases, (25). For notational convenience, we combine the magnitudes and phases into one vector , with
| (46) |
We again use first-order propagation of covariance, resulting in the covariance matrix for being
| (47) |
The Jacobian matrix for this transformation is
| (48) |
Contributor Information
Abdallah Alsammani, Department of Neurosurgery, University of Nebraska Medical Center, Omaha, NE 68198 USA. He is now with the School of Science and Mathematics, Jacksonville University, Jacksonville, FL 32211 USA.
William C. Stacey, Department of Neurology and the Department of Biomedical Engineering, University of Michigan, Ann Arbor, MI 48109 USA
Stephen V. Gliske, Department of Neurosurgery, University of Nebraska Medical Center, Omaha, NE 68198 USA.
References
- [1].Panda S. et al. , “Coordinated transcription of key pathways in the mouse by the circadian clock,” Cell, vol. 109, no. 3, pp. 307–320, 2002. [DOI] [PubMed] [Google Scholar]
- [2].Liu D, Peddada SD, Li L, and Weinberg CR, “Phase analysis of circadian-related genes in two tissues,” BMC Bioinf., vol.7, no.1, pp. 1–10, 2006. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [3].Lee DY, Kim E, and Choi MH, “Technical and clinical aspects of cortisol as a biochemical marker of chronic stress,” BMB Rep., vol. 48, no. 4, pp. 209–216, 2015. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [4].Bergenstal RM, “Role of continuous glucose monitoring in diabetes treatment,” Amer. Diabetes Assoc, Hirsch IB, Ed., Arlington, VA, USA: American Diabetes Association, pp. 20–23, 2018. [Google Scholar]
- [5].Siehler O, Wang S, and Bloch G, “Remarkable sensitivity of young honey bee workers to multiple non-photic, non-thermal, forager cues that synchronize their daily activity rhythms,” Front. Physiol, vol. 12, 2021, Art. no. 2249. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [6].Botts RT et al. , “Circadian activity patterns of mammalian predators and prey in Costa Rica,” J. Mammal, vol. 101, no. 5, pp. 1313–1331, 2020. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [7].Baud MO et al. , “Multi-day rhythms modulate seizure risk in epilepsy,” Nature Commun., vol. 9, no. 1, pp. 1–10, 2018. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [8].Karoly PJ et al. , “Circadian and circaseptan rhythms in human epilepsy: A retrospective cohort study,” Lancet Neurol., vol.17, no.11, pp. 977–985, 2018. [DOI] [PubMed] [Google Scholar]
- [9].Mohammed M. et al. , “Studying the response of aortic endothelial cells under pulsatile flow using a compact microfluidic system,” Anal. Chem, vol. 91, no. 18, pp. 12077–12084, 2019. [DOI] [PubMed] [Google Scholar]
- [10].Begall S, Malkemper EP, Červeny J, Němec P, and Burda H,“Magnetic alignment in mammals and other animals,”Mammalian Biol.,vol.78,no.1, pp. 10–20, 2013. [Google Scholar]
- [11].Hoecker A. and Kartvelishvili V, “SVD approach to data unfolding,” Nucl. Instrum. Methods Phys. Res. Sect. A: Accelerators, Spectrometers, Detectors Assoc. Equip, vol. 372, no. 3, pp. 469–481, 1996. [Google Scholar]
- [12].Airapetian A. et al. , “Longitudinal double-spin asymmetries in semi-inclusive deep-inelastic scattering of electrons and positrons by protons and deuterons,” Phys. Rev. D, vol. 99, no. 11, 2019, Art. no. 112001. [Google Scholar]
- [13].Airapetian A. et al. , “Azimuthal distributions of charged hadrons, pions, and kaons produced in deep-inelastic scattering off unpolarized protons and deuterons,” Phys. Rev. D, vol. 87, no. 1, 2013, Art. no. 012010. [Google Scholar]
- [14].Airapetian A. et al. , “Multiplicities of charged pions and kaons from semi-inclusive deep-inelastic scattering by the proton and the deuteron,” Phys. Rev. D, vol. 87, no. 7, 2013, Art. no. 074029. [Google Scholar]
- [15].Klerman EB, Wang W, Phillips AJK, and Bianchi MT,“ Statistics for sleep and biological rhythms research: Longitudinal analysis of biological rhythms data,” J. Biol. Rhythms, vol. 32, no. 1, pp. 18–25, 2017. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [16].Cappé O, Moulines E, and Rydén T, Inference in Hiddon Markov Models. New York, NY, USA: Springer, 2005. [Google Scholar]
- [17].Brazier K, “Confidence intervals from the rayleigh test,” Monthly Notices Roy. Astronomical Soc, vol. 268, no. 3, pp. 709–712, 1994. [Google Scholar]
- [18].Polyanin AD and Manzhirov AV, Handbook of Integral Equations. London, U.K.: Chapman Hall/CRC, 2008. [Google Scholar]
- [19].Papoulis A. and Pillai SU, Probability, Random Variables, and Stochastic Processes. New York, NY, USA: Tata McGraw-Hill Educ., 2002. [Google Scholar]
- [20].Worrell GA, Parish L, Cranstoun SD, Jonas R, Baltuch G, and Litt B, “High-frequency oscillations and seizure generation in neocortical epilepsy,” Brain, vol. 127, no. 7, pp. 1496–1506, 2004. [DOI] [PubMed] [Google Scholar]
- [21].Engel J, Bragin A, Staba R, and Mody I, “High-frequency oscillations: What is normal and what is not?,” Epilepsia, vol. 50, no. 4, pp. 598–604, 2009. [DOI] [PubMed] [Google Scholar]
- [22].Gliske SV, Irwin ZT, Davis KA, Sahaya K, Chestek C, and Stacey WC, “Universal automated high frequency oscillation detector for real-time, long term EEG,” Clin. Neuriophysiol, vol. 127, no. 2, pp. 1057–1066, 2016. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [23].Gliske SV et al. , “Distinguishing false and true positive detections of high frequency oscillations,” J. Neural Eng, vol. 17, no. 5, 2020, Art. no. 056005. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [24].Gliske SV et al. , “Variability in the location of high frequency oscillations during prolonged intracranial EEG recordings,” Nature Commun., vol. 9, no. 1, Jun. 2018, Art. no. 2155. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [25].Landler L, Ruxton GD, and Malkemper EP, “Circular data in biology: Advice for effectively implementing statistical procedures,” Behav. Ecol. Sociobiol, vol. 72, no. 8, pp. 1–10, 2018. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [26].Landler L, Ruxton GD, and Malkemper EP, “The Hermans–Rasson test as a powerful alternative to the rayleigh test for circular statistics in biology,” BMC Ecol., vol. 19, no. 1, pp. 1–8, 2019. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [27].Gliske S. and Pappalardo L, “Dihadron production in semi-inclusive DIS from transversely polarized protons,” PoS, vol. DIS2013, 2013, Art. no. 233. [Google Scholar]








