automatic identification of activity–rest periods based on actigraphy
TRANSCRIPT
ORIGINAL ARTICLE
Automatic identification of activity–rest periods basedon actigraphy
Cristina Crespo • Mateo Aboy •
Jose Ramon Fernandez • Artemio Mojon
Received: 15 September 2011 / Accepted: 12 February 2012 / Published online: 1 March 2012
� International Federation for Medical and Biological Engineering 2012
Abstract We describe a novel algorithm for identifica-
tion of activity/rest periods based on actigraphy signals
designed to be used for a proper estimation of ambulatory
blood pressure monitoring parameters. Automatic and
accurate determination of activity/rest periods is critical in
cardiovascular risk assessment applications including the
evaluation of dipper versus non-dipper status. The algo-
rithm is based on adaptive rank-order filters, rank-order
decision logic, and morphological processing. The algo-
rithm was validated on a database of 104 subjects including
actigraphy signals for both the dominant and non-dominant
hands (i.e., 208 actigraphy recordings). The algorithm
achieved a mean performance above 94.0%, with an
average number of 0.02 invalid transitions per 48 h.
Keywords Arterial blood pressure � Actigraphy �Actigraphy algorithms � Cardiovascular risk � Activity/rest
identification
1 Introduction
Ambulatory blood pressure monitoring (ABPM) has been
widely used over casual office blood pressure (BP) read-
ings to improve the diagnosis and treatment of hyperten-
sion and to assess cardiovascular risk [8, 15]. ABPM is a
fully automated technique in which BP measurements are
taken at regular intervals (usually every 15–30 min) over a
24- or 48-h period, providing a continuous BP record
during the patient’s normal daily activities. The use of
ABPM has allowed the observation of a circadian BP
pattern. Typically, there is a decrease in systolic and dia-
stolic BP levels during periods of sleep. Subjects who
exhibit a nocturnal BP drop of at least 10% are classified as
dippers, the ones who do not show this drop are called non-
dippers. Recent studies have shown that non-dipper BP
patterns are associated with an increased frequency of
cardiovascular events, as well as target-organ damage, and
cardiovascular morbidity and mortality [5–7, 9, 10, 19].
The correct assessment of dipper versus non-dipper
requires the ability to accurately identify activity and rest
cycles. Traditionally, determination of activity and rest
cycles has been performed by assuming or imposing a fixed
schedule (for instance, the activity cycle spanning from
7:00 to 23:00 hours, and the rest cycle from 23:00 to
7:00 hours) [3]. This method can prove highly inaccurate
due to individual differences in sleep habits. Another
method involves the use of a diary where the subjects under
study keep a record of their going to sleep and wake up
times. In practice, diaries have proven to be cumbersome
and subjective. Several studies have explored the possi-
bility of using actigraphy to perform identification of sleep/
wake cycles, which provides an objective and non-obtru-
sive method to discriminate between sleep and wake
periods based on recorded activity levels [1, 20, 23]. The
typical actigraphs are wrist-worn devices that use acceler-
ometers to measure and record movement counts at uni-
form time intervals with low sampling frequencies (e.g., 1
sample per minute). The actigraphy signal can be used to
discriminate between sleep and wake cycles, but an auto-
matic algorithm is needed to perform the identification of
activity and rest cycles objectively and accurately.
C. Crespo (&) � M. Aboy
EERE Department, Oregon Institute of Technology,
Portland, OR 97006, USA
e-mail: [email protected]
J. R. Fernandez � A. Mojon
Bioengineering and Chronobiology Laboratories,
University of Vigo, Vigo, Spain
123
Med Biol Eng Comput (2012) 50:329–340
DOI 10.1007/s11517-012-0875-y
Actigraphs are less expensive than inertial measurement
units (IMUs) used in motion tracking applications [17, 18,
26], typically have longer battery life, and are designed to
be wearable during normal activities. In the last 20 years,
several algorithms have been proposed to automatically
identify sleep and wake periods from actigraphy [4, 25,
27]. More recent algorithms use additional signals such as
the electrocardiogram and respiration to achieve better
performance [14]. Most of these algorithms have been
designed as an alternative to polysomnography for the
study of sleep/wake patterns in patients with sleep disor-
ders and other conditions affecting quantity and quality of
sleep [2, 12, 13, 16, 21, 22, 24, 28]. As a consequence, they
exhibit a high sensitivity to sleep disturbances, and tend to
generate multiple wake identifications during main rest
periods. This makes them unsuitable for the identification
of activity and rest cycles in the context of ABPM and
cardiovascular risk assessment, where the objective is not
to detect wake events during periods of sleep, but rather to
determine the boundaries between the main activity and
rest periods. For this reason, short transitions between
states during a main activity or rest cycle are considered
invalid in this application.
In this paper, we describe and assess the performance of
a novel algorithm for automatic identification of activity/
rest periods from actigraphy signals intended for use in
cardiovascular risk applications involving ABPM.
2 Methods
2.1 Algorithm description
The design of an algorithm for the identification of activity/
rest cycles presents several challenges. One of these chal-
lenges is the identification and processing of invalid zeroes.
When working with actigraphy signals, it is common to
find sequences of consecutive zeroes (i.e., points where the
actigraphy signal has a value of zero). During rest periods,
it is more likely to find valid sequences of consecutive
zeroes, whereas during the day this likelihood is small, and
typically when such sequences appear during activity
periods, they correspond to instances where the actigraph
has been removed (to take a shower, for instance). The
algorithm needs to be capable of automatically identifying
the sequences of consecutive zeroes that correspond to
invalid data (i.e., actigraph removal), so that they can be
processed in a way that they do not affect the output of the
algorithm. An empirical probability model was used for
this purpose. The details regarding the methods as well as
the study performed to generate this model are included in
Sect. 2.2. Since the probability of finding valid consecutive
zeroes is different for activity and rest periods, a first stage
in the algorithm using a combined activity/rest probability
model must be able to generate an initial estimate of
activity and rest periods so that the two different proba-
bility models can be later applied to estimated activity and
rest periods separately for a more accurate identification.
Figure 1 shows a block diagram of the proposed algo-
rithm. The algorithm is comprised of two stages: (1) a pre-
processing stage, and (2) a processing and decision stage.
The aim of the first stage is to produce an initial estimate of
the activity and rest periods from the actigraphy signal. The
second stage processes the actigraphy signal using infor-
mation from this initial estimate to produce a binary signal
with the final identification of the activity and rest periods,
where rest periods are represented as a 0 and activity
periods as a 1. During the first stage, the algorithm pro-
cesses regions of consecutive zeroes corresponding to
invalid data using a combined activity/rest probability
model. A rank-order filter is then applied to the signal, and
based on an adaptive threshold, a binary signal is gener-
ated, where rest periods are represented with a 0, and wake
periods with a 1. A morphological filter is finally applied to
the binary signal to eliminate invalid transitions. The sec-
ond stage takes the original actigraphy signal, and using the
initial estimate of activity/rest regions from the pre-pro-
cessing stage, applies separate probability models to esti-
mated activity and rest periods in order to eliminate regions
of invalid zeroes. This signal validation and conditioning
process is followed by an adaptive rank-order filtering and
thresholding operation, which produces a binary signal
corresponding to a more refined estimate of activity/rest
periods. Finally, a morphological filter is applied to the
binary signal to eliminate invalid transitions and obtain the
final activity/rest identification signal. Table 1 provides a
summary of the user-specified input parameters for the
algorithm, as well as their default values. These parameters
are explained in the following section.
Fig. 1 Algorithm block diagram. The algorithm takes an actigraphy
signal s(n) as an input and produces a binary signal o(n) as an output,
where rest periods are represented as binary 0, and wake periods as
binary 1. The algorithm consists of two stages. The purpose of the
preprocessing stage is to produce an initial estimate of the activity/rest
periods from the original actigraphy signal. The processing and
decision stage processes the original actigraphy signal using infor-
mation derived from the initial estimate of activity/rest periods
generated in the preprocessing stage, to produce the final identifica-
tion of activity/rest periods
330 Med Biol Eng Comput (2012) 50:329–340
123
In the following description, we will let s(n) denote the
raw actigraphy signal in discrete time and s ¼ðs1; s2; . . .; sNÞ denote the corresponding vector of length
N, where N represents the number of elements in s(n).
2.1.1 Stage 1: preprocessing
The purpose of this stage is to produce an initial estimate of
the activity and rest periods from the actigraphy signal.
2.1.1.1 Signal conditioning based on empirical probability
model A function Ff�g is applied to s(n) in order to
determine the regions containing more than f consecutive
zeroes,
a ¼ FfsðnÞ; fg ð1Þ
where f is determined from an empirical probabilistic
model and represents the maximum number of consecutive
zeroes considered valid, and a ¼ ða1; a2; . . .; aAÞ denotes
the indices of s(n) containing the invalid zeroes (i.e.,
sequences of more than f consecutive zeroes).
The values of sðnÞ ¼ ðs1; s2; . . .; sNÞ at index locations
a ¼ ða1; a2; . . .; aAÞ are replaced by a value st corre-
sponding to a user-specified percentile t of s(n) which must
be chosen to minimize the impact of invalid zeroes. Per-
centile values above 33% bias the results towards wake
classifications and percentiles below 33% towards rest
classifications assuming a standard 8 h of sleep for every
24 h. The result of this operation is a signal x(n) such that
xðjÞ ¼ st if j 2 asðjÞ if j 62 a
�ð2Þ
Prior to filtering, x(n) is padded at the beginning and at
the end with a sequence of 30� a elements of value m =
max{s(n)}. This is done in order to use a filter window of
user-specified length Lw ¼ ð60� aþ 1Þ centered about
each element of x(n), where a represents the length of the
window in hours (8 by default). Since the subject must be
awake at the moment when the actigraphy recording is
started and stopped the value m used for padding is chosen
as the maximum value in the actigraphy signal so that it
will bias the beginning and the end of the filtered signal
towards an awake state,
xp ¼ ðm; m; . . .; m|fflfflfflfflfflfflfflfflffl{zfflfflfflfflfflfflfflfflffl}30�a
; x1; x2; . . .; xN ; m; m; . . .; m|fflfflfflfflfflfflfflfflffl{zfflfflfflfflfflfflfflfflffl}30�a
Þ ð3Þ
2.1.1.2 Rank-order processing and decision logic The
padded signal xp is filtered according to the following
nonlinear equation to generate the filtered actigraphy time
series xf(n):
xf ðnÞ ¼ Mfxpðn� 30� aÞ; xpðn� 30� aþ 1Þ; . . .;
xpðn� 1Þ; xpðnÞ; xpðnþ 1Þ; . . .; xpðnþ 30� aÞgð4Þ
where Mf�g denotes the median operator. Larger values of
a result in a lower number of invalid transitions between
the rest and awake states at the expense of larger inaccu-
racies in the determination of the exact transition time.
Large a values resulting in window lengths up to 12 h are
possible due to constraints imposed by the following
thresholding step, which takes into account the user-spec-
ified expected number of rest hours per night (8 h by
default).
A rank-order thresholding operation Tf�g is performed
on the filtered actigraphy signal to obtain the binary signal
y1(n), where y1(n) = 1 for y1(n) [ p and 0 otherwise. The
threshold p is the percentile of xf(n) corresponding to
ðhs=24Þ � 100%; where hs is a user-specified parameter
corresponding to the average number of hours of sleep per
night (8 by default)
y1ðnÞ ¼ T xf ðnÞ� �
ð5Þ
2.1.1.3 Morphological filtering The binary signal y1(n) is
further processed using a closing–opening morphological
filter of user-specified window length Lp in minutes. The
purpose of the morphological filtering is to eliminate
invalid transitions such as short periods of rest during
activity regions and vice versa. The result of this operation
is the binary signal ye(n)
yeðnÞ ¼ ðy1 � LpÞ � Lp ð6Þ
where y1 � Lp represents the morphological closing
operation • on the set y1 by the structuring element
Lp, that is, y1 � Lp = ðy1 � LpÞ � Lp and y1 � Lp represents
the morphological opening operation � on the set y1 by the
structuring element Lp, that is, y1 � Lp ¼ ðy1 � LpÞ � Lp:
The symbols � and � represent the morphological erosion
and dilation operations, respectively:
A� B ¼ fgjðBÞg A ð7Þ
A� B ¼ fgjfðBÞg \ Ag 6¼ ;g ð8Þ
ðBÞ represents the reflection of set B, and (B)g represents
the translation of set B by g elements, which are defined as:
Table 1 Summary of user-specified input parameters for the activity/
rest identification algorithm
Name Symbol Default
Threshold consec. zeroes f 15
Threshold consec. zeroes (wake) fa 2
Threshold consec. zeroes (rest) fr 30
Percentile for invalid zeroes t 33
Median filter window length Lw 60.8 ? 1
Average hours of sleep per night hs 8
Morph. filter window length Lp 60 ? 1
Med Biol Eng Comput (2012) 50:329–340 331
123
B ¼ fwjw ¼ �b; for b 2 Bg ð9ÞðBÞg ¼ fcjc ¼ bþ g; for b 2 Bg ð10Þ
In the case of a one-dimensional signal the operations of
erosion and dilation become the minimum and the
maximum operators, respectively. The output of this first
stage is a binary signal ye(n) containing an initial estimate
of the rest (0) and wake (1) periods.
2.1.2 Stage 2: processing and decision logic
This stage uses information from the previous stage to
produce the final identification of the activity and rest
periods for the input actigraphy signal.
2.1.2.1 Model-based data validation Given the estimated
activity and rest periods for the input actigraphy signal, we
can apply a function Gf�g to the original actigraphy signal
s(n) in order to find sequences of more than fr consecutive
zeroes during estimated rest periods, and sequences of
more than fa consecutive zeroes during estimated wake
periods,
b ¼ GfsðnÞ; fa; frg ð11Þ
where fa and fr are determined from empirical probabi-
listic models and represent the maximum number of
consecutive zeroes considered to be valid during esti-
mated activity and rest periods, respectively, and
b ¼ ðb1; b2; . . .; bBÞ represents the indices of s(n) corre-
sponding to invalid zeroes.
2.1.2.2 Adaptive rank-order processing and decision
logic Prior to filtering, s(n) is padded at the beginning and
at the end with a sequence of length 60 (i.e., 1 h) of values
m = max{s(n)}.This is done in order to bias the beginning
and the end of the filtered signal towards a wake identifi-
cation and avoid multiple invalid transitions close to the
edges.
xsp ¼ ðm; m; . . .; m|fflfflfflfflfflfflfflfflffl{zfflfflfflfflfflfflfflfflffl}60
; s1; s2; . . .; sN ; m; m; . . .; m|fflfflfflfflfflfflfflfflffl{zfflfflfflfflfflfflfflfflffl}60
Þ ð12Þ
An adaptive median filter Maf�g with a varying window
length is next applied to the padded time series. The
adaptive median filter outputs the median of the values of
s(n) within a moving window whose indices are not
contained in b. The maximum filter window length is the
user-specified parameter Lw. This window is adaptive since
invalid zeroes are not included in the median calculation
and the length of the window starts as 1 h at the edges and
progressively increases to a maximum window length Lw.
This is done in order to be able to maintain a symmetric
window around the current sample at the points where the
distance from the current sample to the end of the padded
signal is less than half of the maximum window length.
The result of this operation is the filtered signal
xfaðnÞ ¼ MafxspðnÞ; bg ð13Þ
The binary output y2(n) is obtained by a rank-order
thresholding operation Tf�g; where y2(n) = 1 (wake) for
y2(n) [ p and 0 (rest) otherwise.The threshold p is the
percentile of xfa(n) corresponding to ðhs=24Þ � 100%;
where hs is a user-specified parameter representing the
average hours of sleep per night (8 by default).
y2ðnÞ ¼ T xfaðnÞ� �
ð14Þ
2.1.2.3 Morphological filtering The binary output y2(n)
is further processed using a closing–opening morphological
filter in order to eliminate invalid transitions such as short
periods of rest in regions of activity and vice versa. This is
the same morphological filtering operation that was applied
at the end of the preprocessing stage, but the window
length is double in size to the one used then (i.e.,
L0p ¼ 2� ðLp � 1Þ þ 1).
oðnÞ ¼ ðy2 � L0pÞ�L0p ¼ fo1; o2; . . .; oNg ð15Þ
The first and last values of the output binary signal are
assigned a binary value of 1 (awake). This heuristic rule is
derived from the constraint that the subject must be in an
awake state when the actigraph is connected or
disconnected.
o1 ¼ oN ¼ 1 ð16Þ
The result of this step is the final discrete binary output
signal of length equal to the original actigraphy signal. A
binary 0 represents a rest state, and a binary 1 represents an
awake state.
2.2 Probability models
When working with actigraphy signals, it is common to
find regions of consecutive zeroes. Some of these corre-
spond to periods of very low activity (mostly during sleep),
and some are the result of momentarily disconnecting the
actigraph (to take a shower, for instance). When using
actigraphy signals to determine activity/rest cycles, it is
necessary to differentiate the regions of consecutive zeroes
representing invalid data (i.e., disconnections) from the
regions of valid consecutive zeroes (i.e., low activity), in
order to avoid misclassifications. A probability model was
developed to determine the threshold between the number
of consecutive zeroes to be considered valid or invalid. The
methodology is described in this section.
332 Med Biol Eng Comput (2012) 50:329–340
123
2.2.1 Probability model definition
Let us assume a situation where we have a perfect data-
base, containing actigraphy signals with true and accurate
information regarding what zeroes correspond to low
activity and are valid data, and what zeroes are invalid. Let
z denote the number of consecutive zeroes. Let Pj(z) denote
the probability of finding z consecutive zeroes that are
valid in a subject j from a sample under study, that is,
j ¼ 1; 2; . . .; J; where J represents the number of subjects in
the sample under study. For each subject j in the sample
under study we can estimate the maximum number of valid
consecutive zeroes fj such that Pjðz fjÞ\0:05; that is,
f jjfP jðz f jÞ\0:05g ð17Þ
where f j represents the maximum number of consecutive
zeroes that are valid for subject j. This estimation can be
done using Monte Carlo methods for each subject j,
f jjfP jðz f jÞ\0:05g� �J
j¼1¼ ðf1; f2; . . .; fJÞ ð18Þ
that is, for subject j = 1, we find that f1 is the maximum
number consecutive zeroes that satisfies P1ðz f1Þ\0:05
and so on for all the subjects in the sample j ¼ 1; 2; . . .; J:
In the simplest probability model for random data (i.e.,
the one-sample model) a single unknown probability dis-
tribution Z produces the data vector f ¼ ðf1; f2; . . .; fJÞ by
random sampling. The notation Z ! f indicates the vector
f contains an independent and identically distributed
sample drawn from Z,
Z ! f ¼ ðf1; f2; . . .; fJÞ ð19Þ
We use the sample f to calculate the statistic of interest
h ¼ sðfÞ: To assess the statistical behavior of the statistic
h we use bootstrap. In this case, the statistic of interest
h ¼ sðfÞ is specific percentile pf (i.e., the 90th percentile).
Once this statistic of interest h ¼ sðfÞ is estimated we can
obtain the 90% confidence interval for h directly using the
percentiles of h�: In order to make use of bootstrap we
must have a probability model for the data. In the case
of the one-sample model Z gives the observed data
f ¼ ðf1; f2; . . .; fJÞ by random sampling, Z ! f: To
perform bootstrap we substitute the unknown probability
distribution Z for the empirical distribution Z� obtained
from the data.
From the empirical distribution Z� we obtain bootstrap
samples by random sampling,
Z� ! f� ¼ ðf�1; f�2; . . .; f�JÞ ð20Þ
These samples enable us to calculate bootstrap
replications of the statistic of interest h� ¼ sðf�Þ; from
which we can perform probabilistic calculations directly
using the bootstrap percentiles, that is, we can use the
histogram of h�kðbÞ; b ¼ 1; 2; . . .; B as an estimate of the
probability density function and bootstrap confidence
intervals for the population are obtained as
hklo¼ 100� athpercentile of h�k’s distribution
hkup¼ 100� ð1� aÞthpercentile of h�k’s distribution
In the context of our problem, we have a three sample
probability model, that is, F = (Z, Za, Zr) where Zr denotes
the probability distribution of the maximum number of
valid consecutive zeroes during rest periods, Za denotes the
probability distribution of the maximum number of valid
consecutive zeroes during activity periods, and Z denotes
the combined activity/rest probability distribution.
Z ! f ¼ ðf1; f2; . . .; fJÞ ð21Þ
Za ! fa ¼ ðfa1; fa2; . . .; faJÞ ð22Þ
Zr ! fr ¼ ðfr1; fr2; . . .; frJÞ ð23Þ
The procedure described above is used to generate an
empirical distribution F* = (Z*, Z*a, Z*r), calculate the
statistic of interest h ¼ sðfÞ for each distribution, and
assess the statistical behavior of the statistic using
bootstrap replicas.
An independent study was conducted using a database
designed for determining the probability model (different
from the database used for algorithm assessment described
in the section below) containing 50 adult healthy subjects,
whose actigraphy signals were monitored for 48 h. The
study took place in Galicia (Spain), and it was approved by
the state Ethics Committee of Clinical Research. All sub-
jects gave written informed consent. The subjects were
diurnally active and nocturnally resting healthy young
adult volunteers, 29.51 ± 11.89 years of age. For the
duration of the experiment, the subjects were asked to keep
an accurate diary of the times when they went to sleep,
woke up, and disconnected the actigraph. In practice, dia-
ries are typically imprecise and subjective. However, in
this case the study included research volunteers motivated
to keep an accurate diary and the need for accuracy in the
diary was strongly emphasized. Using Monte Carlo meth-
ods, a probability model was generated, representing the
probability density function for finding a certain number of
consecutive zeroes in an actigraphy signal. For every
actigraphy signal of length L = 48.60 (i.e., 48 h), 100�L
experiments were performed. Each experiment consisted of
randomly choosing a sequence of length n from the
actigraphy signal, then recording the ratio of the number of
sequences selected where all the elements were equal to
zero. This was done for values of n such that 1 B n B L.
Figures 2 and 3 show the results of the study to determine
Med Biol Eng Comput (2012) 50:329–340 333
123
the probability of having z consecutive zeroes during
activity and rest periods, respectively. The lighter lines
represent the probability model for each actigraphy signal,
the darker line is an average of these probability models
for all the actigraphy signals in the database. Based on
the bootstrap analysis of these results, the algorithm uses
F ¼ ðf; fa; frÞ ¼ ð15; 2; 30Þ by default.
2.3 Algorithm assessment
2.3.1 Assessment database
The algorithm was validated on a database containing ac-
tigraphy recordings of 48 h for 104 subjects. The study
took place in Galicia (Spain), and it was approved by the
state Ethics Committee of Clinical Research. All subjects
gave written informed consent. The subjects were diurnally
active and nocturnally resting healthy young adult volun-
teers, 22.43 ± 1.66 years of age. All participants wore two
actigraphs (Mini-Motion-Logger, Ambulatory Monitoring
Inc., Ardsley, New York, USA), one on each wrist, to
monitor their physical activity every minute. This compact
(about half the size of a wristwatch) device functions as an
accelerometer. During this experiment, ABPM was also
monitored on the non-dominant arm, with ABPM mea-
surements being taken every 20 min between 7:00 and
23:00 hours, and every 30 min between 23:00 and 7:00
hours. The same computer was always used to synchronize
the internal clocks of the two actigraphs. For every subject,
the assessment database includes two actigraphy signals,
corresponding to simultaneous recordings for the dominant
and non-dominant hands, respectively (i.e., 208 record-
ings). The participants agreed to keep an accurate diary of
the times when they went to sleep and woke up for the
duration of the experiment. This diary was used as the
reference for the assessment and evaluation of the algo-
rithm performance. The average number of sleep hours per
night recorded by the subjects included in the validation
database ranged from 5 to 11 h, with 67 out of the 104
subjects recording an average of 8–9 h of sleep per night.
2.3.2 Performance metrics
The assessment of sleep/wake detection algorithms pre-
sented in the literature has been based on metrics that
quantify the amount and quality of sleep [4, 25, 27]. These
are suitable metrics for the study of sleep disorders and
other conditions affecting sleep, but are not relevant or
adequate metrics in the context of cardiovascular risk
assessment using ABPM. For ABPM applications, the
objective is not to assess quantity and quality of sleep, but
to accurately identify the boundaries between the main
activity and rest periods, so that the value of different
ABPM parameters can be calculated separately for activity
and rest BP signals. These parameters include the awake
and sleep systolic, diastolic, and pulse pressure blood
pressure means, and the systolic, diastolic, and pulse
pressure sleep time relative declines. Additionally, ABPM
research and clinical practice is based on the underlying
idea that it is important to record blood pressure during the
normal activity of the subject. Consequently, the gold
standard needs to be adequate for collection over 48 h
periods under ambulatory conditions (i.e., during normal
daily activity over 2 days). This disqualifies the established
gold standard of polysomnography (PSG) used in sleep
research to assess actigraphy algorithms, since it is not
possible to do acquisition during normal life activities over
48 h.
Fig. 2 Results of the study to determine the probability of having
z consecutive zeroes during sleep periods
Fig. 3 Results of the study to determine the probability of having
z consecutive zeroes during wake periods
334 Med Biol Eng Comput (2012) 50:329–340
123
For these reasons, a more adequate reference signal was
chosen, which could be collected under ambulatory con-
ditions, and a new set of metrics was defined which are
more adequate and relevant for the application at hand. The
definition of these metrics uses actigraphy signals for both
dominant and non-dominant hands, as well as a diary of
sleep and wake up times. In order for these metrics to be
valid, it is important that the diary be accurate, and
therefore the participants in the assessment studies must be
motivated and trained to keep an accurate diary. In the
absence of a true gold standard, accurate diaries of strongly
motivated and trained research volunteers were used as the
reference. Diaries have inherent accuracy limitations, and
for this reason the carefully collected diary has not been
labeled as the ‘‘gold standard’’ but rather the ‘‘reference
signal.’’ In ABPM applications, where activity and rest
have typically been determined by assuming a fixed sche-
dule, the best current practice is to use a diary for deter-
mination of main activity and rest cycles, and therefore the
selection of reference signal was made to match the best
current practice.
Three performance metrics (PM) were defined to evaluate
the performance of automatic activity/rest identification
algorithms based on actigraphy for ABPM applications.
These metrics were labeled PM1 through PM3.
• PM1 represents the percent coincidence between the
algorithm output and the desired output (diary) in 1-min
intervals.
• PM2 represents the percent coincidence between the
algorithm output for the dominant versus the non-
dominant hand actigraphy signals in 1-min intervals.
• PM3 represents the average number of invalid transi-
tions per 48-h period.
PM1 provides a measure of the ability of the algorithm to
correctly identify 1-min segments as belonging to an
activity or rest period in comparison to the subject’s diary.
For the application at hand, it is important to have an
accurate identification of activity and rest periods, and there
is no practical difference between inaccuracies due to false
positives or false negatives. For this reason, both types of
errors were lumped into a single metric PM1, as opposed to
separately measuring specificity and sensitivity. Even
though in this experiment it was emphasized that subjects
kept an accurate diary of their going to sleep and getting up
times, there can be more or less of a delay between the time
that a subject records as going to sleep and the time when
the subject falls asleep, as well as between the time the
subject wakes up and the time later recorded as getting up.
PM2 overcomes this limitation by measuring the coinci-
dence between the algorithm output when applied to the
dominant versus the non-dominant hand signals. The cor-
relation between the two hands is an indicator of the
algorithm’s accuracy, since a difference in output between
the two hands indicates an incorrect identification for one of
the signals (i.e., a subject cannot be in an activity cycle
according to one hand, and in a rest cycle at the same time
according to the other hand). PM2 thus provides a measure
of the reliability of the result of the algorithm regardless of
the value of PM1. Low values of PM2 could indicate that
the ABPM monitor is affecting the level of activity in the
non-dominant arm, since the placement of the actigraph
should have no effect on the performance of activity/rest
assessment with actigraphy [11]. This performance metric
is independent of the diary, and therefore will not be
affected by diary inaccuracies. PM3 is also an important
indicator of algorithm performance, as the purpose of the
algorithm is to identify main activity and rest periods. This
implies we want to avoid short transitions between states,
which are sometimes caused by low activity levels during
an activity period (e.g., taking a nap during the day) or high
activity levels during a rest period (e.g., waking up at night
to drink a cup of water). This last metric provides a measure
of the robustness of the algorithm to such events. Better
algorithm performance corresponds to values for PM1 and
PM2 as close as possible to 100%, and values of PM3 as
close as possible to zero.
3 Results
Figure 4 shows an illustrative example of the algorithm
operation on an actigraphy signal selected from the
assessment database. This figure exemplifies some of the
most common difficulties related to processing of actigra-
phy signals to extract the main activity and rest cycles, and
provides a graphical representation of the different steps
performed by the algorithm to produce the binary activity/
rest output signal from the original actigraphy signal. On
the top graph, a representative actigraphy signal is shown
in a light color. During the first stage of the algorithm (i.e.,
preprocessing stage), the sequences of invalid zeroes are
identified and assigned a value equal to the 33% percentile.
In the graph, the invalid zeroes appear as a series of dots
superimposed on the x-axis. A rank-order filter is then
applied to the modified actigraphy signal. The filtered
signal is shown in a darker color, superimposed on the raw
actigraphy signal. A thresholding operation is performed
on the filtered signal, with the threshold set to the appro-
priate percentile, according to the user-specified average
number of sleep hours per night (8 by default). The
threshold appears as a light-colored horizontal line at
around 165 counts/min. The initial binary output estimate
is generated based on this threshold. Values of the filtered
signal lower than the threshold translate into a binary 0 in
the output signal, the rest translate into a binary 1. This
Med Biol Eng Comput (2012) 50:329–340 335
123
initial binary signal is shown in the bottom graph in a
lighter color. Finally, a closing–opening morphological
filter is applied to the binary signal to eliminate transitions
of short duration, which would represent short periods of
rest in a wake region, or short periods of activity in a rest
region. Since the purpose of the algorithm is to detect the
main activity/rest cycle, these short periods are considered
invalid. The filtered binary signal appears in a darker color
superimposed on the unfiltered binary signal. In this case,
an invalid rest period around the 20:00 hours on the first
day was corrected by the morphological filter. The two
gray boxes on the bottom subplot represent the periods of
rest annotated in the diary. A perfect coincidence between
the algorithm output and the diary would correspond to an
output binary signal which has a value of 0 inside the gray
boxes, and a value of 1 everywhere else. Figure 4 illus-
trates the robustness of the algorithm when dealing with
periods of low activity and disconnections of the actigraph
during a wake cycle, such as the period between the 18:00
and 00:00 hours of the first day, due to the ability of the
morphological filter to eliminate invalid transitions. In this
example, the algorithm performed as follows: PM1 (dom-
inant) was 95.7%, PM1 (non-dominant) was 95.6%, PM2
was 95.7%, and PM3 was 0. This type of signal presents
significant challenges for less complex algorithms such as
the classical algorithms (Cole [4], Sadeh [25], and Oakley
[27]) designed for sleep disorders, or simple single-stage
algorithms that do not take into account the empirical
probability model to differentiate valid from invalid zeroes
for a given actigraph.
Table 2 shows the results of the prospective assessment
study of the proposed algorithm on the entire assessment
database. The table summarizes the results using average
values of statistical measures of central tendency and dis-
persion across all the signals in the database. For all the
results presented, the user-specified input parameters to the
algorithm were set to their default values. The performance
metrics shown are the percent coincidence between the
algorithm output and the diary using the actigraphy signal
from the dominant hand and the non-dominant hand,
respectively, and the percent coincidence between the
algorithm output for the dominant versus the non-dominant
hands. The table shows that the mean value for all three
performance metrics is greater than 94.0%, the median is
greater than or equal to 97.3%, and the standard deviation
is no greater than 3.3%. The range of the results over the
104 subjects in the database is between 80.6 and 99.1%
when comparing the algorithm output to the diary (using
the actigraphy signal from either the dominant or the non-
dominant hand), and between 86.9 and 99.7% when mea-
suring the agreement between the output of the algorithm
applied to the dominant versus the non-dominant hand. The
average number of invalid transitions per 48 h is less than
or equal to 0.02.
Fig. 4 Example of results
illustrating the performance of
the algorithm on a real
actigraphy signal collected with
a wrist actigraph. The
actigraphy signal appears in the
top subplot in a lighter color,
with the filtered signal
superimposed in a darker color.
The invalid zeroes are marked
with dots along the horizontal
axis. The horizontal line
represents the threshold used to
discriminate between rest and
activity in the first stage. The
bottom subplot shows the binary
signal (0 = rest, 1 = activity),
before (lighter color) and after
(darker color) the
morphological filtering
operation. The two gray boxesrepresent the periods of rest
recorded in the diary. The
desired algorithm output would
be zero in the region covered by
the gray boxes, and 1
everywhere else
336 Med Biol Eng Comput (2012) 50:329–340
123
4 Discussion
4.1 Algorithm performance
The illustrative example of Fig. 4 shows that the proposed
algorithm is robust to the type of challenges typically
encountered in ABPM research and clinical practice
involving actigraphy signals for objective activity/rest
identification in the context of cardiovascular risk assess-
ment. These challenges include actigraph disconnections,
activity spikes during main rest periods, periods of low
activity during main awake periods, and gradual transitions
between main activity and rest periods. While Fig. 4
exemplifies the algorithm output for a single representative
signal in the assessment database, the results shown in
Table 2 demonstrate that the algorithm performed similarly
for all other signals in the database, both in terms of
accuracy in the identification of the activity/rest regions as
well as the avoidance of invalid transitions.
Currently available algorithms are susceptible to the
technical difficulties mentioned above, resulting in mis-
identifications and invalid transitions. Figure 5 provides a
comparison between the desired output and the output
obtained using the proposed (Crespo) and classical (Cole,
Sadeh, and Oakley) actigraphy algorithms. This example
comparison is shown for illustrative purposes using a rep-
resentative signal from the assessment database. The first
graph shows an actigraphy signal collected with a wrist
actigraph. The second graph corresponds to the activity/rest
periods recorded in the diary (i.e., the desired algorithm
output). The three plots that follow show the output of some
of the classical sleep/wake identification algorithms
(namely, the algorithms proposed by Cole, Sadeh, and
Oakley). Since these algorithms have been tailored to the
study of sleep disorders, they exhibit a high sensitivity to
sleep disturbances, and tend to generate multiple wake
identifications during main rest periods. While this high
sensitivity is a desirable characteristic in the study of sleep
disorders, it makes these algorithms unsuitable for the
identification of activity and rest cycles in the context of
ABPM and cardiovascular risk assessment, where the
objective is not to detect wake events during periods of
sleep, but rather to determine the boundaries between the
main activity and rest periods. For this reason, short tran-
sitions between states during a main activity or rest cycle
are considered invalid in this application. The last plot
corresponds to the output of the proposed algorithm
(Crespo). This example illustrates the advantage of using
the proposed algorithm over the classical ones. It can be
seen that in this example the Crespo algorithm performs a
better identification of the main activity and rest cycles than
any of the classical ones, avoiding the large number of
invalid transitions detected by the classical algorithms
designed for sleep disorder applications.
4.2 Clinical application
While activity/rest identification algorithms based on
actigraphy have applicability in several biomedical appli-
cations, the proposed algorithm was designed to satisfy the
specific requirements of a particular application, namely
cardiovascular risk assessment using ABPM with actigra-
phy. As explained in the introduction, the proper determi-
nation of dipper versus non-dipper, nocturnal versus
diurnal BP, as well as other assessment parameters requires
the ability to identify the major activity and rest cycles
automatically, accurately, and objectively. Researchers in
the ABPM community have relied on actigraphs to aid in
the determination of activity and rest cycles primarily using
a combination of the classical sleep disorder algorithms
previously mentioned, visual inspection of the actigraphy
signal, and patient diaries. The proposed algorithm will
enable researchers to automate the process (i.e., eliminat-
ing subjective visual inspection and inaccurate diaries),
Table 2 This table shows the results of the assessment study for the proposed actigraphy algorithm
PM1 (dominant) PM1 (non-dominant) PM2 (Dom vs. Nond)
Median (%) 94.8 94.8 97.3
Mean (%) 94.3 94.1 96.6
SD (%) 3.3 3.2 2.4
Max (%) 99.1 99.1 99.7
Min (%) 80.6 81.5 86.9
Average PM3 0.02 0.02 –
The performance metrics shown are the percent coincidence between algorithm and diary using the actigraphy signal from the dominant hand,
and the non-dominant hand, respectively, and the percent coincidence between algorithm output for dominant versus non-dominant hands. For
each performance metric, the mean and median values are greater than 94.0%, the standard deviation is no greater than 3.3%, and the range of
performance (min to max) is better than or equal to 80.6–99.1%. In every case, the average number of invalid transitions per 48 h is less than or
equal to 0.02
Med Biol Eng Comput (2012) 50:329–340 337
123
making it faster and more objective without incurring
additional cost. An important constraint in the algorithm
design was to base it exclusively on the type of actigraphy
signals already available in many ABPM studies and built
into some commercial ABPM monitors with integrated
actigraphy, as opposed to basing it on other physiological
signals which would require different hardware, and in
some cases would be inconsistent with the ambulatory,
normal-life conditions required in ABPM clinical practice.
Additionally, the algorithm was designed to be used with
multiple actigraphs and since it is automatic the end user
does not require any specialized technical knowledge. The
algorithm can run very robustly based on ten default
parameters.
4.3 Study limitations
The objective of this paper was to provide a detailed
mathematical description of a new algorithm of activity–
rest identification based exclusively on actigraphy signals
available in ABPM studies, in order to ensure reproduc-
ibility by the scientific community, as well as to provide
illustrative examples of its performance. While the per-
formance of the algorithm was thoroughly assessed using a
prospective database and reported in this article, a scientific
comparison study with respect to the classical algorithms
was not reported here. In this paper, the comparison with
respect to the classical algorithms is limited to a single
illustrative example presented in Fig. 5, and not a complete
12:00 18:00 00:00 06:00 12:00 18:00 00:00 06:00 12:00 18:000
400Actigraphy Signal (Counts/Min)
12:00 18:00 00:00 06:00 12:00 18:00 00:00 06:00 12:00 18:000
1
Desired Output (Reference)
12:00 18:00 00:00 06:00 12:00 18:00 00:00 06:00 12:00 18:000
1
Cole Algorithm
12:00 18:00 00:00 06:00 12:00 18:00 00:00 06:00 12:00 18:000
1
Sadeh Algorithm
12:00 18:00 00:00 06:00 12:00 18:00 00:00 06:00 12:00 18:000
1
Oakley Algorithm
12:00 18:00 00:00 06:00 12:00 18:00 00:00 06:00 12:00 18:000
1
Crespo Algorithm
Fig. 5 Illustrative example of the performance of the proposed
algorithm as compared to some of the currently available actigraphy
algorithms. The first graph shows an actigraphy signal collected with
a wrist actigraph. The second graph corresponds to the activity/rest
periods recorded in the diary (i.e., the desired algorithm output). The
three plots that follow show the output of some of the classical sleep/
wake identification algorithms (namely, the algorithms proposed by
by Cole, Sadeh, and Oakley). The last plot corresponds to the output
of the Crespo algorithm. The classical algorithms exhibit a high
sensitivity to sleep disturbances, and tend to generate multiple wake
identifications during main rest periods. This makes them unsuitable
for the identification of activity and rest cycles in the context of
ABPM and cardiovascular risk assessment. The Crespo algorithm
performs a better identification of the main activity and rest cycles,
avoiding the large number of invalid transitions detected by the
classical algorithms
338 Med Biol Eng Comput (2012) 50:329–340
123
scientific comparative study. Consequently, a more thor-
ough study is needed in order to perform a full assessment,
validation, and characterization of the algorithm, as well as
a comparison with other available algorithms appropriate
for this clinical application (ABPM with actigraphy). This
could include a prospective validation of the algorithm on a
different database, as well as a characterization of algo-
rithm performance over the possible range of variation of
the different user-specified input parameters. Of particular
interest would be to study the variation in algorithm per-
formance when a priori information regarding the average
number of sleep hours per night is available and provided
as an input to the algorithm, versus the case when such
information is not available and the average number of
sleep hours per night is set to the default value of 8. The
preliminary assessment described here was performed on a
homogeneous database of diurnally active and nocturnally
resting healthy young adults. While the validation popu-
lation were young adults, they presented a wide range of
sleep patterns (fragmented sleep, greater periods of quiet
restfulness, naps, and other sleep disturbances). Neverthe-
less, a more thorough assessment could include a charac-
terization of algorithm performance on different
populations. Finally, since the algorithm is intended for
application in the estimation of ABPM parameters such as
activity and rest BP means, a study is needed to determine
the statistical and clinical impact of using the proposed
algorithm in this context.
5 Conclusion
This paper presents a novel algorithm for identification of
activity/rest periods based on actigraphy signals designed
to be used in cardiovascular risk applications involving
ABPM. The algorithm was validated on a database con-
taining 48 h simultaneous actigraphy recordings for the
dominant and non-dominant hands for 104 subjects (i.e.,
208 recordings). When applied to the validation database
with all the input parameters set to their default values, the
algorithm achieved a mean performance above 94.0% with
an average number of invalid transitions per 48 h lower
than 0.02. This performance characteristics make this
algorithm suitable for numerous applications involving the
assessment of cardiovascular risk which take into account
the circadian variability and cardiovascular chronobiology.
Acknowledgments This independent investigator-promoted
research was funded by unrestricted grants from Ministerio de Ciencia e
Innovacion (SAF2009-7028-FEDER); Consellerıa de Economıa e In-
dustria, Direccion Xeral de Investigacion e Desenvolvemento, Xunta de
Galicia (INCITE07-PXI-322003ES; INCITE08-E1R-322063ES;
INCITE09-E2R-322099ES; IN845B-2010/114; 09CSA018322PR);
and Vicerrectorado de Investigacion, University of Vigo.
References
1. Ancoli-Israel S, Cole R, Alessi C, Chambers M, Moorcroft W,
Pollak CP (2003) The role of actigraphy in the study of sleep and
circadian rhythms. Sleep 26: 342–392
2. Blood ML, Sack RL, Percy DC, Pen JC (1997) A comparison of
sleep detection by wrist actigraphy, behavioral response, and
polysomnography. Sleep 20: 388–395
3. Boggia J, Li Y, Thijs L, Hansen TW, Kikuya M, Bjorklund-
Bodegsrd K, Richart T, Ohkubo T, Kuznetsova T, Torp-Pedersen
C et al (2007) Prognostic accuracy of day versus night ambula-
tory blood pressure: a cohort study. Lancet 370: 1219–1229
4. Cole RJ, Kripke DF, Gruen W, Mullaney DJ, Gillin JC (1992)
Automatic sleep/wake identification from wrist actigraphy Sleep
15: 461–469
5. Cuspidi C, Macca G, Sampieri L, Fusi V, Severgnini B, Michev I,
Salerno M, Magrini F, Zanchetti A (2001) Target organ damage
and non-dipping pattern defined by two sessions of ambulatory
blood pressure monitoring in recently diagnosed essential
hypertensive patients. J Hypertens 19: 1539–1545
6. Cuspidi C, Meani S, Salerno M, Valerio C, Fusi V, Severgnini B,
Lonati L, Magrini F, Zanchetti A (2004) Cardiovascular target
organ damage in essential hypertensives with or without repro-
ducible nocturnal fall in blood pressure. J Hypertens 22: 273–280
7. Cuspidi C, Michev I, Meani S, Severgnini B, Fusi V, Corti C,
Salerno M, Valerio C, Magrini F, Zanchetti A (2003) Reduced
nocturnal fall in blood pressure, assessed by two ambulatory blood
pressure monitorings and cardiac alterations in early phases of
untreated essential hypertension. J Hum Hypertens 17: 245–251
8. Dolan E, Stanton A, Thijs L, Hinedi K, Atkins N, McClory S,
Hond ED, McCormack P, Staessen JA, O’Brien E (2005) Supe-
riority of ambulatory over clinic blood pressure measurement in
predicting mortality: the Dublin outcome study. Hypertension 46:
156–161
9. Hermida RC (2007) Ambulatory blood pressure monitoring in the
prediction of cardiovascular events and effects of chronotherapy:
rationale and design of the MAPEC study. Chronobiol Int 24:
749–775
10. Hermida RC, Chayan L, Ayala DE, Mojon A, Domfnguez MJ,
Fontao MJ, Soler R, Alonso I, Fernßndez JR (2009) Association
of metabolic syndrome and blood pressure nondipping profile in
untreated hypertension. Am J Hypertens 22: 307–313
11. Hilten JJV, Middelkoop HA, Kuiper SI, Kramer CG, Roos RA
(1993) Where to record motor activity: an evaluation of com-
monly used sites of placement for activity monitors. Electroen-
cephalogr Clin Neurophysiol 89: 359–362
12. Hyde M, O’Driscoll DM, Binette S, Galang C, Tan SK, Verginis
N, Davey MJ, Horne RSC (2007) Validation of actigraphy for
determining sleep and wake in children with sleep disordered
breathing. J Sleep Res 16: 213–216
13. Jones SH, Hare DJ, Evershed K (2005) Actigraphic assessment of
circadian activity and sleep patterns in bipolar disorder. Bipolar
Disord 7: 176–186
14. Karlen W, Mattiussi C, Floreano D (2008) Improving actigraph
sleep/wake classification with cardio-respiratory signals. Conf
Proc IEEE Eng Med Biol Soc 2008: 5262–5265
15. Krakoff LR (1993) Ambulatory blood pressure monitoring can
improve cost-effective management of hypertension. Am J Hy-
pertens 6: 220–224
16. Krouse HJ, Yarandi H, McIntosh J, Cowen C, Selim V (2008)
Assessing sleep quality and daytime wakefulness in asthma using
wrist actigraphy. J Asthma 45: 389–395
17. Lee JK, Park EJ (2011) 3D spinal motion analysis during stair-
case walking using an ambulatory inertial and magnetic sensing
system. Med Biol Eng Comput 49: 755–764
Med Biol Eng Comput (2012) 50:329–340 339
123
18. Lee JK, Park EJ (2011) Quasi real-time gait event detection using
shank-attached gyroscopes. Med Biol Eng Comput 49: 707–712
19. Liu M, Takahashi H, Morita Y, Maruyama S, Mizuno M, Yuzawa
Y, Watanabe M, Toriyama T, Kawahara H, Matsuo S (2003)
Non-dipping is a potent predictor of cardiovascular mortality and
is associated with autonomic dysfunction in haemodialysis
patients. Nephrol Dial Transplant 18: 563–569
20. Lockley SW, Skene DJ, Arendt J (1999) Comparison between
subjective and actigraphic measurement of sleep and sleep
rhythms. J Sleep Res 8: 175–183
21. Morgenthaler T, Alessi C, Friedman L, Owens J, Kapur V, Bo-
ehlecke B, Brown T, Chesson A, Coleman J, Lee-Chiong T et al
(2007) Practice parameters for the use of actigraphy in the
assessment of sleep and sleep disorders: an update for 2007.
Sleep 30: 519–529
22. Ohinata J, Suzuki N, Araki A, Takahashi S, Fujieda K, Tanaka H
(2008) Actigraphic assessment of sleep disorders in children with
chronic fatigue syndrome. Brain Dev 30: 329–333
23. Sadeh A, Acebo C (2002) The role of actigraphy in sleep med-
icine. Sleep Med Rev 6: 113–124
24. Sadeh A, Hauri PJ, Kripke DF, Lavie P (1995) The role of ac-
tigraphy in the evaluation of sleep disorders. Sleep 18: 288–302
25. Sadeh A, Sharkey KM, Carskadon MA (1994) Activity-based
sleep-wake identification: an empirical test of methodological
issues. Sleep 17: 201–207
26. Schepers HM, Roetenberg D, Veltink PH (2010) Ambulatory
human motion tracking by fusion of inertial and magnetic sensing
with adaptive actuation. Med Biol Eng Comput 48: 27–37
27. Tonetti L, Pasquini F, Fabbri M, Belluzzi M, Natale V (2008)
Comparison of two different actigraphs with polysomnography in
healthy young subjects. Chronobiol Int 25: 145–153
28. ValliFres A, Morin CM (2003) Actigraphy in the assessment of
insomnia. Sleep 26: 902–906
340 Med Biol Eng Comput (2012) 50:329–340
123