Académique Documents
Professionnel Documents
Culture Documents
Introduction
The concept of empirical mode decomposition
(EMD) and the Hilbert spectrum (HS) has been de-
veloped rapidly in many disciplines of science and
engineering since Huang et al. (1998) invented EMD.
The key feature of EMD is to decompose a signal
into so-called intrinsic mode function (IMF). Further- Figure 2: A sinusoidal function
more, the Hilbert spectral analysis of intrinsic mode
functions provides frequency information evolving Thus the first step to define intrinsic oscillation
with time and quantifies the amount of variation due is to detect local extrema or zero-crossings. The
to oscillation at different time scales and time loca- function extrema() identifies local extrema and zero-
tions. In this article, we introduce an R package crossings of the signal in Figure 2.
called EMD (Kim and Oh, 2008) that performs one-
> ### Identify extrema and zero-crossings
and two- dimensional EMD and HS.
> ndata <- 3000
> tt <- seq(0, 9, length=ndata)
> xt <- sin(pi * tt)
Intrinsic mode function >
> library(EMD)
The essential step extracting an IMF is to iden- > extrema(xt)
tify an oscillation embedded in a signal from local $minindex
time scale. Consider the following synthetic signal [,1] [,2]
x (t), 0 < t < 9 of the form [1,] 501 501
[2,] 1167 1167
x (t) = 0.5t + sin(t) + sin(2t) + sin(6t). (1) [3,] 1834 1834
[4,] 2500 2500
The signal in Figure 1 consists of several com-
ponents, which are generated through the process $maxindex
that a component is superimposed to each other. [,1] [,2]
[1,] 168 168
[2,] 834 834
[3,] 1500 1501
[4,] 2167 2167
[5,] 2833 2833
$nextreme
[1] 9
$cross
[,1] [,2]
Figure 1: A sinusoidal function having 4 components [1,] 1 1
[2,] 334 335
An intrinsic oscillation or frequency of a compo- [3,] 667 668
nent, for example, sin(t), t (0, 9) in Figure 1 can [4,] 1000 1001
be perceived through the red solid wave or the blue [5,] 1333 1334
dotted wave in Figure 2. The blue dotted wave in [6,] 1667 1668
Figure 2 illustrates one cycle of intrinsic oscillation [7,] 2000 2001
which starts at a local maximum and terminates at [8,] 2333 2334
a consecutive local maximum by passing through [9,] 2666 2667
two zeros and a local minimum which eventually
$ncross
appears between two consecutive maxima. A com-
[1] 9
ponent for a given time scale can be regarded as the
composition of repeated intrinsic oscillation which is The function extrema() returns a list of follow-
symmetric to its local mean, zero. ings.
minindex : matrix of time index at which local identifying the local extrema with the extrema().
minima are attained. Each row specifies a start- Note that when setting the option check=TRUE, one
ing and ending time index of a local minimum. must click the plot to proceed to the next step.
> ### Generating a signal
maxindex : matrix of time index at which local
> ndata <- 3000
maxima are attained. Each row specifies a start-
> par(mfrow=c(1,1), mar=c(1,1,1,1))
ing and ending time index of a local maximum. > tt2 <- seq(0, 9, length=ndata)
> xt2 <- sin(pi * tt2) + sin(2* pi * tt2) +
nextreme : the number of extrema.
+ sin(6 * pi * tt2) + 0.5 * tt2
cross : matrix of time index of zero-crossings. > plot(tt2, xt2, xlab="", ylab="", type="l",
Each row specifies a starting and ending time + axes=FALSE); box()
>
index of zero-crossings.
> ### Extracting the first IMF by sifting process
ncross : the number of zero-crossings. > tryimf <- extractimf(xt2, tt2, check=TRUE)
The function extractimf() extracts IMFs from a
Once local extrema is obtained, the intrinsic mode given signal, and it is controlled by the following ar-
function is derived through the sifting procedure. guments.
residue : observation or signal observed at
Sifting process time tt.
tt : observation index or time index.
Huang et al. (1998) suggested a data-adapted algo-
rithm extracting a sinusoidal wave or equivalently a tol : tolerance for stopping rule.
frequency from a given signal x. First, identify the lo-
max.sift : the maximum number of sifting.
cal extrema in Figure 3(a), and generate the two func-
tions called the upper envelope and lower envelope stoprule : stopping rule.
by interpolating local maxima and local minima, re-
spectively. See Figure 3(b). Second, take their aver- boundary : specifies boundary condition.
age, which will produce a lower frequency compo- check : specifies whether the sifting process is
nent than the original signal as in Figure 3(c). Third, displayed. If check=TRUE, click the plotting area
by subtracting the envelope mean from the signal x, to start the next step.
the highly oscillated pattern h is separated as in Fig-
ure 3(d).
Huang et al. (1998) defined an oscillating wave Stopping rule
as an intrinsic mode function if it satisfies two con-
ditions 1) the number of extrema and the num- The sifting process stops when the replication of
ber of zero-crossings differs only by one and 2) sifting procedure exceed the predefined maximum
the local average is zero. If the conditions of number by max.sift or satisfies the properties of
IMF are not satisfied after one iteration of afore- IMF by stopping rule. The stopping rule stoprule
mentioned procedure, the same procedure is ap- has two options "type1" and "type2". The option
plied to the residue signal as in Figure 3(d), stoprule = "type1" makes the sifting process stop
(e) and (f) until properties of IMF are satisfied. when the absolute values of the candidate IMF hi are
(a)
(b)
smaller than tolerance level, that is, |hi (t)| < tol for
all t. Or by the option stoprule = "type2", the sift-
h i ( t ) h i 1 ( t ) 2
< tol.
t h i 1 ( t )
(e)
(f)
Boundary adjustment
To eliminate the boundary effect of a signal, it is nec-
Signal = 1st IMF + 1st residue 1st residue = 2nd IMF + 2nd residue
Signal
information. A remedy to smooth out the noise is
2
1
to apply smoothing technique not interpolation dur-
0
ing the sifting process. Then the first IMF might
2 1
capture the entire noise effectively. As an alterna- 0.00 0.02 0.04 0.06 0.08 0.10
tt
tive, Kim and Oh (Kim and Oh, 2006) proposed an IMF 1
1.0
efficient smoothing method for IMFs by combining
0.0
the conventional cross-validation and thresholding
1.0
approach. By thresholding, noisy signal can be de- 0.00 0.02 0.04 0.06 0.08 0.10
1.0
can be kept.
0.0
1.0
0.00 0.02 0.04 0.06 0.08 0.10
Intermittence Figure 6: Signal x (t) by model (2) and first two IMFs
Huang et al. (1998, 2003) pointed out that intermit- By following the approach of Huang et al. (1998,
tence raises mode mixing, which means that different 2003), we can remove waves whose empirical period
modes of oscillations coexist in a single IMF. Since represented by the distance of other zero-crossings
EMD traces the highest frequency embedded in a is larger than 0.0007 in the first IMF. The period in-
given signal locally, when intermittence occurs, the formation obtained by histogram in Figure 7 can be
shape of resulting IMF is abruptly changed and this used to choose an appropriate distance. We eliminate
effect distorts procedures thereafter. the waves with lower frequency in the first IMF with
Huang et al. (2003) attacked this phenomenon by the histogram of other zero-crossings.
restricting the size of frequency. To be specific, the
> ### Histogram of empirical period
distance limit of the successive maxima (minima) in
> par(mfrow=c(1,1), mar=c(2,4,1,1))
an IMF is introduced. Thus, IMF composes of only si-
> tmpinterm <- extrema(interm1$imf[,1])
nusoidal waves whose length of successive maxima > zerocross <-
(minima) are shorter than their limit. Equivalently, + as.numeric(round(apply(tmpinterm$cross, 1, mean)))
we may employ the length of the zero-crossings to > hist(diff(tt[zerocross[seq(1, length(zerocross),
overcome the intermittence problem. Consider a sig- + by=2)]]), freq=FALSE, xlab="", main="")
nal x (t) combined by two sine curves (Deering and
Kaiser, 2005),
4000
x (t)
3000
Density
(
1 2
sin(2 f 1 t) + sin(2 f 2 t), t 30 ,
2000
= 30 (2)
sin(2 f 1 t), otherwise.
1000
0
0.25
1.4
1.0 0.0
0.20
1.2
1.0
0.15
0.00 0.02 0.04 0.06 0.08 0.10 0.8
0.10
IMF 2 after treating intermittence 0.6
1.0
0.05
1.0 0.0
8000 10000
1.0
0.00 0.02 0.04 0.06 0.08 0.10
0.8
6000
Figure 8: Decomposition of signal x (t) by model (2) 0.6
4000
after treating the intermittence. 0.4
2000
0.2
0
500 1000 1500 2000
Hilbert spectrum Figure 9: The Hilbert spectrum for IMF 1 of the signal
of model (2)
When a signal is subject to non-stationarity so that For multiple signals, the function hilbertspec()
the frequency and amplitude change over time, it is calculates the amplitudes and instantaneous fre-
necessary to have a more flexible and extended no- quency using Hilbert transform. The function has the
tion of frequency. Huang et al. (1998) used the con- following arguments,
cept of instantaneous frequency through the Hilbert
xt : matrix of multiple signals. Each column
transform. For a comprehensive explanation of the
represents a signal.
Hilbert transform, refer to Cohen (1995). For a real
signal x (t), the analytic signal z(t) is defined as tt : observation index or time index.
z(t) = x (t) + i y(t) where y(t) is the Hilbert trans-
R x (s) The function hilbertspec() returns a matrix of am-
form of x (t), that is, y(t) = 1 P ts ds where
plitudes and instantaneous frequencies for multiple
P is the Cauchy principal value. The polar coor-
signals. The function spectrogram() produces an
dinate form of the analytic signal z with amplitude
image of amplitude by time index and instantaneous
and phase is z(t) =p a(t) exp(i (t)) where amplitude frequency. The horizontal axis represents time, the
a(t) is||z(t)|| = x (t)2 + y(t)2 and phase (t) is vertical axis is instantaneous frequency, and the color
y(t)
arctan x (t)
. The instantaneous frequency as time- of each point in the image represents amplitude of a
d (t) particular frequency at a particular time. It has argu-
varying phase is defined as dt . After decompos-
ments as
ing a signal into IMFs with EMD thereby preserving
any local property in the time domain, we can ex- amplitude : vector or matrix of amplitudes for
tract localized information in the frequency domain multiple signals.
with the Hilbert transform and identify hidden lo-
cal structures embedded in the original signal. The freq : vector or matrix of instantaneous fre-
local information can be described by the Hilbert quencies for multiple signals.
spectrum which is amplitude and instantaneous fre-
tt : observation index or time index.
quency representation with respect to time. Figure 9
describes the Hilbert spectrum for IMF 1 of the sig- multi : specifies whether spectrograms of mul-
nal of model (2) before and after treating the inter- tiple signals are separated or not.
mittence. The X-Y axis represents time and instanta-
neous frequency, and the color intensity of the image nlevel : the number of color levels used in leg-
depicts instantaneous amplitude. end strip
size : vector of image size.
The following R code performs two dimensional R. Deering and J. F. Kaiser. The Use of a Mask-
EMD of the Lena image. The size of the original im- ing Signal to Improve Empirical Mode Decomposi-
age is reduced for computational simplicity. tion. Proceedings of IEEE International Conference on
Acoustics, Speech, and Signal Processing, 4:485488,
> data(lena) 2005.
> z <- lena[seq(1, 512, by=4), seq(1, 512, by=4)]
> lenadecom <- emd2d(z, max.imf = 4) N. E. Huang, Z. Shen, S. R. Long, M. C. Wu, H. H.
Shih, Q. Zheng, N.-C. Yen, C. C. Tung, and H.
The R function imageEMD() plots decomposition H. Liu. The Empirical Mode Decomposition and
results and the argument extrma=TRUE illustrates the Hilbert Spectrum for Nonlinear and Nonstation-
local maxima (minima) with the white (black) color ary Time Series Analysis. Proceedings of the Royal
and grey background. See Figure 10. Society London A., 454:903995, 1998.
the Empirical Mode Decomposition and Hilbert K. Zeng and M-X. He. A Simple Boundary Pro-
Spectral Analysis. Proceedings of the Royal Society cess Technique for Empirical Mode Decomposi-
London A., 31:417457, 2003. tion. Proceedings of IEEE International Geoscience and
Remote Sensing Symposium, 6:42584261, 2004.
D. Kim and H-S. Oh. Hierarchical Smoothing Tech-
nique by Empirical Mode Decomposition. The Ko-
rean Journal of Applied Statistics, 19:319330, 2006.
D. Kim and H-S. Oh. EMD: Empirical Mode Donghoh Kim
Decomposition and Hilbert Spectral Analysis, Sejong University, Korea
2008. URL http://cran.r-project.org/web/ E-mail: donghoh.kim@gmail.com
packages/EMD/index.html. Hee-Seok Oh
Seoul National University, Korea
D. Nychka. fields: Tools for Spatial Data,
E-mail: heeseok@stats.snu.ac.kr
2007. URL http://cran.r-project.org/web/
packages/fields/index.html.