 Short report
 Open Access
 Published:
Coarsegraining and the Haar wavelet transform for multiscale analysis
Bioelectronic Medicine volume 8, Article number: 3 (2022)
Abstract
Background
Multiscale entropy (MSE) has become increasingly common as a quantitative tool for analysis of physiological signals. The MSE computation involves first decomposing a signal into multiple subsignal ‘scales’ using a coarsegraining algorithm.
Methods
The coarsegraining algorithm averages adjacent values in a time series to produce a coarser scale time series. The Haar wavelet transform convolutes a time series with a scaled square wave function to produce an approximation which is equivalent to averaging points.
Results
Coarsegraining is mathematically identical to the Haar wavelet transform approximations. Thus, multiscale entropy is entropy computed on subsignals derived from approximations of the Haar wavelet transform. By describing coarsegraining algorithms properly as Haar wavelet transforms, the meaning of ‘scales’ as wavelet approximations becomes transparent. The computed value of entropy is different with different wavelet basis functions, suggesting further research is needed to determine optimal methods for computing multiscale entropy.
Conclusion
Coarsegraining is mathematically identical to Haar wavelet approximations at poweroftwo scales. Referring to coarsegraining as a Haar wavelet transform motivates research into the optimal approach to signal decomposition for entropy analysis.
Background
Multiscale entropy (MSE) was first introduced as a useful quantitative property of biological signals (Costa et al., 2002), initially demonstrated as a biomarker to distinguish diseased hearts from healthy or aging hearts (Costa et al., 2005; Norris et al., 2008; Costa et al., 2008). Subsequently, MSE analysis has been used to analyze many different physiological time series to find biomarkers for many conditions, including postural control (Busa & van Emmerik, 2016), epilepsy (Aung & Wongsawat, 2021; Sathyanarayana et al., 2021), autism (Bosl et al., 2018), schizophrenia (Hasey & Kiang, 2013), Alzheimer’s Disease (Horvath et al., 2018), as well as many applications outside of physiology (HumeauHeurtier, 2020). MSE has found increasing usefulness as a method for analyzing neurophysiological signals (Bosl et al., 2018; Gurau et al., 2017; Sathyanarayana et al., 2020). The method proposed to compute MSE involved two steps. First, the signal is decomposed into subsignals using an averaging process called coarsegraining, then the entropy of each subsignal is computed (Costa et al., 2002).
Nearly all publications involving multiscale entropy use the coarsegraining procedure as the first step in decomposing a physiological time series into smaller scales. The procedure is illustrated in Fig. 1. Historically, analysis of physiological time signals has focused on signal power in multiple, nonoverlapping frequency bands or across the ‘spectrum’ of frequencies. Many methods for spectral power analysis are available, including Fourier, wavelet, and Hilbert transforms (Bruns, 2004) and more recent variations on Fourier methods such as multitapers that improve the timefrequency resolution of the decomposition (van Vugt et al., 2007; Babadi & Brown, 2014). If power and entropy are each considered properties of a signal or time series, the question of the relationship between the scales derived from the coarsegraining algorithm and traditional frequency bands arises.
Filtering is an almost ubiquitous step in the preprocessing of electroencephalography EEG and magnetoencephalography (MEG) data. It lies in the nature of this process itself that filtering might seriously change the appearance of the signals and thereby affect the results obtained” (Widmann et al., 2015). An ideal filter for digital signals does not exist. All filters affect signals (Cover & Thomas, 2006). Since multiscale entropy analysis first applies a filtering step, by default using coarsegraining, it is important to understand how coarsegraining affects the signal to be analyzed and, in particular, what affect it may have on the signal entropy. By demonstrating that coarsegraining is identical to the Haar wavelet transform, the welldeveloped mathematics of wavelet filtering can be applied to this process.
The goal of this brief report is to demonstrate that the coarsegraining procedure is mathematically identical to the ‘approximations’ that are generated by the Haar wavelet transform. This enables future research on multiscale nonlinear signal analysis to consider signal decomposition using all of the various methods commonly used for spectral power analysis in a rigorous mathematical context. Furthermore, the overlapping frequency bands derived by coarsegraining or wavelet approximations, which successively subtract higher frequencies, differ from wavelet details, which produce nonoverlapping distinct frequency bands that are similar to the discrete bands used for power analysis. If entropy is computed on distinct frequency bands, then multiscale entropy could be called spectral entropy, to be compared to spectral power. Whether or not this is optimal is an open research question. Other nonlinear signal properties may also be compared with power and entropy across the same subsignals or frequency bands.
Methods
The coarsegraining procedure is a digital lowpass filter. Each successive scale in the coarsegraining procedure subtracts higher frequency components, leaving only the lower frequency components. The original and most common approach is to average sets of values to obtain scales: average every two points to create scale 2 subseries, average every 3 points to create scale 3 subseries, etc. (Fig. 1, upper level). A faster approach that gives only poweroftwo scales is to repeatedly average every pair of points in the previous subsignal (Fig. 1, lower level). Though not commonly done, this is obvious from simple arithmetic. We note this because poweroftwo scaling is commonly used for computing wavelet levels. The poweroftwo scales of coarsegraining, however computed, are mathematically identical to Haar wavelet transform approximations. We also note that wavelets are computed by convoluting scaled versions of the mother wavelet with the original signal. For computational efficiency, the mother wavelet is typically scaled by powersoftwo. However, this is not strictly necessary. If a Haar wavelet is scaled by successive integer factors, 2, 3, 4, and so on, and convoluted with a signal, then the resulting subsignals are identical to the scales derived by coarsegraining. Both Haar wavelets and coarsegraining can be applied to achieve identical integer scales or poweroftwo scales.
Quantitative analysis of physiological signals such as electroencephalograms (qEEG) typically involves decomposition of the signal from each sensor into nonoverlapping frequency bands using some spectral decomposition method, from which the average power on each subsignal is computed.
Many approaches, including Fourier, Wavelet, and Hilbert transforms, Empirical Mode Decomposition, multitaper methods (used together with Fourier transforms) and others. All of these methods seek to decompose a signal into subsignals that represent the signal at different frequency compositions or different scales. Formally, spectral analysis refers to the mathematical process of representing a function or signal as a sum of simpler functions, called basis functions, that meet certain mathematical requirements. A complete set of basis functions, called a basis set, satisfies mathematical constraints that make the set wellsuited for representing other, more complex functions. For example, a set of sinusoidal functions with integer wave numbers satisfy the requirements for a basis set and are commonly used for EEG power analysis. For any set of basis functions, { ϕ_{n}, n = 0, ±1, ±2, ±3, …}, we can write
If the basis functions are sinusoids, then (1) represents a Fourier series for the function f(x). The coefficients, a_{n}, are the amplitudes of each component function. The square of the amplitude of a sine wave is the power. Hence, the power of a specified frequency band can be conceptually found by summing the square of the coefficients of each component sine wave, although in practice more efficient algorithms are generally used.
A signal can be decomposed into multiple subsignals, each representing a different resolution or frequency composition of the original signal, using many different mathematical approaches. For example, Fourier, Wavelet, and Hilbert transforms have been shown to be equivalent under certain conditions, though each has advantages (Bruns, 2004). A great deal of research has been devoted to finding optimal methods for spectral analysis for specific signals and goals.
Power is only one property that can be computed to characterize a signal. One of many signal properties is the sample entropy that can be computed for any time series (HumeauHeurtier, 2020; Richman & Moorman, 2000). Just as spectral power refers to the average power in a specified frequency band, spectral entropy is an appropriate term for the entropy computed on each frequency band. The relationship between scales derived from coarsegraining and frequency bands can be made explicit.
Similar to Fourier decomposition, wavelet transforms decompose a signal using a different set of basis functions. Unlike sine waves, that are infinite, wavelet basis functions are nonzero only on a finite interval, termed ‘compact support’. The Haar wavelet was the first wavelet basis function used for signal processing. In the mid1980s, wavelet transform analysis developed rapidly when it was found to be wellsuited for seismic signal analysis (Goupillaud et al., 1984). Many different wavelet basis functions have been developed since then. An evaluation of dozens of wavelet families, each with as many as a hundred or more subtypes, found that the Daubechies 44 (db44) was most similar mother wavelet function across a variety of biological signals and potentially optimal (Rafiee et al., 2011). A comparison of wavelet bases for detecting EEG changes to multiscale entropy for a working memory task found that the sym9 wavelet gave the best results on a crosscorrelation analysis (AlQazzaz et al., 2015). The Morlet wavelet transform is in fact identical to shorttime Fourier transform (STFT) when using a Gaussian window (Bruns, 2004).
Results and discussion
All wavelet transforms decompose a time series into pairs of subseries, each of which is half the length of the original. Mathematically this is accomplished by convolution, whereby the basis function is multiplied by the original signal while sliding along the signal. For each successive step, the basis function is scaled to be larger, thus detecting signal variation on different scales. One subseries is a running average or trend, called the ‘approximation,’ while the other subseries tracks the differences between the original points and the averages, called the ‘details.’ The approximation is a smoothed version of the signal, while the detail signal contains the finer variation that was lost in the previous approximation step. One step of a wavelet decomposition splits the signal in half by frequencies, where the approximations contain the lowfrequency components and the details contain highfrequency components. An example of this process is shown in Fig. 3.
The original signal in Fig. 2 is extracted from a single channel of an EEG recording and has a sampling rate of 256 Hz. It will contain frequency components up to 128 Hz, according to the Nyquist criterion, which states that a time series can only represent frequencies of up to onehalf of the sampling rate. The first level of wavelet approximation contains frequency components up to 64 Hz, while the respective details contain all frequency components from 64 to 128 Hz. The process continues by successively splitting the previous approximation, producing respective approximations and details for each level.
We note here that traditional power analysis computes the power of nonoverlapping frequency bands. For example, electroencephalography (EEG) analysis computes the average power on five frequency bands: delta (0–4 Hz), theta (4–7 Hz), alpha (7–13 Hz), beta (13–30 Hz), and gamma (30–60 Hz). These are approximately equivalent to wavelet details (Bosl et al., 2018; Sathyanarayana et al., 2020). In contrast, coarsegraining, or Haar wavelet approximations, define overlapping bands where the higher frequencies are successively removed. Figure 3 illustrates the equivalence of coarsegrain scales and wavelet approximations, and the approximate relationship between wavelet details and traditional nonoverlapping frequency bands.
The approximations produced by a Haar wavelet transform are identical to the poweroftwo scales of the coarsegraining procedure. This relationship is proven mathematically by noting that the averaging filter for the Haar wavelet has a width equal to 2^{n} points on the time series, where n is the wavelet level. The coefficient for the wavelet as it slides along the length of the signal is equal to the mean of the time series values contained in its length. Each point in level A1 is found by successively averaging 2 points as the averaging filter is moved along the time series from right to left. For level 2 (or scale 4 in the coarsegraining procedure, since scale = 2^{level}), the wavelet averaging filter is 2^{n} points wide, thus averaging 4 points at a time, and so on. Note that the coarsegraining scales are related to wavelet levels (A0, A1, etc) by powers of two: the scale is derived by raising 2 to the power of the wavelet level. Thus, the original signal is wavelet level 0 (A0) or scale 1 = 2^{0}. Wavelet level 3 (A3) is scale 8 = 2^{3} in the coarsegraining terminology.
Suppose for any given time series there are N values. Mathematically, the values for the next level of approximation in the wavelet transform are given by:
Thus, a1 = (x_{1} + x_{2})/2, a2 = (x_{3} + x_{4})/2, a1 = (x_{5} + x_{6})/2, and so on, which is identical to the poweroftwo scales in the coarsegraining procedure. The detail coefficients are given by:
The reconstruction process whereby successively lower levels are reconstructed is accomplished by:
We note that wavelet coefficients are typically multiplied by \( \sqrt{2} \) to preserve the energy or power of the signal since at each step the signal is half as many points long. Further information about wavelet algorithms can be found in wavelet texts (Addison, 2005; Walker, 2008).
While power is preserved with different wavelet basis functions, the effect of different wavelet basis functions on entropy or other nonlinear measures using different wavelet basis functions has not yet been explored. In Fig. 4 multiscale entropy curves were computed for EEG and polysomnography signals using haar (equivalent to coarsegraining), db4 (Rafiee et al., 2011), and sym9 (AlQazzaz et al., 2015) wavelets. While the general shape of the curves is relatively the same, the values are clearly different, diverging especially in the higher scales, or lower frequency ranges. This suggests that the optimal approach to computing entropy on multiple scales remains to be fully explored.
In summary, the Haar wavelet produces subseries by averaging 2 points at a time, then 4 points at a time, then 8 points at a time, and so on. The coarsegraining procedure typically averages 2, 3, 4, 5, … points at a time. Thus, for powers of 2, the coarsegraining procedure is identical to the approximations of the Haar wavelet transform. The coarsegraining procedure does not produce any subseries equivalent to the detail subseries of a wavelet transform. The detail subseries are equivalent to the nonoverlapping frequency bands produced by a typical Fourier decomposition using poweroftwo multiples of the sampling rate.
Conclusions
The relationship between scales, as used in the multiscale entropy literature, and typical frequency bands that are ubiquitous in quantitative EEG analysis is now explicit. The scales derived from coarsegraining are mathematically identical to the approximation levels derived from the Haar wavelet transform. The details produced by a wavelet transform are nonoverlapping frequency bands, similar to traditional frequency bands used for EEG analysis. The Haar wavelet is only one of many wavelet basis functions that may be used for signal decomposition. A great deal of research has been done to explore optimal frequency decomposition methods for physiological signals. In future studies that use multiscale entropy, referring to the Haar wavelet transform approximation rather than ‘coarsegraining’ will place this decomposition in a rigorous context and allow comparison with alternative basis functions or with traditional spectral decomposition methods. Thus far, by default, multiscale entropy analysis has adopted the Haar wavelet decomposition. Whether or not this is optimal for multiresolution entropy or nonlinear analysis, and why this should be different from traditional spectral decomposition used for power analysis, has yet to be explored.
Availability of data and materials
This paper is concerned with computational algorithms and applies generally to all time series data. Figure 2 was created using a single channel of EEG data taken from a public file randomly chosen from the PhysioNet database: https://physionet.org/content/chbmit/1.0.0/. Example data from which multiscale curves in Fig. 3 were computed were also selected from the PhysioNet database. Wavelet decompositions were computed using the example code in the Python PyWavelets package: https://pywavelets.readthedocs.io/en/latest/.
Abbreviations
 EEG:

Electroencephalogram
 MEG:

Magnetoencephalography
 MSE:

Multiscale Entropy
References
Addison PS. Wavelet transforms and the ECG: a review. Physiol Meas. 2005;26(5):R155–99. https://doi.org/10.1088/09673334/26/5/R01.
AlQazzaz NK, Hamid Bin Mohd Ali S, Ahmad SA, et al. Selection of mother wavelet functions for multichannel EEG signal analysis during a working memory task. Sensors (Switzerland). 2015;15(11):29015–35. https://doi.org/10.3390/s151129015.
Aung ST, Wongsawat Y. Prediction of epileptic seizures based on multivariate multiscale modifieddistribution entropy. PeerJ Comput Sci. 2021;7:e744. https://doi.org/10.7717/peerjcs.744.
Babadi B, Brown EN. A review of multitaper spectral analysis. IEEE Trans Biomed Eng. 2014;61(5):1555–64. https://doi.org/10.1109/TBME.2014.2311996.
Bosl WJ, TagerFlusberg H, Nelson CA. EEG analytics for early detection of autism Spectrum disorder: a datadriven approach. Sci Rep. 2018;8(1):6828. https://doi.org/10.1038/s4159801824318x.
Bruns A. Fourier, Hilbert and waveletbased signal analysis: are they really different approaches? J Neurosci Methods. 2004;137(2):321–32. https://doi.org/10.1016/j.jneumeth.2004.03.002.
Busa MA, van Emmerik REA. Multiscale entropy: a tool for understanding the complexity of postural control. J Sport Health Sci. 2016;5(1):44–51. https://doi.org/10.1016/j.jshs.2016.01.018.
Costa M, Goldberger AL, Peng CK. Multiscale entropy analysis of complex physiologic time series. Phys Rev Lett. 2002;89(6):68102. https://doi.org/10.1103/PhysRevLett.89.068102.
Costa M, Goldberger AL, Peng CK. Multiscale entropy analysis of biological signals. Phys Rev E. 2005;71(2):21906. https://doi.org/10.1103/PhysRevE.71.021906.
Costa MD, Peng CK, Goldberger AL. Multiscale analysis of heart rate dynamics: entropy and time irreversibility measures. Cardiovasc Eng. 2008;8(2):88–93. https://doi.org/10.1007/s1055800790491.
Cover TM, Thomas JA. Elements of Information Theory. 2nd ed. New York: Wiley; 2006. https://www.wiley.com/enus/Elements+of+Information+Theory%2C+2nd+Editionp9780471241959 (accessed 6 Jan 2022)
Goldberger AL, Amaral LA, Glass L, et al. PhysioBank, PhysioToolkit, and PhysioNet: components of a new research resource for complex physiologic signals. Circulation. 2000;101(23):E215–20. https://doi.org/10.1161/01.CIR.101.23.e215.
Goupillaud PL, Grossmann A, Morlet J. A simplified view of the cycle? Octave and voice representations of seismic signals. In: SEG Technical Program Expanded Abstracts; 1984. Society of Exploration Geophysicists. p. 379–82. https://doi.org/10.1190/1.1893998.
Gurau O, Bosl WJ, Newton CR. How useful is electroencephalography in the diagnosis of autism Spectrum disorders and the delineation of subtypes: a systematic review. Front Psychiatry. 2017;8:121. https://doi.org/10.3389/fpsyt.2017.00121.
Hasey GM, Kiang M. A review of recent literature employing electroencephalographic techniques to study the pathophysiology, phenomenology, and treatment response of schizophrenia topical collection on schizophrenia. Curr Psychiatry Rep. 2013;15(9):388. https://doi.org/10.1007/s119200130388x.
Horvath A, Szucs A, Csukly G, et al. EEG and ERP biomarkers of Alzheimer’s disease: a critical review. Front Biosci. 2018;23(1):183–220. https://doi.org/10.2741/4587.
HumeauHeurtier A. Multiscale entropy approaches and their applications. Entropy (Basel). 2020;22(6):E644. https://doi.org/10.3390/e22060644.
Norris PR, Stein PK, Morris JA Jr. Reduced heart rate multiscale entropy predicts death in critical illness: a study of physiologic complexity in 285 trauma patients. J Crit Care. 2008;23(3):399–405. https://doi.org/10.1016/j.jcrc.2007.08.001.
Rafiee J, Rafiee MA, Prause N, Schoen MP. Wavelet basis functions in biomedical signal processing. Expert Syst Appl. 2011;38(5):6190–201. https://doi.org/10.1016/j.eswa.2010.11.050.
Richman JS, Moorman JR. Physiological timeseries analysis using approximate entropy and sample entropy. Am J Phys Heart Circ Phys. 2000;278(6):H2039–49. https://doi.org/10.1152/ajpheart.2000.278.6.H2039.
Sathyanarayana A, El Atrache R, Jackson M, et al. Nonlinear analysis of visually Normal EEGs to differentiate benign childhood epilepsy with Centrotemporal spikes (BECTS). Sci Rep. 2020;10(1):8419. https://doi.org/10.1038/s4159802065112y.
Sathyanarayana A, El Atrache R, Jackson M, et al. Measuring the effects of sleep on epileptogenicity with multifrequency entropy. Clin Neurophysiol. 2021;132(9):2012–8. https://doi.org/10.1016/j.clinph.2021.06.001.
Schumann A, Bar K. Autonomic Aging: A dataset to quantify changes of cardiovascular autonomic function during healthy aging (version 1.0.0). 2021. https://doi.org/10.13026/2hsyt491.
Shoeb A. Application of machine learning to epileptic seizure onset detection and treatment. Diss Massachusetts Institute of Technology. 2009.
Terzano MG, Parrino L, Sherieri A, Chervin R, Chokroverty S, Guilleminault C, et al. Atlas, rules, and recording techniques for the scoring of cyclic alternating pattern (CAP) in human sleep. Sleep Med. 2001;2(6):537–53. https://doi.org/10.1016/s13899457(01)001496.
van Vugt MK, Sederberg PB, Kahana MJ. Comparison of spectral analysis methods for characterizing brain oscillations. J Neurosci Methods. 2007;162(12):49–63. https://doi.org/10.1016/j.jneumeth.2006.12.004.
Walker JS. A primer on wavelets and their scientific applications. 2nd ed. Boca Raton: Chapman & Hall/CRC; 2008.
Widmann A, Schröger E, Maess B. Digital filter design for electrophysiological data – a practical approach. J Neurosci Methods. 2015;250:34–46. https://doi.org/10.1016/j.jneumeth.2014.08.002.
Acknowledgements
WB would especially like to thank University of San Francisco President Paul Fitzgerald, S.J., for his efforts to secure support from the Koret Foundation that enabled research for this paper.
Funding
WB was supported by a grant from the Koret Foundation through USF. TL was supported in part by the Epilepsy Research Fund. SV was supported by the German Research Foundation (DFG) under the grant VI 1088/1–1.
Author information
Authors and Affiliations
Contributions
WB conceived of the ideas presented in this paper, derived the equations, and generated Figs. SV and TL contributed ideas and discussion to the manuscript and edited the presentation of ideas. All authors read and approved the final manuscript.
Corresponding author
Ethics declarations
Ethics approval and consent to participate
Data shown in this paper was obtained from the PhysioNet database (https://physionet.org/about/database/) and approved for public release.
Consent for publication
All approve the final manuscript for publication in Bioelectronic Medicine.
Competing interests
The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.
Additional information
Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Bosl, W.J., Loddenkemper, T. & Vieluf, S. Coarsegraining and the Haar wavelet transform for multiscale analysis. Bioelectron Med 8, 3 (2022). https://doi.org/10.1186/s4223402200085z
Received:
Accepted:
Published:
DOI: https://doi.org/10.1186/s4223402200085z
Keywords
 Haar
 Wavelet
 Multiscale
 Coarsegraining
 Multiscale entropy
 Fourier transform