Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of...

88
Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection By Lev Vaisman A thesis submitted in conformity with the requirements for the degree of Master of Applied Science in Biomedical Engineering, Graduate Department of Institute of Biomaterials and Biomedical Engineering, University of Toronto Copyright © Lev Vaisman 2008

Transcript of Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of...

Page 1: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

Application of Singular Spectrum-based Change-point

Analysis to EMG Event Detection

By

Lev Vaisman

A thesis submitted in conformity with the requirements for the degree of Master of Applied Science in

Biomedical Engineering, Graduate Department of Institute of Biomaterials and Biomedical Engineering,

University of Toronto

Copyright © Lev Vaisman 2008

Page 2: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

ii

Abstract

Name: Lev Vaisman,

MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG

Event Detection

Year of Convocation: 2008

Department: Institute of Biomaterials and Biomedical Engineering

University: University of Toronto

Electromyogram (EMG) is an established tool to study operation of neuromuscular systems. In

analysing EMG signals, accurate detection of the movement-related events in the signal is

frequently necessary. I explored the application of change-point detection algorithm proposed by

Moskvina et. al., 2003 to EMG event detection, and evaluated the technique’s performance

comparing it to two common threshold-based event detection methods and to the visual estimates

of the EMG events performed by trained practitioners in the field. The algorithm was

implemented in MATLAB and applied to EMG segments recorded from wrist and trunk

muscles. The quality and frequency of successful detection were assessed for all methods, using

the average visual estimate as the baseline, against which techniques were evaluated. The

application showed that the change-point detection can successfully locate multiple changes in

the EMG signal, but the maximum value of the detection statistic did not always identify the

muscle activation onset.

Page 3: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

iii

Acknowledgements

First of all, I would like to thank my supervisor Professor Milos Popovic for his assistance,

support and advice throughout the entire time that I worked on this project. His

recommendations have guided my investigations while his explanations greatly improved my

understanding. I would also like to thank my regular committee members Professor Tom Chau

and Professor Berj Bardakjian for their valuable suggestions during the committee meetings.

Secondly, I would like to acknowledge the graduate students and postdoctoral fellows in the

Rehabilitation Engineering Laboratory at Lyndhurst Rehabilitation Center who helped me

throughout the project. Cesar Marquez-Chin introduced me to the EEG and EMG signal

processing techniques. Dr. Kei Masani and Vivian Sin provided me with the recordings from

trunk muscles, as well as with the diagrams describing the experiment, in which this data was

acquired. Also Dr. Masani as well as Dr. Noritaka Kawashima and Dr. Dmitry Sayenko assisted

me by providing the visual EMG onset estimates. Dr. Sayenko also provided the 3D diagram for

the electrodes placement for the wrist EMG data recordings. I am also very grateful to other

members of the lab, not listed here, for creating a very interesting and friendly environment to

work in, and their moral support throughout my project.

I would also like to thank Dr. Robert Chen and Eric Tsang from Toronto Western Hospital who

provided me with the wrist EMG recordings.

Finally, I would like to thank the IBBME and NSERC for providing me with the opportunity to

work on this project.

Page 4: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

iv

Table of Contents

ABSTRACT.................................................................................................................................. II

ACKNOWLEDGEMENTS .......................................................................................................III

TABLE OF CONTENTS ........................................................................................................... IV

LIST OF ABBREVIATIONS ....................................................................................................VI

LIST OF EQUATIONS............................................................................................................ VII

LIST OF FIGURES .................................................................................................................VIII

LIST OF TABLES ....................................................................................................................... X

CHAPTER 1: INTRODUCTION................................................................................................ 1

1.1. MUSCLES TYPES AND PHYSIOLOGY ................................................................................. 1

1.2. ELECTROMYOGRAPHY ..................................................................................................... 2

1.2.1. Definition .................................................................................................................... 2

1.2.2. Recording.................................................................................................................... 2

1.2.3. Applications ................................................................................................................ 3

1.3. EMG PROCESSING AND PROBLEM OF MUSCLE CONTRACTION EVENTS DETECTION ....... 4

1.4. MOTIVATION FOR THE PROJECT PRESENTED IN THIS DOCUMENT..................................... 5

1.5. THESIS OUTLINE .............................................................................................................. 6

CHAPTER 2: LITERATURE REVIEW ................................................................................... 7

2.1. OVERVIEW OF ONSET OF EMG MOVEMENT-RELATED EVENTS DETECTION METHODS ... 7

2.1.1. Threshold-based Methods........................................................................................... 7

2.1.2. Denoising .................................................................................................................... 8

2.1.3. Model-based Methods................................................................................................. 9

2.2. OVERVIEW OF CHANGE-POINT ANALYSIS METHODS ..................................................... 10

2.2.1. Concepts, Definitions, Applications.......................................................................... 10

2.2.2. Methods of Change-point Analysis ........................................................................... 11

2.2.3. Review of Change-point Analysis Applications to Biological Signals...................... 13

2.3. SINGULAR SPECTRUM ANALYSIS (SSA) AND CHANGE-POINT DETECTION .................... 15

2.3.1. SSA Theory and Applications.................................................................................... 15

2.3.2. Change-point Detection Algorithm Based on SSA.................................................... 17

2.3.3. Why Choose the SSA-based Algorithm for this Study?............................................. 19

2.4. SUMMARY OF THE CHAPTER .......................................................................................... 20

CHAPTER 3: OBJECTIVES AND HYPOTHESIS................................................................ 21

3.1. OBJECTIVES ................................................................................................................... 21

3.2. HYPOTHESIS................................................................................................................... 21

CHAPTER 4: METHODS ......................................................................................................... 22

4.1. DATA ACQUISITION ....................................................................................................... 22

4.1.1. Wrist Extension Experiments .................................................................................... 22

4.1.2. Trunk Muscles Involved in Sitting............................................................................. 24

Page 5: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

v

4.2. SSA-BASED CHANGE-POINT DETECTION ALGORITHM PARAMETERS SELECTION AND

IMPLEMENTATION ...................................................................................................................... 25

4.2.1. Parameter Selection.................................................................................................. 25

a) Selecting lag M and window size m: Tests with Gaussian noise.................................. 26

b) Selection of the number of components L ..................................................................... 28

c) Selection of test interval parameters p and q ............................................................... 28

4.2.2. MATLAB Implementation ......................................................................................... 29

4.3. PROCESSING SET-UP ...................................................................................................... 30

4.3.1. Methods of EMG Movement-related Events Detection and Signal Pre-processing. 31

4.3.2. Application of Hodges&Bui Method......................................................................... 32

4.3.3. Application of Donoho’s Wavelet-based Denoising Method.................................... 33

4.3.4. Comparison of Onset Detection Methods. ................................................................ 34

4.4. SUMMARY OF THE CHAPTER .......................................................................................... 34

CHAPTER 5: RESULTS ........................................................................................................... 36

5.1. SAMPLE EVENT DETECTION IN WRIST AND TRUNK MUSCLE EMG ............................... 36

5.2. FREQUENCY OF SUCCESSFUL EMG MOVEMENT-RELATED EVENTS DETECTION BY

DIFFERENT METHODS IN WRIST MUSCLES ................................................................................ 38

5.3. FREQUENCY OF SUCCESSFUL EMG MOVEMENT-RELATED EVENTS DETECTION BY

DIFFERENT METHODS IN TRUNK MUSCLES................................................................................ 41

5.4. QUALITY OF MOVEMENT-RELATED EVENTS DETECTION BY DIFFERENT METHODS IN

WRIST MUSCLES........................................................................................................................ 43

5.5. QUALITY OF MOVEMENT-RELATED EVENTS ONSET DETECTION BY DIFFERENT METHODS

IN TRUNK MUSCLES ................................................................................................................... 45

5.6. SUMMARY OF THE CHAPTER .......................................................................................... 46

CHAPTER 6: DISCUSSION ..................................................................................................... 48

6.1. BENEFITS OF CHANGE-POINT DETECTION IN THE EMG PROCESSING APPLICATION ...... 48

6.2. LIMITATIONS OF THE CHANGE-POINT DETECTION IN THE EMG PROCESSING

APPLICATION ............................................................................................................................. 49

6.3. ISSUES WORTHY OF FURTHER INVESTIGATION .............................................................. 51

6.4. SUMMARY OF THE CHAPTER .......................................................................................... 52

CHAPTER 7: CONCLUSION AND FUTURE WORK ......................................................... 53

APPENDICES............................................................................................................................. 61

APPENDIX A: CHANGE-POINT DETECTION ALGORITHM MATLAB IMPLEMENTATION.............. 61

APPENDIX B: SCRIPT TO INPUT THE VISUAL ESTIMATES OF THE EMG ONSETS WITH A MOUSE IN

MATLAB.................................................................................................................................. 64

APPENDIX C: HODGES&BUI ALGORITHM IMPLEMENTATION IN MATLAB ............................... 65

APPENDIX D: WAVELET-BASED DENOISING IMPLEMENTATION IN MATLAB........................... 66

APPENDIX E: AVERAGE ABSOLUTE DIFFERENCES PLOTS, KRUSKAL-WALLIS / ANOVA TABLES

AND MULTIPLE COMPARISONS PLOTS FOR WRIST MUSCLE EMG ............................................. 68

APPENDIX F: AVERAGE ABSOLUTE DIFFERENCES PLOTS, KRUSKAL-WALLIS / ANOVA TABLES

AND MULTIPLE COMPARISONS PLOTS FOR TRUNK MUSCLE EMG ............................................ 77

Page 6: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

vi

List of Abbreviations

AGLR – approximated generalized likelihood ratio

AR – autoregressive model (also known as all-pole model)

ATP – adenosine triphosphate

CUSUM – cumulative sum

DGM – data generation mechanism

DGP – data generation process

EEG – electroencephalography, electroencephalogram

EKG – electrocardiogram

EMG – electromyography, electromyogram, electromyographic

LRF – linear recurrence formula

ME – myoelectric

MUAP – motor unit action potential

SNR – signal-to-noise ratio

SSA – singular spectrum analysis

SSM – state-space model

STN – subthalamic nucleus / nuclei

Page 7: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

vii

List of Equations

EQUATION 1: KOLMOGOROV-SMIRNOV DETECTION STATISTIC ...................................................... 12

EQUATION 2: TRAJECTORY MATRIX FOR SINGULAR SPECTRUM ANALYSIS.................................... 16

EQUATION 3: RECONSTRUCTION OF SIGNAL AFTER SSA-DECOMPOSITION INTO COMPONENTS. .... 16

EQUATION 4: FORM OF THE PROCESS, WHICH CAN BE WELL REPRESENTED BY LINEAR RECURRENT

FORMULA ............................................................................................................................... 17

EQUATION 5: EQUATION OF THE TRAJECTORY MATRIX FOR SSA-BASED CHANGE-POINT DETECTION.

............................................................................................................................................... 18

EQUATION 6: EQUATION OF THE LAG-COVARIANCE MATRIX FOR SSA-BASED CHANGE-POINT

DETECTION............................................................................................................................. 18

EQUATION 7: EQUATION OF THE TEST MATRIX FOR SSA-BASED CHANGE-POINT DETECTION......... 18

EQUATION 8: EQUATION FOR DN STATISTIC ................................................................................... 19

EQUATION 9: EQUATION FOR CUSUM STATISTIC. ........................................................................ 19

EQUATION 10: EQUATION OF THE THRESHOLD FOR CHANGES IN SSA-BASED CHANGE-POINT

DETECTION............................................................................................................................. 19

EQUATION 11: EQUATION FOR VN USED IN MATLAB IMPLEMENTATION OF THE CHANGE-POINT

DETECTION ALGORITHM. ........................................................................................................ 30

EQUATION 12: ALTERNATIVE FORMULA FOR VN CALCULATION ..................................................... 30

EQUATION 13: ALTERNATIVE FORMULA FOR VN CALCULATION ..................................................... 30

EQUATION 14: ALTERNATIVE EQUATION OF THRESHOLD FOR CHANGES IN SSA-BASED CHANGE-

POINT DETECTION................................................................................................................... 30

Page 8: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

viii

List of Figures FIGURE 1: DIAGRAM SHOWING ELECTRODES LOCATIONS FOR RECORDING OF EMG FROM EXTENSOR

CARPI RADIALIS MUSCLES. RECTANGLE IS THE LOCATION FOR RECORDING ELECTRODES AND

CIRCLE IS A PLACE OF REFERENCE ELECTRODE. PROVIDED BY DR. D. SAYENKO, 2008.......... 23

FIGURE 2: DIRECTIONS OF PERTURBATION (SIN, 2007) .................................................................. 24

FIGURE 3: FRONT VIEW (LEFT) AND BACK VIEW (RIGHT) OF THE LOCATIONS OF EMG ELECTRODES

FOR TRUNK MUSCLES EMG RECORDINGS (SIN, 2007)............................................................ 25

FIGURE 4: TEST OF EFFECT OF LAG PARAMETER ON CHANGE-POINT DETECTION IN GAUSSIAN NOISE

(A) GAUSSIAN NOISE, 10,000 POINTS, MEAN 0, VAR 1, (B-D) RESULTS OF CHANGE-POINT

DETECTION WITH (B) LAG M=100, M=200, (C) M=50, M=100, (D) M=25, M=50. BLUE LINE IS

DETECTION STATISTIC, PINK LINE SHOWS THE THRESHOLD. NOTABLY, PLOT (B) SHOWS LESS

FALSE CHANGES DETECTED THAN PLOTS (C) AND (D), THUS SHOWING INCREASE OF ACCURACY

WITH LAG PARAMETER. .......................................................................................................... 27

FIGURE 5: SAMPLE DETECTION RESULTS FOR WRIST MUSCLE EMG (A) ORIGINAL EMG SIGNAL, (B)

DN DETECTION STATISTIC, (C) CUSUM DETECTION STATISTIC. RED CIRCLE MARKS THE

COMPUTED EMG MOVEMENT-RELATED EVENT ONSET. ......................................................... 36

FIGURE 6: SAMPLE DETECTION RESULTS FOR TRUNK MUSCLES EMG (A) ORIGINAL EMG SIGNAL,

(B) DN DETECTION STATISTIC, (C) CUSUM DETECTION STATISTIC. RED CIRCLE MARKS THE

COMPUTED EMG ONSET. ....................................................................................................... 37

FIGURE 7: DETECTION OF MOVEMENT-RELATED EVENT IN EMG SIGNAL CONTAMINATED BY

TREMOR. TOP PLOT SHOWS THE ORIGINAL RAW SIGNAL WITH TREMOR SPIKES TO WHICH

CHANGE-POINT ANALYSIS IS APPLIED. SECOND PLOT SHOWS THE FILTERED AND RECTIFIED

SIGNAL FROM WHICH THE HODGES-BUI ESTIMATE IS COMPUTED, AND WHICH DOES NOT HAVE

TREMOR SPIKES WHICH WERE REMOVED BY FILTERING, THUS PROVIDING THE BEST ESTIMATE.

THIRD PLOT SHOWS THE WAVELET-DENOISED SIGNAL FROM WHICH WAVELET-BASED

ESTIMATE WAS OBTAINED. LOWEST PLOT SHOWS THE CUSUM STATISTIC WITH THE CHANGES

DETECTED BOTH DUE TO TREMOR SPIKES AND DUE TO MOVEMENT-RELATED MUSCLE

ACTIVATION, WITH THE CHANGES DUE TO TREMOR INFLUENCING THE CHANGE-POINT

STATISTIC STRONGER. ............................................................................................................ 40

FIGURE 8: AN EXAMPLE OF EMG EVENT MISDETECTION BY THE CHANGE-POINT ANALYSIS

ALGORITHM IN TRUNK EMG. TOP PLOT SHOWS THE ORIGINAL SIGNAL FROM ONE OF THE

TRUNK MUSCLES. SECOND PLOT SHOWS THE FILTERED AND RECTIFIED SIGNAL FROM WHICH

THE HODGES-BUI ESTIMATE IS COMPUTED. THIRD PLOT SHOWS THE WAVELET-DENOISED

SIGNAL FROM WHICH WAVELET-BASED ESTIMATE WAS OBTAINED. LOWEST PLOT SHOWS THE

CUSUM STATISTIC WITH MULTIPLE CHANGES DETECTED IN SEQUENCE WITH SOME OF THE

LATER CHANGES HAVING BIGGER INFLUENCE ON THE DETECTION STATISTIC THAN THE

EARLIER ONES, ALTHOUGH EARLIER SMALLER CHANGES ARE UNANIMOUSLY IDENTIFIED BY

VISUAL ESTIMATORS AS THE ONSET OF MOVEMENT-RELATED EVENT..................................... 42

FIGURE 9: AAA1 AVERAGE ABSOLUTE DIFFERENCES .................................................................. 68

FIGURE 10: AAA1 MULTIPLE COMPARISONS TEST ....................................................................... 68

FIGURE 11: AAA2 AVERAGE ABSOLUTE DIFFERENCES ................................................................ 69

FIGURE 12: AAA2 MULTIPLE COMPARISONS TEST ....................................................................... 69

FIGURE 13: AAA3 AVERAGE ABSOLUTE DIFFERENCES ................................................................ 70

FIGURE 14: AAA3 MULTIPLE COMPARISONS TEST ....................................................................... 70

FIGURE 15: AAA4 AVERAGE ABSOLUTE DIFFERENCES ................................................................ 71

FIGURE 16: AAA4 MULTIPLE COMPARISONS TEST ....................................................................... 71

Page 9: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

ix

FIGURE 17: AAA5 AVERAGE ABSOLUTE DIFFERENCES ................................................................ 72

FIGURE 18: AAA5 MULTIPLE COMPARISONS TEST ....................................................................... 72

FIGURE 19: AAA6 AVERAGE ABSOLUTE DIFFERENCES ................................................................ 73

FIGURE 20: AAA6 MULTIPLE COMPARISONS TEST ....................................................................... 73

FIGURE 21: AAA7 AVERAGE ABSOLUTE DIFFERENCES ................................................................ 74

FIGURE 22: AAA7 MULTIPLE COMPARISONS TEST ....................................................................... 74

FIGURE 23: AAA8 AVERAGE ABSOLUTE DIFFERENCES ................................................................ 75

FIGURE 24: AAA8 MULTIPLE COMPARISONS TEST ....................................................................... 75

FIGURE 25: AAA9 AVERAGE ABSOLUTE DIFFERENCES ................................................................ 76

FIGURE 26: AAA9 MULTIPLE COMPARISONS TEST ....................................................................... 76

FIGURE 27: SUBJECT 1 AVERAGE ABSOLUTE DIFFERENCES .......................................................... 77

FIGURE 28: SUBJECT 1 MULTIPLE COMPARISONS TEST ................................................................. 77

FIGURE 29: SUBJECT 2 AVERAGE ABSOLUTE DIFFERENCES .......................................................... 78

FIGURE 30: SUBJECT 2 MULTIPLE COMPARISONS TEST................................................................. 78

Page 10: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

x

List of Tables TABLE 1: FREQUENCY OF SUCCESSFUL MOVEMENT-RELATED EVENT DETECTION IN WRIST EMG

FOR DIFFERENT COMPUTER METHODS. FILENAMES SHOW THE CODED PARTICIPANT ID (I.E.

AAA1) WHETHER RECORDING WAS OFF MEDICATION (OFFMED) OR ON MEDICATION

(ONMED), AND WHETHER THE RECORDED TASK WAS INTERNALLY (INT) OR EXTERNALLY

(EXT) TRIGGERED. ................................................................................................................ 38

TABLE 2: FREQUENCY OF SUCCESSFUL MOVEMENT-RELATED EVENT DETECTION IN TRUNK EMG

FOR DIFFERENT COMPUTER METHODS. FILENAMES SHOW THE PARTICIPANT ID AND

DIRECTIONS OF PERTURBATION (MIDDLE DIGIT OF THE NUMERICAL CODE) ACCORDING TO

FIGURE 2 FROM THE SUBSECTION 4.1.2.................................................................................. 41

TABLE 3: QUALITY OF MOVEMENT-RELATED EVENTS ONSET DETECTION ASSESSED BY MEAN

RANKS OF AVERAGE ABSOLUTE DIFFERENCES BETWEEN VISUAL ESTIMATES AND COMPUTER

METHODS IN WRIST EMG SIGNALS (MEAN RANK ± STANDARD ERROR). FILENAMES SHOW THE

CODED PARTICIPANT ID (I.E. AAA1). ALL THE RECORDINGS WHOSE RESULTS ARE PRESENTED

IN THIS TABLE WERE EXTERNALLY TRIGGERED (EXT) AND WERE RECORDED OFF MEDICATION

(OFFMED) OR ON MEDICATION (ON) ................................................................................... 44

TABLE 4: QUALITY OF MOVEMENT-RELATED EVENTS ONSET DETECTION ASSESSED BY SPEARMAN

RANK COEFFICIENTS BETWEEN VISUAL ESTIMATES AND COMPUTER METHODS IN WRIST

EMG SIGNALS. FILENAMES SHOW THE CODED PARTICIPANT ID (I.E. AAA1). ALL THE

RECORDINGS WHOSE RESULTS ARE PRESENTED IN THIS TABLE WERE EXTERNALLY TRIGGERED

(EXT) AND WERE RECORDED OFF MEDICATION (OFFMED) OR ON MEDICATION (ON) ......... 45

TABLE 5: QUALITY OF MOVEMENT-RELATED EVENT ONSET DETECTION ASSESSED BY MEAN

RANKS OF AVERAGE ABSOLUTE DIFFERENCES BETWEEN VISUAL ESTIMATES AND COMPUTER

METHODS IN TRUNK EMG SIGNALS (MEAN RANK ± STANDARD ERROR) ............................... 46

TABLE 6: QUALITY OF MOVEMENT-RELATED EVENT ONSET DETECTION ASSESSED BY SPEARMAN

RANK COEFFICIENTS BETWEEN VISUAL ESTIMATES AND COMPUTER METHODS IN TRUNK

EMG SIGNALS ....................................................................................................................... 46

TABLE 7: AAA1 KRUSKAL-WALLIS ANOVA............................................................................... 68

TABLE 8: AAA2 KRUSKAL-WALLIS ANOVA............................................................................... 69

TABLE 9: AAA3 KRUSKAL-WALLIS ANOVA............................................................................... 70

TABLE 10: AAA4 KRUSKAL-WALLIS ANOVA............................................................................. 71

TABLE 11: AAA5 KRUSKAL-WALLIS ANOVA............................................................................. 72

TABLE 12: AAA6 KRUSKAL-WALLIS ANOVA............................................................................. 73

TABLE 13: AAA7 KRUSKAL-WALLIS ANOVA............................................................................. 74

TABLE 14: AAA8 KRUSKAL-WALLIS ANOVA............................................................................. 75

TABLE 15: AAA9 KRUSKAL-WALLIS ANOVA............................................................................. 76

TABLE 16: SUBJECT 1 KRUSKAL-WALLIS ANOVA ...................................................................... 77

TABLE 17: SUBJECT 2 KRUSKAL-WALLIS ANOVA....................................................................... 78

Page 11: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

1

Chapter 1: Introduction

1.1. Muscles Types and Physiology

There are three types of muscles in the human body: skeletal, smooth and cardiac muscles.

Skeletal muscles represent about 40% of the body, while the other types represent about 10%.

Skeletal muscles are involved in locomotion, are attached to bones by tendons, and are typically

under voluntary control. Smooth muscles form a lining of gastro-intestinal tract, urinary tract and

blood vessels. Cardiac muscle forms the bulk of the heart. Smooth and cardiac muscle are under

involuntary control (Ethier et. al., 2007, Guiton et. al., 2000).

Skeletal muscles are composed of many muscle fibers, which are innervated by the nerves

originating from the motoneurons of the spinal cord and brain stem. Each motoneuron innervates

multiple muscle fibers. All muscle fibers innervated by the same motoneuron are called a motor

unit. Muscle fibers have a cell membrane called sarcolemma, which contains numerous

acetylcholine-gated channels. The area where a nerve comes into contact with the muscle fiber is

called a neuromuscular junction (Guiton et. al., 2000).

Muscle fibers consist of hundreds to thousands of myofibrils. Myofibrils contain multiple

actin and myosin filaments which are the proteins carrying out the muscle contraction.

Myofibrils inside the muscle fibers are in an intracellular matrix called sarcoplasm, which

contains large quantities of ions, sarcoplasmic reticulum, storing calcium, and mitochondria,

which generate energy in form of adenosine triphosphate (ATP), which is needed in large

quantities for muscle operation (Guiton et. al., 2000).

When a signal in form of an action potential from the nerve reaches the muscle, a small

amount of neurotransmitter substance acetylcholine is released at the neuromuscular junction.

Acetylcholine makes acetylcholine-gated channels in the sarcolemma to open, which allows the

influx of sodium ions into the muscle fiber, thus initiating an action potential. The action

potential propagates along the muscle and penetrates deep into the muscle where it causes the

release of calcium from sarcoplasmic reticulum. Calcium ions enable the interaction between

actin and myosin filaments of myofibrils, allowing them to slide one along other, thus enabling

the actual muscle contraction. Shortly after that, calcium ions are forced back into sarcoplasmic

Page 12: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

2

reticulum by the calcium pump, where they remain until a new action potential arrives at the

muscle. This removal of calcium ions stops muscle contraction (Guiton et. al., 2000).

1.2. Electromyography

1.2.1. Definition

Electromyography (EMG) is a technique used for recording of action potentials generated by

the muscles (Cooper et. al., 2005). The action potentials of all muscle fibers that belong to a

motor unit summate spatially and temporally to create a so-called motor unit action potential

(MUAP). The algebraic summation of all the MUAPs active at a certain moment in time in the

vicinity of the recording site yields an EMG or sometimes also called a myoelectric signal (ME)

(de Luca, 1979).

1.2.2. Recording

Very first investigations of electrical activity in the muscles were performed by Luigi

Galvani and Alessandro Volta in the second half of 18th

century. In 1929 Adrian and Bronk

introduced a concentric needle electrode allowing recording of EMG from individual motor

units. Before the 1940s EMG recordings remained very expensive because all researchers used

custom-made equipment, but after the introduction of monopolar electrodes in 1944 by Jasper

and Notman, and nerve conduction studies by Dawson and Scott in 1949, EMG became feasible

to use as a clinical tool (Cooper et. al., 2005).

EMG can be recorded with both deep needle electrodes and surface electrodes. Needle

electrodes allow deriving individual MUAPs from recordings of a small amount of fibers. By

means of such electrodes one can investigate loss of nerve supply to the muscles, diseases

affecting muscle fibers and neuromuscular junctions. One can also study motor unit recruitment

and firing patterns. However, this recording approach is invasive, for it requires the insertion of

the needle into the muscle. On the other hand, surface EMG is non-invasive. Although one

cannot record single muscle fiber activity using surface EMG electrodes, one can obtain

information on temporal patterns of muscle activity, fatigue and other aspects of muscle

Page 13: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

3

behaviour. For example, surface EMG is useful for estimation of muscle-fiber conduction

velocity, length and orientation of the fibers, and MUAP propagation (Trontelj et. al., 2004).

There are many factors that influence EMG signal recording. There are anatomical and

physiological factors. Anatomical factors include thickness of skin and subcutaneous tissue

layers, size and distribution of motor units, number and length of muscle fibers in motor units.

The placement, size and shape of electrodes, as well as their orientation with respect to the

muscle fiber alignment could also be important. Physiological factors including muscle fibers’

and motor units’ conduction velocities, type of contraction, motor unit synchronization, as well

as blood flow, temperature and intramuscular pH could also affect the EMG. Besides that,

crosstalk between muscles is also important. Crosstalk refers to situations when the signal

recorded over one muscle is actually generated by another muscle. For example, when recording

EMG from the trunk muscles, EKG signal may interfere with the recorded muscle EMG. Also,

the noise from the EMG recording system can affect the results (Farina et. al., 2004, Merletti et.

al., 2001).

1.2.3. Applications

EMG has become a valuable tool in many applications, for example, in neurology,

ergonomics, rehabilitation medicine, and prostheses control.

Needle-electrode EMG can help diagnosing neurogenic and myopathic diseases by

measuring muscle activity at rest, number of motor units under voluntary control, and the

duration and amplitude of MUAPs (Rowland, 2000). Surface EMG is also useful in evaluating

patients with abnormal involuntary muscle activation, such as those in tremor or dystonia, and

patients with a weakness or paralysis (Zwarts et. al., 2004).

EMG was also used to investigate muscle fatigue in ergonomics related research studies, for

instance, during the use of hand tools, work at the assembly line and driving (Hagg et. al., 2004).

Furthermore, EMG was used to study muscle activation patterns during walking, running,

standing, sitting, etc. For example, studies of synergistic action of different muscles were

conducted during shoulder movements (Park et. al., 2008) and quiet standing posture control

(Krishnamoorthy et. al., 2003). EMG was also used to study various exercises such as, for

instance, weightlifting and skiing (Pearson et. al., 2002, Koyanagi et. al., 2006). In addition,

Page 14: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

4

EMG was used to better understand the muscle fiber damage due to overuse and how muscle

recovers over time after overuse (Felici, 2004).

EMG signals are also being used to control powered prosthesis, i.e., myoelectric control of

upper or lower limb prostheses. The source of the input signal is a residual muscle remaining

after amputation. Contraction of one or more residual muscles using surface EMG electrodes can

be used to generate control signals for the prosthesis. In particular, the control signal is derived

from the myoelectric signal’s variance or signal pattern corresponding to a particular task or

function (Parker et. al., 2004).

1.3. EMG Processing and Problem of Muscle Contraction Events Detection

The recorded EMG signal is usually called raw EMG signal. Depending on the desired type

of analysis it is necessary to perform certain manipulations on the raw signal. For example,

common signal processing steps are removal of non-zero bias due to equipment noise, and

artefacts due to electrocardiogram (EKG) or heartbeat by filtering with highpass (McMulkin et.

al., 1998) or bandpass filters (Potvin et. al., 2004). To quantify the amount of muscle activity,

smoothing procedures are applied on rectified EMG signals, such as mean-absolute value

processing, root-mean-square processing or lowpass filtering (Clancy et. al., 2002; Kamen,

1996). Another technique commonly applied is normalization of EMG signals. This technique

basically expresses the level of muscle activity as a percentage of a reference EMG signal that is

obtained when a specific movement is performed (Mirka, 1991).

Detecting the onset of EMG movement-related event such as muscle contraction is another

frequently performed EMG processing task. It is important for several applications. Firstly, it is a

marker for the start of active control of the muscle (Stylianou, 2003, Staude et. al., 2001).

Secondly, it is important for the measurement of performance in so-called reaction time

experiments (Staude et. al., 2001, van Boxtel et. al., 1993) with external stimulus, i.e. when

subjects have to perform an action as soon as possible after they receive a corresponding

command. EMG onset is also commonly used for alignment of movement-related potentials in

electroencephalogram (EEG) and to divide the reaction time interval into motor and premotor

reaction time, which is important in neurology and psychophysiological applications (van Boxtel

et. al., 1993).

Page 15: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

5

There are two main approaches for the detection of EMG events: visual (Hodges et. al., 2001,

Urquhart et. al., 2005) and algorithm-based (Staude et. al., 2001; Morey-Klapsing et. al., 2004).

A common criticism for the visual method is its subjectivity, and that the accuracy of the results

depend considerably on the experience of the person performing the EMG onset detection

(Micera et. al., 2001). For algorithm-based detection numerous algorithms have been proposed,

but there is no standardized method that is used to perform EMG onset detection (Hodges et. al.,

1996).

1.4. Motivation for the Project Presented in this Document

Originally the intent of my master’s degree project was to investigate ways of determining

the onset of movement in the recordings obtained from the basal ganglia. Namely, the objective

was to investigate if one can extract the onset of a movement using recordings obtained from the

deep brain stimulation electrodes that were implanted in the subthalamic nucleus of Parkinson’s

disease patients. If successful, this project would represent a first step towards developing a

brain-machine interface that will use deep brain recordings. Such a device would be useful, for

example, to control a neuroprosthesis device for restoration of movement in paralyzed patients.

One of the pre-processing steps for the brain signals analysis required computing the onsets

of movement based on the EMG signals that were recorded simultaneously with the deep brain

signals. The deep brain recordings were recorded while the patient was performing wrist

extensions followed by passive flexions. The segments of the brain signals were then extracted

using the onset of the wrist extensor muscle contraction. During the study the techniques of

change-point analysis, i.e., detection of changes in the signal, came to my attention. Change-

point detection is commonly used for time series analysis in various fields, and its applications

will be reviewed in subsequent sections. This approach seemed to show promise in the analysis

of movement-related changes in the brain signals. At the same time, it was observed that the

employed change-point detection procedure allowed a rather clean detection of changes in the

EMG signal and as a result the project goals changed from deep brain recordings analysis

towards exploring use of change-point detection technique for identification of EMG muscle

activation events onset and EMG signal processing.

Although various methods for detection of the onset of muscle contraction from the EMG

recording already exist, a method that is widely accepted yet needs to be developed. Therefore, I

Page 16: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

6

have decided to explore use of the change-point detection analysis, which is rarely used in

biomedical engineering, as a method that could potentially be useful to identify onset of muscle

contraction from the EMG signals. The other purpose of this thesis was to test the usability of the

change-point detection analysis for processing biological signals.

1.5. Thesis Outline

Chapter 2 reviews the currently used detection algorithms for EMG movement-related

events, and change-point detection techniques and their applications to biological signals.

Chapter 3 states the objectives and hypotheses of this study. Chapter 4 describes the data

acquisition for wrist extension and perturbed sitting datasets used for the comparison of EMG

onset detection techniques. It also describes the singular spectrum analysis (SSA) signal

processing technique and its application for change-point detection algorithm. Approaches for

the parameters selection for the algorithm’s application to EMG signals are discussed too.

Chapter 5 presents the results of application of change-point detection method to the EMG

signals, and the comparison of computed EMG event onsets to those determined by other

detection methods, including basic thresholding algorithm, thresholding with wavelet-based

denoising, and visual detection. Chapter 6 discusses the results and the limitations of the change-

point detection approach. Chapter 7 summarizes the findings and provides concluding remarks

and recommendations for future work.

Page 17: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

7

Chapter 2: Literature Review

In this chapter, the methods commonly used for EMG muscle activation events detection

will be presented. Also the main concepts related to the change-point detection problem will be

introduced, and the developed techniques in this field will be described. Also the theory for the

singular spectrum analysis based change-point detection algorithm will be presented in this

section in detail. The studies in which change-point detection was applied to the biological signal

processing will be discussed as well.

2.1. Overview of Onset of EMG Movement-related Events Detection Methods

In this section three EMG event detection approaches will be discussed, namely the

threshold-based methods, the denoising pre-processing for threshold-based methods, and the

model-based methods.

2.1.1. Threshold-based Methods

The most frequently used methods are those that employ some form of a threshold level

detection. Their principle is that when the signal exceeds a predefined threshold level the

detection method signals the movement onset. Threshold-based methods are commonly applied

to the rectified EMG, and the threshold is defined either as a percentage of the EMG signal value

(Morey-Klapsing et. al., 2004) or as a sum of the mean and a multiple of standard deviations of

the EMG signal recorded prior to the onset of the muscle activity (Staude et. al., 2001, van

Boxtel et. al., 1993). Standard deviation is proportional to the number of active motor units and

the rate of activation (Clancy et. al., 2002), thus it is a useful value to define the threshold for

muscle activity onset. The performance of threshold-based methods depends on the quality of the

recorded EMG signal and signal-to-noise ratio (SNR). It is also affected by the crosstalk and

movement artefacts (Allison, 2003). There are two types of threshold-based detection methods:

a) single threshold and b) double threshold. Single threshold methods require for the EMG signal

values to exceed the set threshold to claim movement onset, while the double threshold methods

require the signal amplitude not only to exceed the threshold but also to remain above the

threshold level for a certain duration of time (Stokes et. al., 2000). Double threshold methods are

more robust than single threshold methods.

Page 18: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

8

Multiple threshold-based methods have been proposed to date: 1) Greeley’s method

(Greeley, 1984), 2) Lidierth’s method (Lidierth, 1986), 3) Hodges and Bui’s method (Hodges et.

al., 1996), 4) Bonato’s method (Bonato et. al., 1998), and 5) Abbink’s method (Abbink et. al.,

1998). Greeley’s method detects the EMG movement-related event if several successive points

of the rectified EMG exceed the threshold level (Greeley, 1984). Lidierth defines such an event

similarly to Greeley’s method, but has an additional criterion that values of the EMG signal

should exceed the threshold level for at least T1 samples, and the drops below the threshold

within these T1 samples should not be longer than T2 samples (Lidierth, 1986). In Hodges’

method the event is identified if the mean value of the rectified and low-pass filtered EMG signal

within a sliding window exceeds the predefined threshold level (Hodges et. al., 1996). Bonato et.

al.’s method applies a whitening filter to the signal followed by data squaring instead of

rectification for pre-processing. It then computes the ratio between the sum of two successive

squared signal samples and the variance of the baseline level of EMG signal. Baseline level is

computed from first M samples of the signal and the ratio is computed only for odd time instants

of the signal (1, 3, 5, etc). If this ratio exceeds a certain level for at least n out of m successive

samples, this is called an active state, and if the active state persists for T1 samples, then the time

instant when the active state was first detected is the EMG onset (Bonato et. al., 1998). Abbink

used rectification and low-pass filtering as pre-processing, similar to Hodges, however, he used a

test function to search for a movement onset. This function takes signal point as an onset

candidate, and examines N samples prior to that point and N samples after the point. It counts the

amount of samples with values whose normalized amplitudes are below the threshold among the

N preceding samples and the amount of samples whose normalized amplitudes are above the

threshold among the N following samples. The onset is defined as the location where the sum of

these computed numbers is maximal (Abbink, 1998).

2.1.2. Denoising

When the EMG signal is very noisy, i.e., SNR is low, the direct application of thresholding

to the EMG signal may fail to detect movement onset. To address this problem Donoho proposed

an algorithm that applies wavelet-based processing which can be used to suppress the noise

levels within the signal before detection is performed (Donoho, 1995). Donoho’s denoising

approach consists of three steps: 1) computing wavelet coefficients of the noise; 2) applying soft-

Page 19: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

9

thresholding non-linearity to the entire signal; and 3) reconstructing the signal. In the first step,

the data representing the noise has to be decomposed into several sequences of coefficients. For

each sequence of coefficients, the average of the coefficient values is removed and the variance

is calculated. The variance is used as the threshold for the next step. In the second step, the data

representing the sum of signal and noise is decomposed under the same conditions as the noise

data. The noise variances calculated in the first step are now subtracted from the sequences of

coefficients representing the sum of signal and noise. If the resulting difference was greater than

zero, the difference was kept; otherwise, the sequences of coefficients were assigned to zero.

This step removes the effect of noise but retains the signal properties. In the last step, the

modified sequences of coefficients are used to reconstruct an estimate of the signal without noise

(Sin, 2007). The detection by the threshold-based method is frequently easier from such denoised

signals; therefore, Donoho’s denoising can be a valuable pre-processing step before the

application of threshold-based detection, such as those described in Subsection 2.1.1.

2.1.3. Model-based Methods

Several EMG movement-related events detection techniques are based on maximum

likelihood tests (Stylianou et. al., 2003, Staude et. al., 1999, Staude et. al., 1995). These methods

require the use of adaptive whitening filters to turn an EMG signal into a Gaussian random

process, so that its properties could be described by Gaussian probability density function. Then

the detector, called optimal estimator or EstOpt by the authors, compares the probability

distributions of the signal before and after every hypothetical onset point, which depend on the

known EMG signal variance profiles. The variance profile before the hypothetical onset point

corresponds to the baseline activity and the one after the onset point to the activity during muscle

contraction. The test is done by computing a log-likelihood ratio between these probability

distributions and comparing it to a threshold. If this ratio’s maximum value among all possible

hypothetical onset points exceeds a threshold, then the point where this maximum value occurs is

defined as the onset (Staude et. al., 1999).

When variance profiles are not exactly known, they can be estimated by a set of parameters.

Staude et. al. proposed using an Approximated Generalized Likelihood Ratio (AGLR) detector

with two after-change variance profiles models: 1) step-like profile, i.e. constant variance after

the onset, different from the one before the onset; or 2) ramp-like profile, i.e. variance after the

Page 20: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

10

onset has a constant term and an additive change term. The unknown variance profile before the

onset is estimated as the average signal energy of the first M points of the signal. A sliding

window of fixed size W moves along the data and for every window’s position the parameters in

the after-change variance profile are estimated from the points within the window and log-

likelihood ratio test is set up based on the estimates. Detailed implementation of the algorithm is

available in Staude et. al., 1995, Staude et. al., 2001.

Model-based methods of detecting EMG movement-related events can be viewed as the

examples of application of parametric change-point analysis. A review of this type of analysis

and its common techniques is presented in the following Section 2.2.

2.2. Overview of Change-point Analysis Methods

In this section common change-point analysis methods are described.

2.2.1. Concepts, Definitions, Applications

Mathematical statistics methods are commonly used for data modeling and analysis. Most of

statistical analysis of data requires making an assumption that there is a unique probabilistic data

generation mechanism (DGM, also known as data generation process or DGP). However, in

complex systems frequently this mechanism can change in time or in phase space, therefore, it

may be necessary to properly analyze such data to subdivide it into the segments with different

DGM’s. The relatively new field of statistics, called statistical diagnosis, addresses the problem

of figuring out if there is more than one DGM that gives rise to the data. The main problem of

statistical diagnosis, investigated actively since 1950s, is a so-called change-point problem, a

task of detection of abrupt changes in the probabilistic characteristics of the data that happen at

the unknown instants (Brodsky et. al., 2000, Basseville et. al., 1993).

There are several classifications of statistical diagnosis problems. For example, there is

retrospective analysis of the data when the data is analyzed after the data collection was

complete, and there is sequential analysis when the data is analyzed as the data collection is

ongoing. There is also a classification based on the assumptions made about the data. There are

parametric methods of change-point detection in which a probabilistic model of the data

generation is known and is used to find the location of the change, There are also nonparametric

Page 21: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

11

methods which do not use any a priori information on the probabilistic structure of the data

(Brodsky et. al., 2000).

Change-point analysis has been applied to analyze the time series in different fields such as

process control (Page, 1954), climate studies (Vautard et. al., 1989), econometrics (Chen et. al.,

1997), EEG analysis (Cassidy, 2002; Kaplan et. al., 1999, Kaplan et. al., 2005) and

demographics (Denison et. al., 2001).

2.2.2. Methods of Change-point Analysis

A single change-point problem was defined by E.S. Page in mid 1950s (Page, 1954; Page

1955; Page 1957) who investigated the problem of quality control in a continuous production.

Page proposed a change-point problem formulation as follows: a sequence of observed random

variables x1, x2, …, xN has some change of parameter occurring at an unknown point m, and the

original value of parameter before the change is known to be θ. Page suggested computing

cumulative sums: ∑=

−=r

iir

xS1

)( θ , S0=0, and announcing a change when

hSSi

rir

≥−<≤

min0

, i.e. when the current cumulative sum exceed the minimum cumulative

sum by a specified amount h (Page, 1955). Since the work by Page other approaches for change-

point detection in independent random sequences were proposed: Bayesian approach by

Chernoff and Zacks (Chernoff et. al., 1964) and maximum likelihood test by Hinkley (Hinkley,

1971).

Taylor proposed a valuable method of change-point detection (Taylor, 2000). He proposed

the use of cumulative sum technique and bootstrapping. Cumulative sum (CUSUM) charts are

the same as those proposed by Page (Page, 1955) and Hinkley (Hinkley, 1971) where the mean

of the signal is used as the parameter. The bootstrapping procedure requires constructing

numerous (1000-10,000 or more) CUSUM charts using the reordered data. One can compute the

difference between the maximum and minimum of the CUSUM chart and use this number for

comparison of the chart based on original data to those based on reordered data. This difference

in the original chart should be bigger than that in 95% of rearranged data charts in order to be

significant. If it is indeed significant, then the change is declared where the maximum of the

absolute value of the original CUSUM chart occurs. After the change has been detected, the data

Page 22: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

12

can be broken up into two pieces before and after the change-point, and analysis can be repeated

to seek other change-points (Taylor, 2000).

The first nonparametric method of change-point detection was proposed by Bhattacharya

and Frierson (Bhattacharya et. al., 1981). They proposed a statistic similar to that of Bayesian

change-point detection by Chernoff and Zacks, but used ranks rather than values of observations.

Brodsky and Darkhovsky proposed the use of Kolmogorov-Smirnov statistics (Equation 1),

commonly used for checking the equality of distributions, for the detection of both single and

multiple change-points.

Equation 1: Kolmogorov-Smirnov detection statistic

−−

−= ∑∑

+==

N

nk

Nn

k

N

Nkx

nNkx

nN

n

N

nnY

11

)(1

)(1

1),(

δ

δ

for 10 ≤≤ δ , 11 −≤≤ Nn where xN is a diagnostic sequence for the signal, δ is a false

alarm probability. Diagnostic sequence is some sort of function computable from the original

random sequence to convert the problem into the detection of changes in mean value. The

diagnostic sequence is assumed to have the form of a step function of time and random noise.

The statistics YN is computed for the diagnostic sequence, and the maximum of its absolute value

is determined. If this maximum is greater than a threshold determined from the data, then the

location of this maximum is assumed to be a change-point. To search for more change-points, a

sequence can be subdivided into two segments before and after the found change-point, and the

process repeated on these pieces until no new change-points are located (Brodsky, et. al., 2000;

Brodsky et. al., 1999).

Some researchers presented methods of change-point analysis that depend on subspace

identification. Such methods have an advantage over the parametric methods that they do not

require any apriori parameterizations, therefore, one does not have to make any assumptions

about the probability distributions of the data. The main approaches are singular spectrum

analysis (SSA) based method (Goljandina et. al., 2001; Moskvina et. al., 2003) and state-space

model (SSM) based method (Kawahara et. al., 2007).

The SSM method is a more recent and more general approach to the problem of change-

point detection using subspace identification. It uses generic SSMs as the model for the time-

series, so it can handle more abundant types of time series data. SSM method assumes the signal

Page 23: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

13

y(t), t=1,2… to come from a linear state-space system:

+=

+=+

)()()(

)()()1(

twtCxty

tvtAxtx, where x is

a state vector, y is a system’s output, and v and w are the system and observation noises

respectively. The SSM-based method requires estimation of the column space of the extended

observability matrix [ ]TkTT

kCACACO )()( 1−= L from the signal’s reference

interval by numerical methods, including LQ decomposition of a matrix (decomposition into a

product of a lower-triangular matrix L and orthogonal matrix Q (Nicholson, 2003)), matrix

square root calculations, and singular value decomposition. Then a distance between the

subspace of this observability matrix and the Hankel matrix based on the test interval is

calculated, and its increase can serve as an indicator of change (Kawahara et. al., 2007). Its

disadvantage is the bulky computation and the need for recursive processing.

The SSA-based method is an older and more classical subspace identification algorithm.

Although it is less general than the SSM method, because it attempts fitting autoregressive model

to the segments of the time series, it involves simpler signal processing. SSA-based method

performs the principal component decomposition of the “trajectory” matrix based on the Takens’

embedding (Takens, 1981) of the original time series, and then analyzes the series using these

components. Unlike the SSM algorithm, only singular value decomposition of matrices is needed

to compute the approximation for a subspace. If the generating mechanism for the series changes

at some point, then there is an increase of a distance between the vectors of the trajectory matrix

based on the signal after the change-point and the components computed from the signal before

the change-point. This is a property that allows detecting the changes in the signal. (Goljandina

et. al., 2001; Moskvina et. al., 2003). The detailed explanation of SSA and SSA-based change-

point detection algorithms is presented in Section 2.3.

2.2.3. Review of Change-point Analysis Applications to Biological Signals

The techniques of change-point analysis are not yet frequently applied to the problems in

biology. However, several significant applications have already been established. One

application is the EEG segmentation (Wendling et. al., 1997; Brodsky et. al., 1999; Kaplan et.

al., 2005). Wendling et. al. analyzed the EEG segments recorded from patients with epilepsy in

an attempt to detect regions of stable neuronal activity during seizures and to compare different

Page 24: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

14

algorithms for signal segmentation. They applied two parametric CUSUM-based algorithms and

two nonparametric methods detecting frequency changes. They studied dependence of different

algorithms on type of change, performance on simulated and real signals and ability of the

algorithms to obtain the instant of change (Wendling et. al., 1997).

Kaplan’s group at Moscow State University used the change-point analysis to subdivide

EEG signals into stationary segments. They viewed each homogenous segment of the EEG

signal as a period of stable activity of some group of neurons; and the transitions from one

segment to another as the moments of the change in the electrical activity of this group of

neurons or switching to a different group (Brodsky et al. 1999). Kaplan et. al. used the change-

point detection technique developed by Brodsky and Darkhovsky, in which EEG signal’s power

was used as a diagnostic function. Kaplan et. al. successfully demonstrated the detection of

changes in EEG’s alpha band (7.5-12.5 Hz) in their early papers (Brodsky et. al., 1999, Kaplan

et. al., 2000). They also presented an approach to study the nonstationary nature of EEG signals

by means of segmentation of EEG signal into stationary pieces, characterizing them by their

properties and studying the coincidence level between switching moments among different

channels (Kaplan et. al., 2005).

Brown et. al. applied the change-point analysis to analyze changes in the spectra of signals

recorded from the subthalamic nuclei (STN) of patients with Parkinson’s disease (Cassidy et. al.,

2002). Oscillation model of the basal ganglia (a group of nuclei in the brain participating in

movement control) predicts that beta band (frequencies from 11-30 Hz) in the STN is antikinetic,

i.e., it opposes movement, while gamma band (>60Hz) is prokinetic, i.e., promotes movement

(Hutchison et. al., 2004; Brown, 2003). Therefore, this model suggests that the power of the

signal in the beta band will decrease due to movement, while the power of the signal in the

gamma band will increase due to movement. This is what Brown et. al. tested by means of

change-point analysis. They recorded the activity of the STN in selected patients who were

performing simple motor task after being prompted to do so by an external command. They

filtered STN recordings in beta and gamma bands and applied the detection method developed

by Taylor (Taylor, 2000) based on the CUSUMs and bootstrapping. They were able to show

successfully that movement causes the changes in the spectra. In particular, they detected

suppression of the power at 20Hz and increase of power at 70Hz during the time the patient was

moving.

Parametric methods of change-point detection, based on maximum-likelihood approach, were

applied by Staude and Wolf to EMG events detection and studies of motor control in humans

Page 25: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

15

(Staude et. al., 1995; Staude et. al., 1999). Their algorithms were briefly outlined in Subsection

2.1.3. While their study produced valuable detection methods, they were designed for the EMG

signals modeled as the white noise process with the time-varying mean serving as an input to an

autoregressive (AR) process with constant known coefficients, rather than the experimentally

recorded EMG signal. Secondly, because they used the parametric change-point detection

methods, they had to transform the simulated EMG signal into a sequence of “innovations” that

would reflect the deviations from the baseline signal due to muscle activation and would have a

Gaussian distribution, so that they could be used in a log-likelihood test. Thus, the adaptive

whitening filter had to be designed to compute the “innovations sequence” with the coefficients

depending on the simulated EMG signal’s AR parameters (Staude et. al., 2000). It, however, may

be a nontrivial task to compute these coefficients for a recorded signal. For this reason a

nonparametric change-point analysis method applicable to the EMG onset detection problem

would be an asset, since for a nonparametric method there are no assumptions about the

probability distribution of the signal being made.

2.3. Singular Spectrum Analysis (SSA) and Change-point Detection

In this section SSA signal processing approach and SSA-based change-point detection

method are discussed.

2.3.1. SSA Theory and Applications

SSA is a reasonably well-known signal processing technique. It was developed in the 1980s

by Broomhead and King (Broomhead et. al., 1986). Since then it has been applied to analyze

meteorological, climatic and geophysical time series (Vautard et. al., 1989; Vautard et. al.,

1992). The SSA algorithm described according to (Goljandina et. al., 2001) involves four main

steps:

1) Construction of the trajectory matrix by the Takens’ embedding of the original time

series with a desired lag (Takens, 1981). Let x1,x2,…xN be a time series, and choose lag

parameter M. Set K=N-M+1. Then the trajectory matrix is defined as Equation 2.

Page 26: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

16

Equation 2: Trajectory matrix for Singular Spectrum Analysis

=

+

+

NMM

K

K

xxx

xxx

xxx

X

L

MOMM

L

L

1

132

21

(Goljandina et. al., 2001; Moskvina, et. al.,

2003)

2) Computation of a Singular Value Decomposition (SVD) on the trajectory matrix. This

can be done directly, or by first computing the lag-covariance matrix R=X*XT and

determining its eigenvalues λi and eigenvectors Ui of R ( ],1[ Mi ∈ ). Then the principal

components vectors Vi, which correspond to the eigenvectors of the matrix XT*X, can be

computed as:

i

i

T

i

UXV

λ= . From λi, Ui and Vi one can compute the decomposition

X=X1+X2+…+XM, where T

iiiiVUX λ= (Goljandina et. al., 2001; Moskvina et. al.

2003).

3) Grouping of the components. One can select groups of components depending on the

signal processing task being performed, for example, for denoising, one can group the

components corresponding to the signal and components that correspond to noise.

4) Reconstruction of the signal based on selected components. According to the grouping,

one computes the matrix sum for groups of Xi (size M by K). Define M*=min (M, K) and

K*=max(M, K), x*ij=xij if M<K and x*ij=xij otherwise. Then the series g0, …, gN-1 can be

computed as Equation 3:

Equation 3: Reconstruction of Signal after SSA-decomposition into components.

<≤−

<≤−

−<≤+

=

+−

+−=

+−

=

+−

+

=

+−

NkforKxkN

KkforMxM

Mkforxk

g

KN

Kkm

mkm

M

m

mkm

k

m

mkm

k

*1

2

2,*

**

1

2,*

*

*1

1

2,*

*

*

*

1

11

101

1

(Goljandina et. al.)

This corresponds to averaging entries of Xi that are located on the diagonals i+j=const.

Page 27: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

17

Applications of SSA include, for example, denoising, detection or removal of the trends,

selection or exclusion of periodic components, as well as filtering, smoothing and forecasting

(approximating missing values) for the signals (Goljandina et. al., 2001).

The assumption of the SSA is that the time series, to which SSA is applied, can be well

approximated by linear recurrence formula (LRF), i.e. the series xt=zt+et where zt is a solution of

d-td1-t1tzazaz +…+= of order d with coefficients a1, .., ad and et is some noise that cannot

be well approximated by the finite-difference equations. The process zt has a form of Equation 4:

Equation 4: Form of the process, which can be well represented by linear recurrent formula

∑ +=k

kk

t

kttetz k )2sin()( φπωα µ

,

where αk(t) are polynomials in t, µk,ωk and φk are parameters. zt with up to M non-zero terms

should be a reasonable approximation of the signal to which SSA is applied. SSA does not

assume any parametric model or any structure, such as stationarity, instead it attempts to

generate this model from the signal. (Moskvina et. al., 2003).

2.3.2. Change-point Detection Algorithm Based on SSA

The algorithm to detect the change-points in the data using SSA was developed by Moskvina

and Zhigljavsky at Cardiff University, UK. The idea behind the algorithm is to apply SSA to a

windowed portion of the signal. SSA picks up a structure of the windowed portion of the signal

as an l-dimensional subspace.

If the signal structure does not change further along the signal, then the vectors of the

trajectory matrix further along will stay close to this subspace. However, if the structure changes

further along, it will not be well described by the computed subspace, and the distance of

trajectory matrix vectors to it will increase. This increase will signal the change.

The following is the description of mathematics involved in change-point detection

algorithm:

Let x1,x2,…xN are a time series, N is large. Choose window width m and the lag parameter M,

such that M≤m/2. Set K=m-M+1. Then for each n=0,1,…,N-m-M take an interval of time series

[n+1, n+m] and define the trajectory matrix Xn, size M by K (Equation 5)

Page 28: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

18

Equation 5: Equation of the trajectory matrix for SSA-based change-point detection.

=

++++

++++

+++

mnMnMn

Knnn

Knnn

n

xxx

xxx

xxx

X

L

MOMM

L

L

1

132

21

For each n=0,1,…N-m-M

1) Compute lag-covariance matrix (Equation 6)

Equation 6: Equation of the lag-covariance matrix for SSA-based change-point detection.

Rn=Xn*XnT

2) Determine M eigenvalues and eigenvectors of Rn and sort the eigenvalues in decreasing

order.

3) Compute the sum of eigenvalues and the percentage of this sum that each eigenvalue

contributes. The greater this percentage the more important is the component

corresponding to the eigenvalue.

4) Select the number of components to use for change-point detection.

For change-point analysis, it was found that it works best to select a group of components

that represent most of the signal. The number of components in this group is defined as L,

and the choice of L remains fixed for all the Xn computed from the signal.

5) One has to pick two parameters of test interval p and q (both greater than 0) and define a

test matrix T on an interval [n+p+1, n+q+M-1] (Equation 7)

Equation 7: Equation of the test matrix for SSA-based change-point detection.

=

−++++++++++

++++++++

+++++++

111

1432

321

MqnMpnMpnMpn

qnpnpnpn

qnpnpnpn

n

xxxx

xxxx

xxxx

T

L

MOMMM

L

L

The only requirement is that the interval defined by the choice of p and q allows forming

a test matrix that includes at least one column of signal values different from the

trajectory matrix columns.

6) Compute Dn(Tn) statistic, the sum of squared Euclidean distances between the vectors of

the test matrix T and L chosen eigenvectors of the lag-covariance matrix Rn (Equation 8).

Page 29: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

19

Equation 8: Equation for Dn statistic

( ) ( )( )∑+=

−=q

pj

n

j

TTn

j

n

j

Tn

jnTUUTTTD

1

)()()()(

where Tj(n)

are the vectors constituting the test matrix Tn, and U is a matrix consisting of

L eigenvectors of Rn. The increase of the value of this statistic signals that the change has

occurred.

The first way to estimate the change-point locations is to compute local minima of the

Dn(Tn) function preceding its large values.

7) To find precise locations of change-points an additional CUSUM statistic calculation is

needed. CUSUM statistic is computed for n=0…N-m-M (Equation 9):

Equation 9: Equation for CUSUM statistic.

( )[ ])(3/1,0max

,

11

00

pqMSSWW

SW

nnnn−−−+=

=

++

(Moskvina et. al., 2003, Moskvina, 2001),

where Sn= Dn/vn, vn is an estimator of the normalized sum of squared distances Dn at time

intervals, at which the hypothesis of no change can be accepted. vn is effectively a variance

of noise in the signal. (Moskvina et. al., 2003)

If Wn exceeds a threshold (Equation 10)

Equation 10: Equation of the threshold for changes in SSA-based change-point detection

)1)(*3(*3

2

)(1 2

MpqMMpqM

th −+−

−+= α

,

where tα is a (1-α) quantile of the standard normal distribution, then the change-point

estimate is a first point with non-zero value of Wn before reaching this threshold (Moskvina,

2001).

2.3.3. Why Choose the SSA-based Algorithm for this Study?

The SSA-based algorithm was selected as the candidate change-point detection method for

several reasons. Firstly, its implementation is rather straightforward since it is based on very

standard time-series analysis techniques such as embedding and singular value decomposition

commonly used in, for example, sensor array signal processing applications (Manolakis et. al.,

Page 30: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

20

2005). Fewer complicated matrix manipulations are needed than in the SSM algorithm, for

example, LQ factorizations (Nicholson, 2003) and matrix square root computations are not

required for the SSA-based algorithm. Secondly, Staude et. al. showed that LRF models are

reasonable to model EMG signals with (Staude et. al., 1999, 2000), thus, SSA should be able to

give good results when computing EMG signals structures for the segments of EMG signals

within the moving window of the SSA-based algorithm.

2.4. Summary of the Chapter

At the beginning of this chapter the review of commonly used EMG event detection methods

was presented. Several common threshold-based algorithms (Greeley, Hodges, Lidierth, Bonato,

and Abbink) and two model-based algorithms for muscle activation detection were briefly

outlined. The concept of wavelet-based denoising was also described. The second portion of this

chapter was devoted to change-point analysis. Firstly, the main concepts and definitions were

given, then common techniques were summarized and the singular spectrum analysis change-

point detection algorithm is presented in detail. Some existing applications of change-point

analysis to biological problems were introduced at the end of the chapter.

Page 31: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

21

Chapter 3: Objectives and Hypothesis

3.1. Objectives

The objective of the project was to investigate an application of the nonparametric change-

point detection method based on the subspace identification to the problem of finding the

movement-related events in raw EMG signals with different levels of baseline activity. The

comparison of such a method to two conventional threshold-based detection methods as well as

to visual event onset detection had to be performed. Wrist EMG signals with and without tremor

and trunk EMG signals were chosen for this application of change-point analysis.

The choice of wrist EMG with tremor and trunk EMG signals was made with the purpose of

giving a more challenging task to the algorithm. It was expected that the algorithm would

perform well with clean wrist EMG signals. More complicated signals were chosen for analysis

to better understand what the algorithm’s abilities are. Wrist EMG with tremor provided the

challenge of multiple large changes present in the signal and trunk EMG had much higher noise

levels than wrist signals and also contained multiple changes.

3.2. Hypothesis

The SSA-based algorithm computes the detection statistics which, if they exceed a certain

threshold, signal a significant change. However, it is likely that there will be multiple changes

detected in the signal. One possible way to decide which changes are most important is based on

the relative height of peaks corresponding to the changes in the detection statistics. The

hypothesis of the project to be tested was that the largest change in the EMG signal detected by

the SSA-based change-point detection algorithm corresponded closely to the movement-related

muscle activation.

Page 32: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

22

Chapter 4: Methods

In this chapter the overview of EMG data collection, detailed description of employed

algorithms, their MATLAB implementations and parameter selection will be described. Overall

signal processing set-up and subsequent detection results analysis will also be outlined.

4.1. Data Acquisition

In this section data acquisition experiments used to acquire EMG data are presented.

4.1.1. Wrist Extension Experiments

At the Toronto Western Hospital nine individuals with Parkinson’s disease were invited to

participate in wrist extension experiments during which EMG was recorded from extensor carpi

radialis muscles, using Meditrace surface electrodes, placed ~3cm apart over the skin overlying

these muscles. The ground electrode was placed on the bone, to the medial side of the wrist. The

location of electrodes is shown in Figure 1. Skin was prepared with alcohol wipes prior to

electrodes placement. The SynAmp amplifiers (NeuroScan Laboratories, USA) were used to

amplify raw EMG signals. The sampling rate of the data acquisition system was 1 kHz. EMG

filters were set at 30-500 Hz.

Page 33: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

23

Figure 1: Diagram showing electrodes locations for recording of EMG from extensor carpi radialis muscles.

Rectangle is the location for recording electrodes and circle is a place of reference electrode. Provided by Dr.

D. Sayenko, 2008.

Participants were seated in an armchair in front of a computer monitor. First the EMG

activity was recorded at rest for 1-2 minutes. Then participants were asked to perform wrist

extension tasks followed by passive wrist flexions (i.e., the hand dropped due to gravity after the

extension was completed) with one arm/hand. They were asked to perform two types of tasks:

• Internally triggered task (i.e., a participant decided when to initiate a movement) where

participants had to perform wrist extensions every 5-10s. The sequence of movements

was self-paced. Typical duration of internally triggered tasks was between 10 and 15

minutes.

• Externally triggered task (i.e., the task was initiated after a prompt was given) where

participants had to perform wrist extensions when the computer monitor flashed green.

The externally triggered tasks were recorded until about 40 wrist extensions were

performed (this took between 4 and 7 minutes).

Both externally and internally triggered tasks were first performed by the participants after

the overnight withdrawal of dopamine medication, then the usual dose of medication was

administered and both tasks were performed again (Paradiso et. al., 2003).

Page 34: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

24

4.1.2. Trunk Muscles Involved in Sitting

The EMG data from the trunk muscles was collected by Vivian Sin, a graduate student in

Rehabilitation Engineering Laboratory. The following description of the data acquisition is based

on Vivian’s M.A.Sc. thesis (Sin, 2007).

Thirteen healthy, able-bodied male subjects participated in the perturbed sitting study. They

were asked to sit on a special apparatus and to wear a custom-made harness. This harness,

approximately 12cm wide and 1.35m long, was made of canvas, with loops approximately every

3 cm apart, and secured by velcro and fasteners. External perturbations were applied manually in

different directions by a researcher using a rope in series with a force transducer to the harness.

Eight ropes of about 1m length were attached to the loops of the harness at equal intervals by

means of biners; force transducer could be connected by means of another set of biners to the

free ends of the desired ropes. The perturbation directions were labeled as 1 to 8, with direction 1

corresponding to the anterior direction, and incrementing clockwise by 45 degrees as shown in

Figure 2.

Figure 2: Directions of perturbation (Sin, 2007)

There were a total of 40 perturbation trials (8 directions, 5 times each). The perturbation trials

were given in random order such that the subject was not pulled consecutively in the same

direction to prevent fatigue and anticipation.

During each perturbation, surface EMG measurements were recorded using disposable silver-

silver chloride surface EMG electrodes with a diameter of 10mm and a distance of 18mm

between them. Each electrode was connected to a preamplifier before connecting to the Bortec

AMT-8 EMG system. The EMG system had a frequency response of 10 to 1000Hz for each

channel, and a common mode rejection ratio of 115dB at 60Hz. Two EMG systems were used

during the experiments for a total of 16 channels of EMG recording. The EMG signals were

sampled at 2 kHz.

Page 35: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

25

Surface electrodes were placed bilaterally on the skin above the following muscles: rectus

abdominis (RA) - 3cm lateral to umbilicus, aligned vertically; external obliques (EO) -

15cm lateral to umbilicus, aligned 45 degrees to the vertical, internal obliques (IO) – midway

between ASIS and symphasis pubis, above the inguinal ligament, aligned 45o to the vertical;

thoracic erector spinae (T9) – 5cm lateral to the T9 spinous process, aligned vertically; lumbar

erector spinae (L3) – 3cm lateral to L3 spinous process, aligned vertically; latissimus dorsi (LD)

– lateral to T9 spinous process, over the muscle belly; sternocleidomastoid (SM) – 1/3 the

distance from the sternal notch to the mastoid process at the distal end overlying the muscle

belly; and splenius capitis (SC) – over the C4-C5 level, aligned vertically. The reference ground

was placed over the clavicle. Figure 3 shows the locations of the surface EMG electrodes (Sin,

2007).

Figure 3: Front view (left) and back view (right) of the locations of EMG electrodes for trunk muscles EMG

recordings (Sin, 2007)

4.2. SSA-based Change-point Detection Algorithm Parameters Selection and

Implementation

4.2.1. Parameter Selection

Page 36: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

26

To run the change-point detection algorithm, a choice of five parameters had to be made: lag

parameter M, sliding window length m, the number of components used to perform change-point

detection L, and parameters p and q defining the test interval (and test matrix).

a) Selecting lag M and window size m: Tests with Gaussian noise

Lag M is a very important parameter, since it relates to the number of non-zero terms in the

LRF that SSA tries to compute from the signal, to pick up its structure. If the signal is highly

complex, then embedding it with a small lag will not allow obtaining enough components to

have an accurate representation of the signal (Goljandina et. al., 2001, Moskvina et. al., 2003).

The choice of lag is also associated with tuning to a particular signal’s frequency; however,

because a signal might not have some dominant frequency and instead may have time-varying

frequency having a fixed lag might not give suitable change-point detection results. On the other

hand, M cannot be picked to be too large due to the computational constraints, such as

computing the singular value decomposition for large matrices.

Another parameter is a window size. On one hand it should be big enough to allow capturing

enough of a signal structure to use for the change-point detection, on the other hand, if it is too

big then small changes in the signal may be undetected. If the window is too small, then signal

outlier values may be taken as characteristic of the signal, and thus many false change-points will

be detected (Moskvina et. al., 2003). The choice of lag M constraints partially the choice for the

window size m, since m has to be at least twice greater than M.

Several simple tests were done with the 10000 points-long random Gaussian noise signal

with mean 0 and variance 1. Change-point analysis functions have been run on this noise, with

the expectation to find no changes. Different selections of lag parameter were made and window

size was picked to be twice the lag. It was observed that picking a bigger lag (M=100), allows

the more accurate (although a very slow) detection of changes, while small lag (M=25) made the

detection statistic highly erratic, detecting many outliers as changes, while lag of M=50 seemed

like a reasonable trade-off between computation time and detection accuracy, although it made

several false detections. For this reason a value of M=50 and a corresponding value of m=100,

were chosen for the change-point detection in EMG signals. Results for the detection of change

in Gaussian noise are shown in the Figure 4.

Page 37: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

27

Gaussian Noise mean 0 var 1

-5

-4

-3

-2

-1

0

1

2

3

4

5

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000

n

(a)

CUSUM statistic M100 m200

-0.05

0

0.05

0.1

0.15

0.2

0.25

0.3

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000

n

(b)

CUSUM statistic M50 m100

-0.1

0

0.1

0.2

0.3

0.4

0.5

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000

n

(c)

CUSUM statistic M=25, m=50

-0.5

0

0.5

1

1.5

2

2.5

3

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000

n

(d) Figure 4: Test of effect of lag parameter on change-point detection in Gaussian noise (a) Gaussian noise,

10,000 points, mean 0, var 1, (b-d) Results of change-point detection with (b) lag M=100, m=200, (c) M=50,

m=100, (d) M=25, m=50. Blue line is detection statistic, pink line shows the threshold. Notably, plot (b) shows

less false changes detected than plots (c) and (d), thus showing increase of accuracy with lag parameter.

Page 38: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

28

b) Selection of the number of components L

If more components L are included in the change-point detection process then we take in

some noise in the change-point detection thus obscuring the changes, while if the number of

components used is not sufficient, then the relevant changes may actually be occurring in the

overlooked components. A reasonable approach to choosing L is taking the most important

components judging from their corresponding eigenvalues. There are a couple of possibilities.

Firstly, one can take components of the signal so that the sum of the eigenvalues of selected

components exceeds a certain amount of the total sum (say, 80% or 90%). Another way is taking

all components whose eigenvalues exceed 5% of the sum of eigenvalues. By performing the

SSA-based reconstructions of the signal from the components, it was observed that the

components whose eigenvalues were less than 5% of the sum’s value yielded noise-like time

series, rather than signal-related ones, therefore, they could be commonly ignored. This latter

approach was implemented.

Because there are N-m-M+1 matrices being evaluated, each of them may have a different

value of L based on the above criterion. To pick a single value of L, a couple of things can be

done. One possibility is to compute the values of L for all n and take the most frequently

occurring value. Another way is to take L based on a trajectory matrix at the beginning of the

signal, i.e. computed for n=0. This is reasonable because one can assume that there is no change

occurring at the very beginning of the signal. This is also consistent with an algorithm

description suggested in Moskvina Ph.D. thesis (Moskvina, 2001).

c) Selection of test interval parameters p and q

The parameters p and q define a part of the signal following the window from which the

trajectory matrix was constructed and possibly partially overlapping with this window. In

choosing the values for p and q, q should be slightly larger than p, but not too large, in which

case the detection statistics will smooth out the changes. The recommended values for p and q

are p=K=m-M+1, and q=m+1, so that the difference q-p equals to M, because in this way, the

test interval uses M-1 points from the trajectory matrix interval and M new points to construct M

test vectors. But q-p does not have to equal M and other choices of p and q can be reasonable, for

Page 39: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

29

example, (p,q)=(m,m+1) when M new points give only one test vector, or (p,q)=(m,m+M) when

2M-1 new points yield M test vectors (Moskvina et. al., 2003, Moskvina, 2001).

4.2.2. MATLAB Implementation

The algorithm for change-point detection described in Subsection 2.3.2 was implemented in

MATLAB software package (Mathworks Inc., USA). The code of this implementation is

attached in the Appendix A. The performance of the script has been compared against that of the

program ChangePoint created by the algorithm developers, which is available at

http://www.cf.ac.uk/maths/subsites/stats/changepoint/. The perfect match in the computation of

Dn statistic and a reasonable closeness in CUSUM statistics (peaks of the same shape detected at

the same positions in time, but having different overall magnitude) were achieved between

MATLAB implementation and algorithm authors’ program.

The steps 1, 3, 5, and 6 of the change-point detection algorithm in Subsection 2.3.2 were

implemented as described there.

Determination of L, the number of components to be used for decomposition labeled as step

4 of the algorithm, was actually performed prior to steps 1-3. The trajectory matrix X0 was

constructed and SSA-decomposed. L was defined as the number of components with eigenvalues

greater than 5% of the total sum of eigenvalues of the matrix X0X0T.

Actual SSA decomposition (step 2 of the algorithm) was implemented by means of the eig

command in MATLAB, which computes eigenvalues and eigenvectors of a square matrix. The

outputted eigenvalues are sorted in decreasing order and the outputted eigenvectors’ magnitudes

are equal to 1. Alternatively, an svd (singular value decomposition) command could be used

directly on the trajectory matrix Xn; this would produce matrices U and V, where U are the

eigenvectors of XXT and V are eigenvectors of X

TX, and the returned singular values are squares

of the eigenvalues. eig was preferred to svd because of the extra computation that svd involves

which was not needed for the purposes of change-point detection.

For the computation of the CUSUM statistic, it was recommended by algorithm authors to

use vn=Dk(Xk), where k is the largest value of j<n, so that the hypothesis of no change could be

accepted in the interval [j+1,j+m] (Moskvina, 2001). This, however, is somewhat ambiguous,

since we do not know precisely the part of the signal where the changes start occurring. We can

Page 40: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

30

only expect that there should be no change at the very start of the signal. To implement the

CUSUM statistic, the following vn formula was used (Equation 11):

Equation 11: Equation for vn used in MATLAB implementation of the change-point detection algorithm.

vn =Dn(Xn) for n<m/2 and vn=Dm/2(Xm/2) for n>m/2

This assumes that there is no change for n<m/2 (for the first half of the first window). This may

be a reasonable assumption for the application of EMG onset detection since there is always at

least a short rest period before the muscle activity changes. In addition to that on the webpage

http://www.cf.ac.uk/maths/stats/changepoint/ referred to in (Moskvina et. al., 2003) in the

description of the algorithm it was mentioned that changes are to be announced when CUSUM

statistic Wn exceeds the threshold for n>m/2. Alternative formulae could also be used to evaluate

vn (Equations 12 and 13):

Equation 12: Alternative formula for vn calculation

vn=Dn(Xn) for all n

(this was proposed in the ChangePoint software Help Menu, however, upon implementation, the

CUSUM statistics computed by the ChangePoint software and by MATLAB script did not

match),

Equation 13: Alternative formula for vn calculation

∑−−

=−=

12/

0

)(2/

1 mn

innn

TDmn

v for n >m/2 (Moskvina, 2001)

The threshold calculation for the change-point detection was done differently from the

formula given in the algorithm description. In the Help menu for the ChangePoint software, an

alternative formula was proposed (Equation 14):

Equation 14: Alternative equation of threshold for changes in SSA-based change-point detection

)2(

8

−−=

pqMh .

The threshold in the MATLAB implementation was programmed as such to facilitate

comparison of outputs of MATLAB script and the ChangePoint program. For the actual

application of SSA-based change-point detection to EMG onset determination, the computed

CUSUM statistics were processed without using the explicit thresholds to define the predicted

onset location (see Subsection 4.4.1 for details).

4.3. Processing Set-up

Page 41: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

31

This section describes how the change-point detection in the collected data was organized

and data analysis was performed.

4.3.1. Methods of EMG Movement-related Events Detection and Signal Pre-processing

The SSA-based change-point analysis method was applied to segments of EMG signals from

wrist extension muscles and trunk muscles. The datasets with the wrist EMG data were

subdivided into 6s or 6000 points long segments (sampling rate was 1kHz). Each of these

segments contained an EMG event. For the recordings of externally triggered activity, the

segments of signal were extracted from 3s before to 3s after the moment of the triggering.

Therefore, the actual muscle activation occurred between 3000 ms and 4000 ms in all segments.

For the internally triggered activity recordings, the crude onsets were computed first by applying

the Hodges and Bui algorithm for onsets detection in the entire recording, then 6s segments of

the signal were excised from 3.5s before the crude onset to 2.5 seconds after the crude onset.

This also ensures that the onset would occur between 3000 ms and 4000 ms in all segments. All

extracted wrist EMG segments were manually checked to ensure that there was no loss of EMG

signal, and that there was an increased activity due to movement, so that it made sense to

determine the movement onset in the segment. The datasets collected from the trunk muscles

involved in sitting were already subdivided into 4s or 8000 points long segments (sampling rate

was 2 kHz). The muscle activation event occurred about 1-1.5s after the start of many but not all

of these segments, because not all muscles had a reaction to perturbations in all directions. No

additional segmentation was required for these signals. Change-point detection method did not

require any additional processing of the signals prior to the application of the method.

The SSA-based method was applied as it was described in Section 4.2. However, instead of

computing the threshold and detecting the change-points in the final step, the algorithm stops at

computing the detection statistics Dn and CUSUM. The threshold for onset detection was not

used since it detects numerous small changes, most of which are not related to the movement

onset. Instead, a point was found where CUSUM statistic reached its maximum value, and then

one stepped backwards until the last value of CUSUM statistic preceding the maximum equaled

zero, which would be one of the change-points detected by the usual method with a threshold.

The onset was defined as the first (non-zero) point after the zero-valued point. The following

values of parameters were used: M=50, m=100, p=m-M+1=51, q=m+1=101, L depended on

Page 42: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

32

each particular segment (with the determination process described in Subsection 4.2.2, but

ranged between 1 and 8. The window length m=100 was also a reasonable choice since main

frequencies of the EMG signal are in the range 30 to 200 Hz, so their corresponding periods are

at least twice shorter than the chosen window length, and thus are not affected by the windowing.

Several other known methods of onset detection were applied to the same EMG signal

segments for the purposes of comparing them to the change-point detection results. Firstly, three

specialists in EMG processing were asked to visually estimate the locations of movement onsets

in the signals. They were provided with a small MATLAB script plotting rectified EMG

segments on the full screen one after the other and allowing them to input their estimate of

muscle activation events by selecting the proper location with a cursor and clicking on this

location in the plot with a mouse to record the estimate change in the EMG signal (attached in

Appendix B). Secondly, the event detection was attempted using the Hodges&Bui threshold-

based algorithm (Hodges et. al., 1996). Thirdly, the same threshold-based algorithm was applied

on the EMG signal which was previously denoised using wavelet decomposition with Haar

wavelets (Donoho, 1995; Sin, 2007). The implementations of these algorithms in MATLAB are

attached in Appendices C and D.

Before the application of some of these methods, some additional signals processing was

needed. For visual detection and for Hodges&Bui algorithm application signals had to be filtered

with 30-200Hz bandpass filter and then rectified. Kaiser window FIR filters were used, and they

were applied in a zero-phase filtering manner, using a filtfilt MATLAB command, to ensure that

there is no phase shift in the filtered signals. Filters were generated using the Filter Design and

Analysis tool of MATLAB. For the wavelet-based method, signals were first rectified, then

wavelet decomposed, denoised and reconstructed, and following these operations Hodges&Bui

method was applied to detect the onset in the reconstructed denoised signal. The details on the

applications of these methods are discussed in the Subsections 4.3.2 and 4.3.3.

4.3.2. Application of Hodges&Bui Method

The Hodges and Bui algorithm used a sliding window corresponding to 50 ms of data (for 1

kHz sampling rate the window had 50 points and for 2kHz sampling rate it had 100 points). This

window was moved along the rectified EMG signal one sample at a time and the mean of values

within this window was computed. If the mean of the values of the signal in this window

Page 43: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

33

exceeded the threshold, then the first point of the window was called the movement-related event

onset (Hodges et. al., 1996). The idea behind this windowing approach is to ensure that the EMG

activity was elevated over a sufficiently long time period, rather than just for a few samples, i.e.,

that it was associated with the muscle activity such as wrist extension.

To compute the threshold for the movement-related event detection for externally triggered

wrist movements, the section of the signal 500ms prior to the trigger event (i.e. between 2500

and 3000 ms of EMG segment) was subdivided into five 100ms portions. For each of these

portions a mean was computed and the median of five mean values was taken as the mean used

in the threshold computation. The standard deviation of the 100ms portion with the median mean

value was also used in this threshold calculation. The threshold was then defined as the mean

plus three standard deviations calculated above. The 50 ms window started from right after each

trigger event and was advanced by one sample for two seconds (2,000 samples) until the

movement-related event was found. After computing the movement-related event onsets, the

detected events were visually inspected to ensure that the calculated event locations were

reasonable.

For internally triggered wrist movements and trunk muscles a similar approach to the

threshold computation was used, except in the trunk EMG segments the region which was used

for threshold computation was between points 500 and 1500 (250 to 750 ms from the 4000ms

segment’s start) and in the internally triggered wrist EMG signals it was between 500 to 1000 ms

of the 6000ms segment. The 50ms window started sliding from the 1000ms time from the

beginning of the internally triggered wrist EMG segment and from the 750 ms time for the trunk

muscle EMG and was advanced by one sample until a movement-related event was found. After

the events were detected, they were visually checked to make sure that the calculated locations

made sense.

4.3.3. Application of Donoho’s Wavelet-based Denoising Method

The raw EMG signals were full-wave rectified. The first 500 milliseconds of each EMG data

were used to estimate the amount of noise in the signal. Each EMG signal was decomposed

using the Haar wavelets into 14 levels. The Haar wavelet is a function defined by Ψ(x) = Ф(2x) –

Ф(2x-1), where Ф(x) = 1, if 0 ≤ x < 1, and 0 elsewhere (Boggess et. al., 2001).

Page 44: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

34

Haar wavelets were chosen because they were the simplest to use. According to the

recommendations of Vivian Sin’s MASc thesis (Sin, 2007), fourteen decomposition levels were

selected because it was the smallest number in which there was no distortion in the reconstructed

signal. When the number of decomposition levels was less than fourteen, a visible shift in the

average of the reconstructed signal was observed in the regions without EMG activity (Sin,

2007). This was observed for both trunk EMG data and wrist extension data.

After the denoising, Hodges&Bui method was applied to the denoised signals in the same

manner as described above to obtain the EMG movement-related events onset estimates. After

these onsets were determined, they were visually inspected to make sure that the calculated

locations made sense.

4.3.4. Comparison of Onset Detection Methods.

Several methods of comparison were applied to the signals. Firstly, a simple manual check

of all the EMG segments showed if the EMG movement-related event was detected or not by the

given method in a given segment. Secondly, for those datasets for which the experts’ visual

event onsets estimates were collected, it was possible to verify if the estimates of event onset by

change-point detection and by other methods fall within range of the visual estimates and

calculate how close they were to visual estimates, i.e. to assess the “quality of detection”. To do

this, the average absolute differences between the visual and computer estimates were computed

for a set of segments. Then the sets of these differences for different algorithms were compared

statistically. Details on the specific types of analysis are given in the Chapter 5 of the thesis.

4.4. Summary of the Chapter

In this chapter, in Section 4.1., the two experiments in which the EMG data was collected for

the analysis were described: data from the wrist flexion muscles (Subsection 4.1.1) and data from

trunk muscles (Subsection 4.1.2) involved in sitting. In Section 4.2. approaches to choosing the

parameters for running the SSA-based change-point detection algorithm (Subsection 4.2.1) and

details of MATLAB implementation of the algorithm (Subsection 4.2.2) were explained. In

Section 4.3., EMG signal processing approach that was used to compare the change-point

detection with the other methods was proposed (Subsection 4.3.4.). The segmentation of EMG

Page 45: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

35

signals prior to change-point detection (Subsection 4.3.1) and the implementation of the

alternative methods for EMG event detection was described (Subsection 4.3.2 – 4.3.3).

Page 46: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

36

Chapter 5: Results

In this chapter the results of the EMG events detection will be presented.

5.1. Sample Event Detection in Wrist and Trunk Muscle EMG

The typical movement-related event onset detection in the wrist muscle EMG is shown in

Figure 5.

0 1000 2000 3000 4000 5000 6000-500

0

500

n (ms)

Original EMG signal

EMG

onset

0 1000 2000 3000 4000 5000 60000

2

4

6x 10

4

n (ms)

Dn statistic

Dn

onset

0 1000 2000 3000 4000 5000 60000

500

1000

n (ms)

Cumulative sum statistic

CUSUM

onset

Figure 5: Sample detection results for wrist muscle EMG (a) Original EMG signal, (b) Dn detection statistic,

(c) CUSUM detection statistic. Red circle marks the computed EMG movement-related event onset.

Both detection statistics show low values for the portion of the signal when there is no

change and a large increase in their values when a change occurs due to muscle activation. After

the increased muscle activity is over, the detection statistics fall off to the low values again. The

Page 47: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

37

event onset shown in the plots is computed from the CUSUM statistic. The time of the peak

value of this statistic for each EMG segment is taken and the first location where the statistic is

equal to zero preceding the peak time is searched for. This is the value defined as event onset.

The detection of movement-related event onsets in most of the analyzed wrist EMG segments

was reasonably clean, because wrist EMG has a fairly good SNR. Although the changes in the

baseline fluctuation are not ignored, which can be seen in the small peaks of the detection

statistics, overall they are significantly smaller than the change due to muscle activity increase

The sample movement-related event onset detection in a trunk muscle signal is shown in

Figure 6.

0 500 1000 1500 2000 2500 3000 3500 4000-0.1

-0.05

0

0.05

0.1

n (ms)

Original EMG signal

EMG

onset

0 500 1000 1500 2000 2500 3000 3500 40000

2

4

6x 10

-4

n (ms)

Dn statistic

Dn

onset

0 500 1000 1500 2000 2500 3000 3500 40000

10

20

30

n (ms)

Cumulative sum statistic

CUSUM

onset

Figure 6: Sample detection results for trunk muscles EMG (a) Original EMG signal, (b) Dn detection statistic,

(c) CUSUM detection statistic. Red circle marks the computed EMG onset.

Page 48: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

38

The change-point analysis statistics computed from the trunk muscles EMG produce many

more peaks than the corresponding statistics from wrist muscles. This is due to much noisier

nature of the recordings from the trunk muscles, which have lower SNR. As a result, the

misdetections of EMG events by change-point analysis, as well as cases when change-point

analysis cannot detect relevant change at all become more common.

5.2. Frequency of Successful EMG Movement-related Events Detection by

Different Methods in Wrist Muscles

Frequency of successful EMG event detection is assessed for every recorded file by counting

the number of detected onsets in the vicinity of the expected muscle activation time out of the

total number of segments in which detection was attempted. For the wrist EMG signals the

expected event location was between 3000 and 4000ms. In some cases there was some EMG

activity greater than the baseline level but smaller than the main muscle activation event, some

events were detected between 2800 and 3000 ms such detections were also counted as

successful. The calculated successful detection frequencies for wrist muscles are presented in

Table 1. Frequency of successful detection does not provide an indication of correctness or

precision of the estimates, but rather shows how often the detection is unsuccessful.

Table 1: Frequency of Successful Movement-related Event Detection in Wrist EMG for Different Computer

Methods. Filenames show the coded participant ID (i.e. AAA1) whether recording was off medication

(OFFMED) or on medication (ONMED), and whether the recorded task was internally (INT) or externally

(EXT) triggered.

File Name Change-point

Analysis

Hodges & Bui Denoising +

Hodges & Bui

AAA1 OFFMED1 EXT 100% (43/43) 100% (43/43) 100% (43/43)

AAA1 OFFMED2 EXT 100% (44/44) 95% (42/44) 91% (40/44)

AAA1 OFFMED INT 94% (44/47) 91% (43/47) 72% (34/47)

AAA1 ONMED1 EXT 94% (33/35) 94% (33/35) 91% (32/35)

AAA1 ONMED2 EXT 100% (38/38) 100% (38/38) 97% (37/38)

AAA2 OFFMED1 EXT 100% (35/35) 91% (32/35) 100% (35/35)

AAA2 OFFMED2 EXT 100% (37/37) 97% (36/37) 100% (37/37)

AAA2 OFFMED3 EXT 95% (21/22) 100% (22/22) 100% (22/22)

AAA2 OFFMED1 INT 100% (28/28) 96% (27/28) 96% (27/28)

AAA2 OFFMED2 INT 100% (39/39) 90% (35/39) 92% (36/39)

AAA3 OFFMED1 EXT 100% (43/43) 100% (43/43) 100% (43/43)

AAA3 OFFMED2 EXT 100% (44/44) 98% (43/44) 100% (44/44)

AAA3 ONMED1 EXT 100% (44/44) 100% (44/44) 100% (44/44)

AAA3 ONMED INT 99% (76/77) 99% (76/77) 65% (50/77)

Page 49: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

39

AAA4 OFFMED1 EXT 39% (17/44) 100% (44/44) 73% (32//44)

AAA4 OFFMED2 EXT 100% (44/44) 100% (44/44) 89% (39/44)

AAA4 OFFMED3 EXT 14% (6/44) 100% (44/44) 86% (38/44)

AAA4 OFFMED4 EXT 48% (21/44) 100% (44/44) 80% (35/44)

AAA4 OFFMED1 INT 31% (20/65) 98%(64/65) 0% (0/65)

AAA4 OFFMED2 INT 92% (101/110) 81% (89/110) 1% (1/110)

AAA5 ONMED1 EXT 100% (42/42) 100% (42/42) 100% (42/42)

AAA5 ONMED2 EXT 98% (41/42) 100% (42/42) 100% (42/42)

AAA5 ONMED INT 79% (61/77) 62% (48/77) 49%(38/77)

AAA6 OFFMED1 EXT 100% (40/40) 100% (40/40) 100% (40/40)

AAA6 OFFMED2 EXT 100% (35/35) 100% (35/35) 100% (35/35)

AAA6 OFFMED1 INT 100% (43/43) 100% (43/43) 79% (34/43)

AAA6 OFFMED2 INT 100% (47/47) 98% (46/47) 81% (38/47)

AAA6 ONMED1 EXT 100% (41/41) 100% (41/41) 100% (41/41)

AAA6 ONMED2 EXT 100% (42/42) 100% (42/42) 100% (42/42)

AAA6 ONMED1 INT 100% (92/92) 87% (80/92) 60% (55/92)

AAA7 OFFMED1 EXT 100% (38/38) 100% (38/38) 100% (38/38)

AAA7 OFFMED2 EXT 100% (24/24) 100% (24/24) 100% (24/24)

AAA7 OFFMED INT 99% (85/86) 88% (76/86) 77% (66/86)

AAA7 ONMED EXT 100% (37/37) 100% (37/37) 100% (37/37)

AAA7 ONMED INT 100% (69/69) 97% (67/69) 75% (52/69)

AAA8 OFFMED1 EXT 100% (33/33) 94% (31/33) 100% (33/33)

AAA8 OFFMED1 INT 100% (57/57) 100% (57/57) 95% (54/57)

AAA8 OFFMED2 INT 100% (31/31) 97% (30/31) 94% (29/31)

AAA8 ONMED1 EXT 100% (44/44) 98% (43/44) 98% (43/44)

AAA8 ONMED2 EXT 100% (44/44) 100% (44/44) 100% (44/44)

AAA8 ONMED1 INT 100% (36/36) 100% (36/36) 86% (31/36)

AAA8 ONMED2 INT 100% (37/37) 100% (37/37) 97% (36/37)

AAA9 OFFMED1 EXT 95% (37/39) 100% (39/39) 100% (39/39)

AAA9 OFFMED2 EXT 100% (20/20) 100% (20/20) 100% (20/20)

AAA9 OFFMED INT 95% (19/20) 95% (19/20) 50% (10/20)

AAA9 ONMED1 EXT 97% (34/35) 91% (32/35) 89% (31/35)

AAA9 ONMED2 EXT 96% (22/23) 96% (22/23) 96% (22/23)

AAA9 ONMED INT 100% (40/40) 90% (36/40) 33% (13/40)

Overall, the frequency of detection for the change-point method was comparable and often

higher than the detection frequency of the threshold-based methods. In most cases the frequency

of onset detection exceeded 90%. It is, however, notable that most of the recordings of the

participant AAA4 the onset detection frequency was rather low 14-48%. This is because

participant AAA4 had tremor, thus, the regular wrist muscles EMG was contaminated by tremor-

related spikes. Figure 7 shows the sample event detection in the EMG with tremor.

Page 50: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

40

Figure 7: Detection of movement-related event in EMG signal contaminated by tremor. Top plot shows the

original raw signal with tremor spikes to which change-point analysis is applied. Second plot shows the

filtered and rectified signal from which the Hodges-Bui estimate is computed, and which does not have

tremor spikes which were removed by filtering, thus providing the best estimate. Third plot shows the

wavelet-denoised signal from which wavelet-based estimate was obtained. Lowest plot shows the CUSUM

statistic with the changes detected both due to tremor spikes and due to movement-related muscle activation,

with the changes due to tremor influencing the change-point statistic stronger.

The top plot in Figure 7 shows the raw signal, where the muscle activation is between 3000

and 4000 ms, and other peaks are due to tremor. When the signal is filtered from 30 to 200 Hz

(second plot), these peaks are removed, thus in this case the direct application of Hodges & Bui

algorithm yields the best results. Denoising (third plot) does not eliminate the tremor-related

peaks, but Hodges & Bui algorithm applied to a denoised signal still makes an estimate in the

expected time range (at least between 3000 and 4000 ms). The change-point algorithm detects all

the changes promptly, both those due to tremor and due to movement onset, however, the

criterion that the change due to movement is the largest of these changes frequently fails. To

maximize the detection of EMG onsets in the signal with tremor, filtering may thus be

unavoidable.

Page 51: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

41

5.3. Frequency of Successful EMG Movement-related Events Detection by

Different Methods in Trunk Muscles

Computing the frequency of successful detection for the trunk muscles EMG is more

challenging since not all the trunk muscles contracted during the perturbed sitting. Therefore, the

frequency of onset detection was found only among the signals for which the presence of the

muscle activation event was confirmed with the assistance of visual detection experts. Because

of a large number of trunk muscle recordings (520 data files), the onset detection frequency was

only evaluated for the representative 16 data files collected from two experimental subjects for

which EMG muscle activation events onsets were visually estimated.

Table 2: Frequency of Successful Movement-related Event Detection in Trunk EMG for Different Computer

Methods. Filenames show the participant ID and directions of perturbation (middle digit of the numerical

code) according to Figure 2 from the Subsection 4.1.2.

File Name Change-point

Analysis

Hodges & Bui Denoising + Hodges & Bui

Subject 1 211 10/11 9/11 10/11

Subject 1 221 10/10 7/10 7/10

Subject 1 231 11/12 12/12 12/12

Subject 1 241 10/14 12/14 13/14

Subject 1 251 11/13 12/13 11/13

Subject 1 261 11/12 12/12 12/12

Subject 1 271 4/6 4/6 5/6

Subject 1 281 7/12 9/12 10/12

Subject 2 211 6/7 7/7 7/7

Subject 2 221 6/11 11/11 11/11

Subject 2 231 8/15 14/15 15/15

Subject 2 241 6/11 10/11 11/11

Subject 2 251 7/11 11/11 11/11

Subject 2 261 7/12 11/12 9/12

Subject 2 271 3/8 8/8 8/8

Subject 2 281 4/8 7/8 8/8

It is notable that although the onset detection for change-point analysis has been reasonably

consistent for Subject 1 recordings, the frequencies of detection for Subject 2 were rather low.

The nature of the problem was similar to the tremor case described in Section 5.2 there were

multiple changes in the signal segments, sometimes due to multiple muscle activations,

sometimes due to some additional events, such as EKG and crosstalk-related artefacts, and

artefacts due to poor electrode contact with the skin. Thus, the change-point detection statistic

Page 52: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

42

increase corresponding to the EMG movement-related event was in many cases smaller than

such an increase due to other activity. For example, in a noisy signal, extreme spikes due to

outlier values generate peaks in detection statistics, which can be bigger than the other changes

in the signal structure (Moskvina et. al., 2003). An example when a misdetection of event onset

occurred is shown in Figure 8.

Figure 8: An example of EMG event misdetection by the change-point analysis algorithm in trunk EMG. Top

plot shows the original signal from one of the trunk muscles. Second plot shows the filtered and rectified

signal from which the Hodges-Bui estimate is computed. Third plot shows the wavelet-denoised signal from

which wavelet-based estimate was obtained. Lowest plot shows the CUSUM statistic with multiple changes

detected in sequence with some of the later changes having bigger influence on the detection statistic than the

earlier ones, although earlier smaller changes are unanimously identified by visual estimators as the onset of

movement-related event.

In this case one can observe the increased activity of the muscle around 1500 ms from the

start of the data segment; this is evident in all the shown plots – on the raw, filtered and denoised

signals. In fact, the CUSUM statistic also shows its first large peak around this time as well. This

is a location selected by visual estimators as the EMG movement-related event onset. However,

one can also observe a larger activity around 2000ms from the start of the segment (again

reasonably visible on raw, filtered and denoised signals). This activity corresponds to the largest

Page 53: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

43

peak on the CUSUM statistic plot and it is thus selected as the EMG event onset by the change-

point detection algorithm, which disagrees with the visual estimates.

5.4. Quality of Movement-related Events Detection by Different Methods in

Wrist Muscles

For the datasets for which visual estimates of EMG movement-related events onsets were

collected it was possible to assess the quality of the computer methods’ onset calculations. This

was done to ensure that the change-point detection method is at least as accurate as the other

tested computer methods for the purpose of EMG event detection. The visual estimates of onsets

of EMG events in wrist muscles were made by 3 evaluators, trained in EMG signal processing,

for 9 datasets recorded from different individuals. In these datasets, the segments for which at

least one of the computer methods was not successful were removed from the quality calculation.

This allowed making sure that the quality of the computer methods is assessed over the same

segments.

To evaluate the quality of the estimates two methods were used. The first one is to compute

the average absolute differences between three visual estimates and each of the computer

estimates in all used segments. After that the average absolute differences within the same

dataset can be compared using statistical tests to verify if they are significantly bigger or smaller

depending on the chosen computer method. Normality of the distributions of the sets of average

absolute differences for computer methods was tested using Lilliefors test (MATLAB command

lillietest) for normality, and in many cases the tests showed that distributions of these differences

were not normal, thus regular parametric methods could not be applied. Therefore, to perform

the analysis of distributions of average absolute differences, the Kruskal-Wallis nonparametric

test was applied (MATLAB command kruskalwallis); it is the analog of the 1-way ANOVA for

cases when it is not known for sure that the random variables that are being tested have normal

distributions required for regular ANOVA (Wackerly et. al., 2002). Kruskal-Wallis test was

followed by multiple comparisons test (MATLAB command multcompare) which provided

information on whether the sets of average absolute differences for computer methods were

significantly different from each other pairwise. The summary of computer detection quality

measurement as average absolute differences between visual and computer estimates is shown in

Table 3. The plots of average absolute differences for different segments, Kruskal-Wallis /

ANOVA tables and plots of multiple comparison tests plots are presented in Appendix E.

Page 54: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

44

Table 3: Quality of Movement-related Events Onset Detection Assessed by Mean Ranks of Average Absolute

Differences between Visual Estimates and Computer Methods in Wrist EMG Signals (mean rank ± standard

error). Filenames show the coded participant ID (i.e. AAA1). All the recordings whose results are presented

in this table were externally triggered (EXT) and were recorded off medication (OFFMED) or on medication

(ON)

Mean Ranks ± Standard Error File Name

Change-point

Analysis

Hodges & Bui Denoising + Hodges

& Bui

AAA1 OFFMED1 EXT 50.4302 ± 5.7007 69.8372 ± 5.7007 74.7326 ± 5.7007

AAA2 OFFMED1 EXT 44.3750 ± 4.9242 67.5313 ± 4.9242 33.5938 ± 4.9242

AAA3 OFFMED1 EXT 69.1163 ± 5.7005 46.5814 ± 5.7005 79.3023 ± 5.7005

AAA4 OFFMED1 EXT 16.0000 ± 2.9150 11.5455 ± 2.9150 23.4545 ± 2.9150

AAA5 ONMED1 EXT 69.9881 ± 5.6345 56.7619 ± 5.6345 63.7500 ± 5.6345

AAA6 OFFMED1 EXT 59.9250 ± 5.4994 49.5000 ± 5.4994 72.0750 ± 5.4994

AAA7 OFFMED1 EXT 55.6447 ± 5.3615 48.0395 ± 5.3615 68.8158 ± 5.3615

AAA8 OFFMED1 EXT 34.9250 ± 3.9047 31.3750 ± 3.9047 25.2000 ± 3.9047

AAA9 OFFMED1 EXT 37.4189 ± 5.2913 68.0270 ± 5.2913 62.5541 ± 5.2913

The mean ranks in Table 3 show if the average absolute differences in visual and computer

estimates are significantly different for different computer methods. Smaller mean ranks

correspond to smaller detection error relative to visual estimates. It is notable that in three

datafiles analyzed in this way (AAA1 and AAA9) the change-point detection method was

superior to other methods, for six files it was not statistically different from other methods, and

for one file (AAA3), it was statistically inferior to one computer method and comparable to the

other one.

The second way to compute the detection quality is to compute how much the estimates by

the visual detection correlate with the results produced by the computer tests. This is achieved by

evaluating the Spearman rank coefficient (MATLAB corr command), which is a nonparametric

method to test for correlation between two ranked variables (Wackerly et. al., 2002). To apply

the method, the mean value of three visual estimates for each processed segment was computed.

Then the Spearman rank coefficient was evaluated between these means and the sets of estimates

for each of the computer algorithms. The bigger Spearman coefficient shows that two time series

between which it is evaluated are more closely correlated. The Spearman rank statistical test

computation was also performed verifying that the computed correlation was not equal to zero.

The smaller the p-value associated with this test, the more likely it is that the correlation between

the two tested sets is non-zero. The results of Spearman coefficients calculations are presented in

Table 4.

Page 55: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

45

Table 4: Quality of Movement-related Events Onset Detection Assessed by Spearman Rank Coefficients

between Visual Estimates and Computer Methods in Wrist EMG Signals. Filenames show the coded

participant ID (i.e. AAA1). All the recordings whose results are presented in this table were externally

triggered (EXT) and were recorded off medication (OFFMED) or on medication (ON)

Change-point

Analysis

Hodges & Bui Denoising + Hodges

& Bui

File Name

Spearman

Coeff.

p-value Spearman

Coeff.

p-value Spearman

Coeff.

p-value

AAA1 OFFMED1 EXT 0.7198 5.34e-08 0.6250 7.46e-06 0.2212 0.154

AAA2 OFFMED1 EXT 0.9592 5.21e-18 0.9465 2.82e-16 0.9709 3.47e-20

AAA3 OFFMED1 EXT 0.7005 1.70e-07 0.9092 3.39e-17 0.5700 6.61e-05

AAA4 OFFMED1 EXT 0.7062 0.0152 0.8242 0.00181 -0.1149 0.7365

AAA5 ONMED1 EXT 0.7586 5.88e-09 0.7512 9.93e-09 0.6733 1.03e-06

AAA6 OFFMED1 EXT 0.8957 6.06e-15 0.8875 2.34e-14 0.6204 1.95e-05

AAA7 OFFMED1 EXT 0.9505 7.42e-20 0.9800 7.93e-27 0.8995 1.65e-14

AAA8 OFFMED1 EXT 0.7424 1.78e-4 0.8605 1.13e-06 0.8060 1.98e-05

AAA9 OFFMED1 EXT 0.7698 2.55e-8 -0.2262 0.1782 0.3067 0.0648

Overall, according to Table 4, Spearman rank coefficient is showing similar assessment of

detection quality to average absolute differences comparison. For AAA1 and AAA9, the

correlations for the change-points analysis are the highest of the computer methods. For AAA2,

AAA3, AAA4 and AAA7, change-point analysis method has the second highest correlation

coefficient and for AAA8 – the lowest. These quality evaluations are consistent with the mean

ranks in Table 3, although the mean rank differences among the computer methods for most files

were not significant. For AAA6 and AAA5, the Spearman coefficient results and mean rank

results disagree, but perfect match was not expected since correlation and relative size of

discrepancies between visual and computer onsets are two fairly different quantities. However,

because there are no error bounds on the Spearman coefficients, the mean ranks comparison is a

more reliable method to assess the detection quality.

5.5. Quality of Movement-related Events Onset Detection by Different Methods

in Trunk Muscles

Quality of movement-related events onset detection in trunk EMG signals was assessed by

the same methods as those used in wrist EMG: computation of average absolute differences

between visual and computer estimates and correlation between visual and computer estimates.

The visual estimates of onsets of trunk muscle movement-related events were made by 3

Page 56: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

46

evaluators, experts in EMG signal processing, in 16 datasets recorded from two individuals. In

these datasets, the segments for which at least one of the computer methods was not successful

were removed from the quality calculation. Each particular data file had only 16 EMG segments,

and not all of these contained an activation of muscle. Besides that, not all computer methods

succeeded for all segments. Therefore, all EMG segments from 8 data files for each experiment

subject for which there were three visual and three computer onset estimates were combined for

the statistical analysis. Thus, there were a total of 64 EMG segments for Subject 1 and 42

segments for the Subject 2 that were used for the quality calculations. The results for mean ranks

comparison and Spearman coefficients are presented in Tables 5 and 6. The plots of average

absolute differences for different segments, Kruskal-Wallis / ANOVA tables and plots of

multiple comparison tests plots are presented in Appendix F.

Table 5: Quality of Movement-related Event Onset Detection Assessed by Mean Ranks of Average Absolute

Differences between Visual Estimates and Computer Methods in Trunk EMG Signals (mean rank ± standard

error)

Mean Ranks ± Standard Error Name

Change-point

Analysis

Hodges & Bui Denoising + Hodges &

Bui

Subject 1 95.9609 ± 6.9461 98.2188 ± 6.9461 95.3203 ± 6.9461

Subject 2 87.5000 ± 5.7008 53.5814 ± 5.7008 53.9186 ± 5.7008

Table 6: Quality of Movement-related Event Onset Detection Assessed by Spearman Rank Coefficients

between Visual Estimates and Computer Methods in Trunk EMG Signals

Change-point

Analysis

Hodges & Bui Denoising + Hodges &

Bui

Name

Spearman

Coeff.

p-value Spearman

Coeff.

p-value Spearman

Coeff.

p-value

Subject 1 0.7841 1.83e-14 0.8674 1.86e-20 0.9011 3.49e-24

Subject 2 0.6238 7.87e-06 0.6377 4.24e-06 0.7009 1.66e-07

The mean ranks for the change-point method for Subject 2 are significantly larger than those

for other computer methods, which means that it was less accurate than other methods. For

Subject 1, the differences in accuracies of computer methods are not statistically significant, thus

the change-point method is not inferior to other ones. Results of Spearman rank coefficients are

less conclusive since estimated coefficients are rather close to each other for all computer

methods.

5.6. Summary of the Chapter

Page 57: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

47

In Chapter 5 the results of EMG movement-related event detection techniques and their

comparison were presented. The sample detection statistic plots were shown in Section 5.2.

Sections 5.3 and 5.4 contained the results on the frequency of successful detection for different

computer algorithms for wrist and trunk muscles respectively. Overall, for wrist muscles EMG

the change-point method shows comparable, if not superior, success of event onsets detection,

except for the data files containing EMG with tremor, in which the changes in the signal due to

tremor contributed to larger increases of the detection statistics than the changes due to muscle

activation. However, it is inferior for trunk muscles due to noisier signal and larger number of

changes per signal segment, when some of the changes unrelated to movement onset have large

impact on the detection statistic. Sections 5.5 and 5.6 presented two ways to assess the detection

quality: by comparing the average absolute differences for computer methods using Kruskal-

Wallis test and multiple comparisons test and by computing the correlation between visual and

computer detection results using Spearman rank coefficients. Change-point analysis method

shows comparable quality of onset detection to other computer methods for wrist data, and for

the data from one of the trunk recordings subject, however, for the other trunk experiment

subject, whose data is analyzed, the quality of change-point based detection was inferior. The

results of frequency and quality of detection are summarized in Tables 1-6.

Page 58: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

48

Chapter 6: Discussion

In this chapter, relevant issues related to the change-point detection application to EMG

movement-related events onset detection, and its results will be discussed.

6.1. Benefits of Change-point Detection in the EMG Processing Application

Change-point analysis allows the detection of multiple changes in signals’ statistical

properties. The advantage of the technique is that it is applicable to raw signals, which do not

need to be rectified and filtered. SSA-based change-point detection procedure automatically

denoises the signal, which is very important for EMG signals whose recording is frequently

noisy. This effect is achieved because when the signal is decomposed by SSA into components,

those that represent noise can be eliminated from the computation of detection statistics.

Similarly, the SSA procedure can allow removing periodic components from the change-point

calculations or on the contrary to extract them and detect changes in these components.

Fluctuation of the baseline level does not strongly affect the detection. Another advantage of the

technique is that it can work with fairly short signal segments. This is valuable because

frequently the pieces of signal that correspond to a movement phenomena are short, and might

not contain enough points for more advanced computational techniques. It was shown in this

thesis that for wrist EMG muscles, the events onsets determined as the biggest changes shown by

change-point analysis shows detection frequency and accuracy comparable to the threshold-

based methods without or with denoising, which is shown in the results of Sections 5.3 and 5.5.

For the trunk muscle more visual estimates are needed to be able to judge on the accuracy and

detection frequency of change-point method better, but for one of the two individuals for which

the visual estimates were obtained, accuracy and detection frequency were comparable with

other methods.

Change-point analysis can also be used for retrospective analysis of the data and for real-time

applications. When analysing EMG signals from multiple muscles recorded simultaneously

which may or may not have clear muscle activations, one can study the relative times of changes,

as well as the synchronicity of the changes, i.e. if certain muscles are activated or deactivated at

the same time.

Page 59: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

49

6.2. Limitations of the Change-point Detection in the EMG Processing

Application

First important drawback of change-point detection when applied to EMG processing is the

inability to recognize the movement-related event onset among the multiple changes present in

the signal which may or may not be related to muscle activation. Although many changes are

being detected in the same processing run, it is the easiest to determine the onset when one

change is significantly bigger than the others – in this case this dominant change corresponds to

the increase of muscle activity. This was the case in most of the wrist muscle EMG segments.

However, in the wrist EMG with tremor and in trunk EMG there were many changes causing

similar increases of the detection statistics. The largest change did not correspond to the

movement-related event in many cases, so the hypothesis proposed in Section 3.2 did not hold.

For example, in the EMG with tremor, the peaks of the detection statistic due to tremor were

comparable in height and frequently higher than those due to increased muscle activity, as shown

in Figure 7, Section 5.3. In the case of tremor, one could filter the signal for the purpose of

removing the tremor peaks, but the purpose of the change-point analysis application was to test

its ability to process the raw signals. In the trunk muscles EMG signals there were either multiple

small activations of muscle in a sequence, or multiple activations at different times of the

recording, so in many cases the first observed significant change which corresponded to the

EMG event onset detected by the visual estimators was in many cases not the largest of the

changes which was selected as the event onset by the change-point analysis algorithm. The

example of this is shown in Figure 8, Section 5.4. Unfortunately, the change-point detection does

not give the tools to classify the changes by origin; it only finds locations in time where the

changes happened. Therefore, in order to make sure that onset locations were meaningful it is

necessary to manually check the data segments to ensure that the computed onsets fall in the

vicinity of the expected positions.

One has to acknowledge that the method applied in this study to determine the accuracy of

the detection was not the most optimal. Since real recorded EMG signals were used, true EMG

event onsets were not known before the application of detection methods. There was no

kinematic data to be able to define precisely when movement occurred. Visual estimates were

subjective; the results of such EMG event detection depended on the estimators’ experience, and

the amount of time they spent per signal segment. In addition to that, different EMG segments

recorded from the same person under the same conditions may contain individual features that

Page 60: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

50

could be interpreted differently by observers, which may have affected the onset detection, for

example, a small activity increase (compared to the baseline) preceding the increase,

corresponding to actual movement onset. The more objective way to study the accuracy of

different computer techniques is to use modeled EMG signals in which the location of

movement-related event onset is precisely controlled. For example, a useful modeling approach

was proposed by Staude et. al. using the autoregressive model through which white noise with a

time-varying variance is passed through, and the variance changes from the inactive level to

active one at the time controlled by the experimenter (Staude et. al., 2001). While the modeling

overall would allow estimating the accuracy better, the particular approach proposed by Staude

et. al. may give some advantage to the change-point method, because SSA should be able to

calculate a precise fit to the EMG modeled as an autoregressive signal with finite number of

terms (Moskvina et. al., 2003). An alternative would be to repeat the EMG recordings with some

concurrent kinematic measurement, for example, to use the goniometer to record the joint angle

during wrist extension movements or the accelerometer to record the trunk behaviour due to

perturbations in different directions. Then there would be some fixed time difference between the

onset of kinematic movement measurement and the onset of EMG movement related-event for

the same muscle in the same subject, as suggested, for example, by (David, 2003), which would

help making the assessment of quality of EMG event detection more objective, and eliminate the

need of visual detection for comparison of algorithms. This would also allow comparing the

accuracy of computer method to that of visual detection method.

There is another problem with assessment of quality in the way presented in Chapter 5. Two

methods were presented, both using nonparametric statistical tests. Mean ranks of differences

essentially tell how close (distance) the computer estimates are to visual ones; lower mean ranks

meaning higher “quality”. Spearman rank coefficients provide the measure of correlation

between visual and computer onsets; higher coefficient showing higher “quality”. However,

these two measures do not assess the same thing. It is, for example, possible to have the values

computed by the algorithm to be close to visual estimates (i.e., have lower mean ranks), but not

to correlate well with the visual estimates (have low Spearman coefficient and high p-value in

the test for non-zero correlation). The discrepancy of this sort was indeed observed for AAA5

and AAA6 in Tables 3 and 4 in Section 5.5, where the mean rank was showing higher quality,

while Spearman coefficient showed lower one. Mean ranks have error bounds accompanying

them, so they may be a more reliable way to assess quality of detection than the rank

coefficients.

Page 61: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

51

6.3. Issues Worthy of Further Investigation

In the described change-point detection experiment, the effects of parameters of the algorithm

on the frequency and accuracy of change-point detection were not investigated. No precise

tuning was attempted in this experiment. Instead, the objective was to try out utility of change-

point analysis to EMG movement-related events detection. All parameters were selected rather

crudely. Selection of the lag parameter equal to 50 meant that an attempt of constructing the

model of the signal with 50 components, which was believed to be a sufficient (and perhaps

superfluous) approximation of the order of the EMG signal, and was not interfering with the

main frequencies 30-200 Hz of the EMG. Other parameters were selected essentially depending

on the choice of the lag parameter (described in Subsection 4.3.1). However, other approaches to

parameter choice were possible. One possibility is a more precise determination of suitable lag

parameter. This is particularly important because the method involves fairly bulky computations

with matrices and when these matrices are big, the algorithm works slowly. This is relevant, for

example, when change-point analysis is used for change detection in real time, so speeding up

the calculations is desirable, while maintaining a reasonable accuracy. Another issue is to

investigate the number of components used for the calculation of the detection statistics. In the

present implementation, the number of these components changed for every data segment to

include all components whose eigenvalues exceed 5% of the total sum of eigenvalues. Instead it

may be useful to investigate keeping this number of components fixed at some reasonable value,

say 5-10, to ensure that at least a certain number of components were used to compute detection

statistics for all segments. Other parameters tuning can also be investigated. For example, by

increasing a window length m to values larger than twice the lag parameter some small changes

could be smoothed out, highlighting the larger ones.

It is also useful to look for better ways to identify the onset from the change-point detection

statistics. These can include some thresholds for the increase of the statistics from the baseline

level, or perhaps finding a region of the statistic where several significant changes occur in

succession. Another possibility is to check for how long the CUSUM statistic stays above zero or

above some threshold for different peaks. In the wrist EMG the duration of the common muscle

activation due to movement is about 500 – 600ms (see Figure 5 in Section 5.1 and Figure 7 in

Section 5.2) while spikes due to tremor last for about 100-200ms (see Figure 7, Section 5.2.),

Page 62: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

52

such a time parameter may provide a better way to tell from the detection statistic which change

actually corresponds to the movement onset, than just using the point, from which the highest

peak originated.

Another interesting investigation is an application of a different change-point detection

technique also based on subspace identification for comparison with SSA-based algorithm and

other methods. This is the SSM method (Kawahara et. al., 2007), mentioned in Subsection 2.2.2.

It may be able to identify the signal structure better than SSA because it is more general than

SSA method, and may be more consistent in identifying the movement-related EMG event as the

main change present in the signal. Besides that, it may be worthwhile to consider some

combination of methods, for example, application of threshold-based detection to the CUSUM or

even Dn statistic.

6.4. Summary of the Chapter

In this chapter, relevant issues and concerns raised by the observed onset detection results

using change-point detection were discussed. In Section 6.1 the possible benefits of the change-

point analysis were discussed, including processing raw EMG signals without filtering,

denoising and rectification, and applications, for example, studying the synchronicity of muscle

activations. In Section 6.2, limitations of change-point detection and of the described EMG

application experiment are mentioned. In this section, the problem that the largest change does

not always correspond to movement onset was discussed. Other limitations included the use of

raw data with visual onset estimates to study accuracy of computer methods, lack of kinematic

data to be able to objectively define the movement onsets and potential disagreement of two

ways to assess the quality of the detection. In Section 6.3 some issues related to improving the

algorithm performance were listed. In particular, these include investigating the fine-tuning of

the algorithm parameters to improve speed and accuracy, and studying different decision rules

based on the detection statistics that could tell which detected change actually corresponds to

EMG onset. The possibility of using alternative detection methods is also mentioned.

Page 63: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

53

Chapter 7: Conclusion and Future Work

The application of subspace identification based method of change-point analysis to EMG

signals was presented. The algorithm for analysis was described in Moskvina et. al., 2003. It

involved performing a singular spectrum decomposition of the trajectory matrix formed from the

signal preceding a hypothetical change-point into principal components. Then the distance is

computed between the most important components of this trajectory matrix and the columns of

the test matrix, formed from the signal after the hypothetical change-point. If there was a big

increase in the values of this distance, it meant that a change occurred.

The change-point algorithm was applied to detect the onsets of the EMG movement-related

events in signals recorded from the wrist and trunk muscles along with two other computer-based

methods: regular Hodges&Bui algorithm (Hodges et. al., 1996) and Hodges&Bui algorithm

preceded by Donoho’s denoising (Donoho, 1995). Also visual estimates were obtained from

three people trained in EMG signal processing. In terms of change-point analysis, the onsets

were defined as the point at which the increase of the detection statistic started that led to

reaching its maximum value. The frequencies of successful onset detection were computed for

three computer algorithms. Also the quality of detection was measured by computing average

absolute differences between computer and visual estimates and comparing these differences

using Kruskal-Wallis nonparametric test. In addition to that, the Spearman rank coefficients were

computed between the visual and computed onsets to see which computer method produces the

estimates

It was found that for most of the wrist EMG data the change-point analysis method is

comparable and often superior to the other computer methods investigated both in terms of

detection frequency and quality. However, for the trunk muscles EMG and for wrist EMG with

tremor, the change-point analysis did not perform as well as the threshold-based methods,

primarily because the largest detected change in these signals did not necessarily correspond to

the movement onset

Change-point analysis based on SSA may find other applications in the processing of

biological signals. Besides analysis of EMG signals, the detection of changes in heart rate

(described in Warrick et. al., 2007) or in the EEG and deep brain recording may constitute

valuable uses for this technique. Investigation of the parametric settings to improve algorithms

speed and accuracy as well as the development of some decision-making techniques using the

Page 64: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

54

computed detection statistics (like establishing better thresholds for changes) should make the

SSA-based change-point detection technique well suitable for retrospective and real-time

biological signal processing applications.

Page 65: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

55

References

Abbink, J.H., van der Bilt, A., van der Glas, H.W. Detection of onset and termination of muscle

activity in surface electromyograms. Journal of Oral Rehabilitation, vol. 25, pp. 365-369, 1998.

Adams, R.P., MacKay, D.J.C. Bayesian online changepoint detection. arXiv:0710.3742v1

[stat.ML] (Machine Learning) 19 Oct 2007

Allison, G.T. Trunk muscle onset detection technique for EMG signals with ECG artifact.

Journal of Electromyography and Kinesiology, vol. 13 pp. 209-216, 2003.

Basseville, M., Nikiforov, I.V. Detection of Abrupt Changes: Theory and Applications. Prentice

Hall, New Jersey, 1993.

Boggess, A. and Narcowich, F.G. A first course in wavelets with Fourier analysis. Prentice Hall,

2001.

Bonato, P., D’Alessio, T., Knaflitz, M. A statistical method for the measurement of muscle

activation intervals from surface myoelectric signal during gate. IEEE Transactions in

Biomedical Engineering, vol. 45, pp. 287-298, 1998.

Brodsky B.E., Darkhovsky, B.S., Kaplan A.Ya., Shishkin S.L. A nonparametric method for the

segmentation of the EEG. Computer Methods and Programs in Biomedicine, vol. 60, pp. 93-

106, 1999.

Brodsky, B.E., Darkhovsky, B.S. Nonparametric Statistical Diagnosis: Problems and Methods.

Kluwer Academic Publishers, Dordrecht, the Netherlands, 2000.

Broomhead, D.S., King, G.P. Extracting qualitative dynamics from experimental data. Physica

D, vol. 20, pp. 217-236, 1986.

Brown, P. Oscillatory nature of human basal ganglia activity: relationship to the pathophysiology

of Parkinson’s disease. Movement Disorders, vol. 18, No. 4, pp. 357-363, 2003.

Cassidy, M., Mazzone, P., Oliviero, A., Insola, A., Tonali, P., Di Lazzaro, V., Brown, P.

Movement-related changes in synchronization in the human basal ganglia. Brain, vol. 125, pp.

1235-1246, 2002.

Chen, J., Gupta, A.K. testing and locating variance changepoints with application to stock prices.

Journal of the American Statistical Association, vol. 92, pp. 739-747, 1997.

Chernoff, H., Zacks, S. Estimating the current mean of a normal distribution which is subject to

changes in time. Annals of mathematical statistics, vol. 35, pp. 999-1028, 1964.

Clancy, E.A., Morin, E.L., Merletti, R. Sampling, noise reduction and amplitude estimation

issues in surface electromyography. Journal of Electromyography and Kinesiology, vol. 12, pp.

1-16, 2002.

Page 66: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

56

Cooper, R., Binnie, C., Billings, R. Techniques in Clinical Neurophysiology: A Practical

Manual. Elsevier, 2005.

David, G. EMG and strength correlates of selected shoulder muscles during rotations of the

glenohumeral joint. Clinical Biomechanics, vol. 15, no. 2, pp. 95-102, 2003.

De Luca, C.J. Physiology and Mathematics of Myoelectric Signals. IEEE Transactions on

Biomedical Engineering, vol. 26, no. 6, pp. 313-325, 1979.

Denison, D., Holmes, C. Bayesian partitioning for estimating disease risk. Biometrics, vol. 57,

No. 1, pp. 143-149, 2001.

Donoho, D.L. Denoising by Soft-Thresholding. IEEE Transactions on Information Theory, vol.

41, No. 3, pp. 613-627, 1995.

Ethier, C.R., Simmons, C.A. Introductory Biomechanics: From Cells to Organisms. 1st edition.

Cambridge University Press, 2007.

Farina, D., Merletti, R., Enoka, R.M. The extraction of neural strategies from the surface EMG.

Journal of Applied Physiology, vol.96, pp. 1486-1495, 2004.

Felici, F. Applications in Exercise Physiology, pp. 365-380, in Electromyography: Physiology,

Engineering, and Noninvasive Applications (R. Merletti, P.A. Parker, editors). IEEE Press Series

in Biomedical Engineering, 2004.

Goljandina, N., Nekrutkin, V., Zhigljavsky, A. Analysis of Time Series Structure: SSA and

related techniques. London: Chapman and Hall, 2001.

Greeley, H.P. Real-time detection of precise EMG onset for synchronization of an EEG

averager. Clinical Physics and Physiological Measurement, vol. 5, pp.13-19, 1984.

Guiton, A.C., Hall, J.E. Textbook of Medical Physiology. 10th

edition. Saunders, 2000.

Hagg, G.M., Melin, B., Kadefors, R. Applications in eronomics, pp. 343-364 in

Electromyography: Physiology, Engineering, and Noninvasive Applications (R. Merletti, P.A.

Parker, editors). IEEE Press Series in Biomedical Engineering, 2004.

Hinkley, D.V. Inference about the change-point from cumulative sum tests. Biometrika, vol. 58,

pp. 509-523, 1971.

Hodges, P.W., Bui, B.H. A comparison of computer-based methods for the determination of

onset of muscle contraction using electromyography. Electroencephalography and Clinical

Neurophysiology, vol. 101, pp. 511-519, 1996.

Hodges P.W., Cresswell, A.G., Thorstensson, A. Perturbed upper limb movements cause short-

latency postural responses in trunk muscles. Experimental Brain Research, vol. 138, pp. 243-250,

2001.

Page 67: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

57

Hutchison, W.D., Dostrovsky, J.O., Walters, J.R., Courtemanche, R., Boraud, T., Goldberg, J.,

Brown, P. Neuronal oscillations in the basal ganglia and movement disorders: evidence from

whole animal and human recordings. Journal of Neuroscience, vol. 24, pp. 9240-9243, 2004.

Kamen, G., Caldwell, G.E. Physiology and Interpretation of the Electromyogram. Journal of

Clinical Neurophysiology, vol. 13, pp. 366-384, 1996.

Kaplan, A.Ya., Shishkin, S.L. Application of the change-point analysis to the investigation of the

brain's electrical activity, pp. 333-388 in Nonparametric Statistical Diagnosis: Problems and

Methods (B.E.Brodsky, B.S.Darkhovsky, editors). Kluwer Academic Publishers, Dordrecht, the

Netherlands, 2000.

Kaplan, A.Ya., Fingelkurts, An.A., Fingerkurts, Al.A., Borisov, S.V., Darkhovsky, B.S.

Nonstationary nature of the brain activity as revealed by EEG/MEG: Methodological, practical,

and conceptual challenges. Signal Processing, vol. 85, pp. 2190-2212, 2005.

Kawahara, Y., Yairi, T., Machida, K. Change-point detection in time-series data based on

subspace identififcation. Seventh IEEE International Conference on Data Mining, 2007.

Koyanagi, M; Shino, K; Yoshimoto, Y; Inoue, S; Sato, M; Nakata, K. Effects of changes in

skiing posture on the kinetics of the knee joint. Knee Surgery Sports Traumatology Arthroscopy,

vol. 14, no.1, pp.88-93, 2006.

Krishnamoorthy, V., Latash, M.L., Scholz, J.P., Zatsiorsky, V. Muscle synergies during shifts of

the center of pressure by standing persons. Experimental Brain Research, vol. 152, no. 3, pp. 281

- 292, 2003

Lidierth, M. A computer based method for automated measurement of the periods of muscular

activity from an EMG and its application to locomotor EMGs. Electroencephalography and

Clinical Neurophysiology, vol. 64, pp. 378-380, 1986.

Manolakis, D., Ingle, V., Kogon, S. Statistical and adaptive signal processing, Artech House,

2005.

MATLAB Help version 7.6. Mathworks Inc., Natick, MA, USA, 2008.

McMulkin, M.L., Woldstad, J.C., Hughes, R.E. Torso loading via a harness method activates

trunk muscles less than a hand loading method. Journal of Biomechanics, vol. 31, pp.391-395,

1998.

Merletti, R., Rainoldi, A., Farina, D. Surface Electromyography for noninvasive characterization

of muscle. Exercise & Sport Sciences Reviews, vol. 29, pp. 20-25, 2001.

Mirka, G. The quantification of EMG normalization error. Ergonomics, vol. 34, pp. 343-352,

1991.

Morey-Klapsing, G., Arampatzis, A., Bruggeman, G.P. Choosing EMG parameters: comparison

of different onset determination algorithms and EMG integrals in a joint stability study. Clinical

Biomechanics, vol. 19, pp.196-201, 2004.

Page 68: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

58

Moskvina, V. Application of the singular spectrum analysis for change-point detection in time

series. PhD Thesis, Cardiff University, UK, 2001

Moskvina, V., Zhigljavsky, A. ChangePoint Software Help Menu. Software available online

before March 2008 at http://www.cf.ac.uk/maths/stats/changepoint/

Moskvina, V., Zhigljavsky, A. An algorithm based on singular spectrum analysis for change-

point detection. Communication in Statistics: Simulation and Computation, vol. 32, No. 2, pp.

319-352, 2003.

Nicholson, W.K. Linear Algebra with Applications, 4th

edition. McGraw-Hill Ryerson, 2003.

Page, E.S. Continuous inspection schemes. Biometrika, vol. 1, pp. 100-115, 1954.

Page, E.S. A test for a change in a parameter occuring at an unknown point. Biometrika, vol. 42,

pp. 523-526, 1955.

Page, E.S. On problem in which a change in a parameter occurs at an unknown point.

Biometrika, vol. 44, pp. 248-252, 1957.

Paradiso, G. Saint-Cyr, J.A., Lozano, A.M., Lang, A.E., Chen, R. Involvement of the human

subthalamic nucleus in movement preparation. Neurology, vol. 61, pp.1538-1545, 2003.

Park, S; Miyakawa, S; Shiraki, H. EMG analysis of upper extremity muscles during isokinetic

testing of the shoulder joint. Japanese Journal of Physical Fitness and Sports Medicine, vol. 57,

no.1, pp. 101-109, 2008.

Parker, P.A., Englehart, K.B., Hudgins, B.S. Control of powered upper limb prostheses, pp. 453-

475, in Electromyography: Physiology, Engineering, and Noninvasive Applications (R. Merletti,

P.A. Parker, editors). IEEE Press Series in Biomedical Engineering, 2004.

Pearson, S. J., Young, A., Macaluso, A., Devito, G., Nimmo, M.A., Cobbold, M., Harridge, S. D.

R. Muscle function in elite master weightlifters. Medicine and Science in Sports and Exercise,

vol. 34, no. 7, pp. 1199-206, 2002

Popovic, M. Personal communication (e-mail). July 3rd

, 2008.

Potvin, J.R., Brown, S.H.M. Less is more: high pass filtering, to remove up to 99% of the surface

EMG signal power, improves EMG-based bicep brachii muscle force estimates. Journal of

Electromyography and Kinesiology, vol. 14, pp.389-399, 2004

Rowland L.P. Diseases of the motor unit. pp. 695-712 in Principles of Neural Science (E.R.

Kandel, J.H. Schwartz, T.M. Jessell, editors) 4th

edition. McGraw-Hill, 2000.

Sin, V.W.H. Muscle Recruitment Patterns during sitting. Master of Applied Science Thesis,

Institute of Biomaterials and Biomedical Engineering, University of Toronto, 2007.

Page 69: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

59

Staude, G., Wolf, W., Appel, U. Automatic event detection in surface EMG in surface EMG of

rhythmically activated muscles. An International Conference of IEEE Biomedical Engineering

Society, vol. 17, pp. 1351-1352,1995.

Staude, G., Wolf, W., Objective motor response onset detection in surface myoelectric signals.

Medical Engineering & Physics, vol. 21, pp. 449-467, 1999.

Staude, G., Wolf, W. Change-point detection in kinetic signals, pp. 43 – 48 in Lecture Notes In

Computer Science; Vol. 1933 Proceedings of the First International Symposium on Medical Data

Analysis (R.W. Brause, E. Hanisch, editors), Springer-Verlag, 2000.

Staude, G., Flachenecker, C., Daumer, M., Wolf, W. Onset detection in surface

electromyographic signals: a systematic comparison of methods. EURASIP Journal on Applied

Signal Processing, vol. 2, pp. 67-81, 2001.

Stokes, I.A.F., Gardner-Morse, M., Henry, S.M., Badger, G.J. Decrease in trunk muscular

response to perturbation with preactivation of lumbar spinal musculature.

Stylianou, A.P., Luchies, C.W., Insana, M.F. EMG onset detection using the maximum

likelihood method. Summer Bioengineering Conference, Florida, June 25-29, 2003.

Takens, F. Detecting strange attractors in turbulence, pp. 366 in Dynamical Systems and

Turbulence (D. A. Rand and L. S. Young, editors). Berlin: Springer, 1981.

Taylor, W.A. Change-point analysis: a powerful new tool for detecting changes, 2000. Available

at www.variation.com/cpa/tech/changepoint.html

Trontelj, J.V., Jabre, J., Mihelin, M. Needle and wire detection techniques, pp. 27-46 in

Electromyography: Physiology, Engineering, and Noninvasive Applications (R. Merletti, P.A.

Parker, editors). IEEE Press Series in Biomedical Engineering, 2004.

Urquhart, D.M., Hodges, P.W., Story, I.H. Postural activity of the abdominal muscles varies

between regions of these muscles and between body positions. Gait and Posture, vol. 22, pp.

295-301, 2005.

Van Boxtel, G.J.M., Geraats, L.H.D., van den Berg-Lenssen, M.M.C., Brunia, C.H.M. Deetction

of EMG onset in ERP research. Psychophysiology, vol. 30, pp. 405-412, 1993.

Vautard, R., Ghil, M. Singular spectrum analysis in nonlinear dynamics, with applications to

paleoclimatic time series. Physica D, vol. 35, pp. 395-424, 1989.

Vautard, R., Yiou, P., Ghil, M. Singular-spectrum analysis : a toolkit for short, noisy chaotic

signals. Physica D, vol. 58, pp. 95-126, 1992.

Wackerly, D.D., Mendenhall III, W., Scheaffer, R.L. Mathematical Statistics with Applications,

6th edition, Duxbury – Thomson Learning, 2002.

Page 70: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

60

Warrick, P.A., Precup, D., Hamilton, E.F., Kearney, R.E. Fetal heart rate deceleration detection

using a discrete cosine transform implementation of singular spectrum analysis. Methods of

Information in Medicine, vol. 46, No. 2, pp.196-201, 2007.

Wendling, F., Carrault, G., Badier, J.M. Segmentation of depth-EEG seizure signals: method

based on a physiological parameter and comparative study. Annals of Biomedical Engineering,

vol. 25, pp. 1026-1039, 1997.

Zwarts, M.J., Stegeman, D.F., van Dijk, J.G. Surface EMG applications in neurology, pp. 323-

342 in Electromyography: Physiology, Engineering, and Noninvasive Applications (R. Merletti,

P.A. Parker, editors). IEEE Press Series in Biomedical Engineering, 2004.

Page 71: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

61

Appendices

Appendix A: Change-point Detection Algorithm MATLAB Implementation

function [cp_list1, cp_list2, D, W]=ssa_cp_find_high_threshold(x1,m,M,p,q)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% -----------------------------------------------------------------

% SSA implementation

% Author: Francisco Javier Alonso Sanchez e-mail:[email protected]

% Departament of Electronics and Electromecanical Engineering

% Industrial Engineering School

% University of Extremadura

% Badajoz

% Spain

% -----------------------------------------------------------------

% Change-point detection Implementation by Lev Vaisman

% [email protected]

% Institute of Biomaterials and Biomedical Engineering

% University of Toronto, Toronto. Ontario, Canada

% -----------------------------------------------------------------

% x1 Original time series (column vector form)

% m - window width of the data on which to operate at a time, must be even

% M - Lag length

% p and q – test matrix parameters

% introductory definitions

N=length(x1);

if M>m/2;M=m-M;end

if nargin==3

p=m-M+1;

q=m+1;

end

% step 3 and 4: sum of eigenvalues and choosing L

K=m-M+1;

X_big=zeros(M,K);

for (i=1:K) X_big(1:M,i)=x1(0+(i:i+M-1)); end

S=X_big*X_big';

[U,autoval]=eig(S);

[d,i]=sort(-diag(autoval));

d=-d;

sev=sum(d);

d./sev*100;

lgth=length(find((d./sev)*100>5));

L=1:lgth

% running the procedure for all n from 0 to N-m-M

for n=0:N-m-M

% step1 : building trajectory matrix

K=m-M+1;

X=zeros(M,K);

Page 72: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

62

for (i=1:K) X(1:M,i)=x1(n+(i:i+M-1)); end

% step 2 : SVD

S=X*X';

[U,autoval]=eig(S);

[d,i]=sort(-diag(autoval));

U=U(:,i);

UL=U(:,L);

% computing distances of trajectory matrix to L eigenvectors

DX=0;

for i=1:K

DX=DX+((X(:,i)')*X(:,i)-(X(:,i)')*UL*(UL')*X(:,i));

end

v(n+1)=DX./(M*K);

% step 5 : form test matrix

T=zeros(M,q-p);

for (i=p+1:q)

T(1:M,i-p)=x1(n+(i:i+M-1));

end

% step 6: computing distances of test matrix to L eigenvectors

DnLpq=0;

for i=1:(q-p)

DnLpq=DnLpq+((T(:,i)')*T(:,i)-(T(:,i)')*UL*(UL')*T(:,i));

end

D(n+1)=DnLpq./(M*(q-p));

if n>m/2

SN(n+1)=D(n+1)/v(m/2+1);

else

SN(n+1)=D(n+1)/v(n+1);

end

% step 7: computing a CUSUM statistic

if n==0

W(n+1)=SN(n+1);

else

W(n+1)=max(W(n)+SN(n+1)-SN(n)-1./(sqrt(M*(q-p))),0);

end

end

% detecting change-points

% from Dn Statistic

k=0;

for i=2:length(D)-1

if D(i)<D(i+1)&&D(i)<D(i-1)

k=k+1;

cp_list2(k)=i+M+m;

end

end

% from CUSUM statistic

threshold=8/sqrt(M*(q-p-2))

k=0;

Page 73: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

63

for i=1:length(W)

if W(i)>threshold

for j=1:i-1

if W(i-j)==0

k=k+1;

if k==1||cp_list1(k-1)~=i-j+1+m+M

cp_list1(k)=i-j+1+m+M;

else

k=k-1;

end

break;

end

end

end

end

Page 74: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

64

Appendix B: Script to Input the Visual Estimates of the EMG Onsets with a Mouse

in MATLAB

clear load aaa1_offmed1_ext_rawandfiltered.mat % ginput command takes coordinates of mouse click

for i=1:size(RWE,2) plot(RWE(:,i),'b') title(i) [x_KM(i),y_KM(i)]=ginput(1) End

% rounding the click coordinate to the nearest millisecond x_KM=round(x_KM); save aaa1_offmed1_ext_visual_KM.mat x_KM y_KM % if you want raw EMG, replace RWE by emg_extract_offmed1_ext

Page 75: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

65

Appendix C: Hodges&Bui algorithm Implementation in MATLAB

% computing the thresholds for Hodges and Bui % based on 500 ms before the trigger % filter EMG 30-200Hz load EMGfilter_30_200.mat

% for every EMG segment

for i=1:size(emg_extract_offmed1_ext,2) RWE(:,i)=abs(filtfilt(EMGfilter,1,emg_extract_offmed1_ext(:,i))); temp_mean(i,:)=[mean(RWE(2500:2599,i)) mean(RWE(2600:2699,i))

mean(RWE(2700:2799,i)) mean(RWE(2800:2899,i)) mean(RWE(2900:2999,i))]; [temp1 temp2]=find(temp_mean(i,:)==median(temp_mean(i,:)),1); emg_mean(i,:)=temp_mean(i,temp2); switch temp2 case 1 emg_std(i,:)=std(RWE(2500:2599,i)); case 2 emg_std(i,:)=std(RWE(2600:2699,i)); case 3 emg_std(i,:)=std(RWE(2700:2799,i)); case 4 emg_std(i,:)=std(RWE(2800:2899,i)); case 5 emg_std(i,:)=std(RWE(2900:2999,i)); end for n=1:2950 tmp=mean(RWE(3000+n:3000+n+50,i)); if tmp>emg_mean(i,:)+3*emg_std(i,:) onsetHB_offmed1_ext(i)=3000+n; break; end end end

Page 76: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

66

Appendix D: Wavelet-based Denoising Implementation in MATLAB

% % now apply denoising and then Hodges method % first rectify then denoise (Sin, 2007)

emg_denoised=wavelet_denoising(abs(emg_extract_offmed1_ext),14); % for every EMG segment

% compute threshold based on 500 ms before stimulus

for i=1:size(emg_extract_offmed1_ext,2) temp_mean(i,:)=[mean(emg_denoised(2500:2599,i))

mean(emg_denoised(2600:2699,i)) mean(emg_denoised(2700:2799,i))

mean(emg_denoised(2800:2899,i)) mean(emg_denoised(2900:2999,i))]; [temp1 temp2]=find(temp_mean(i,:)==median(temp_mean(i,:)),1); emg_mean(i,:)=temp_mean(i,temp2); switch temp2 case 1 emg_std(i,:)=std(emg_denoised(2500:2599,i)); case 2 emg_std(i,:)=std(emg_denoised(2600:2699,i)); case 3 emg_std(i,:)=std(emg_denoised(2700:2799,i)); case 4 emg_std(i,:)=std(emg_denoised(2800:2899,i)); case 5 emg_std(i,:)=std(emg_denoised(2900:2999,i)); end for n=1:2950 tmp=mean(emg_denoised(3000+n:3000+n+50,i)); if tmp>emg_mean(i,:)+3*emg_std(i,:) onsetVD_offmed1_ext(i)=3000+n; break; end end end

% wavelet-based denoising code (provided by V. Sin)

% version for trunk muscles

% Wavelet denoising

% levels =14 was the used value of the parameter for levels of decomposition

function denoised=wavelet_denoising(noisy, levels)

% extra rectification (just in case non-rectified signal was sent in)

emg_ens=abs(noisy');

r=size(emg_ens,1);

% r is length of signal

filttype='haar';

for j=1:r

tempsignal=emg_ens(j,1:1000);

[C,L]=wavedec(tempsignal,levels,filttype);

%determining the coefficients and variance

tempsum=L(1);

for k=2:levels+1

a=tempsum+1;

b=L(k)+tempsum;

Page 77: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

67

d1=C(a:b);

tempsum=b;

db=mean(d1);

s2=var(d1-db);

delta(k-1)=sqrt(s2);

s2struct(k-1)=s2;

end

%decomposing the signal of interest

tempsignal=emg_ens(j,:);

[C,L]=wavedec(tempsignal, levels, filttype);

xs=zeros(size(C));

tempsum=L(1);

for k=2:levels+1

a=tempsum+1;

b=L(k)+tempsum;

d1=C(a:b);

temp=max(abs(d1)-delta(k-1),zeros(1,length(a:b)));

xs(a:b)=sign(d1).*temp;

tempsum=b;

end

%reconstructing the modified signal

temprec=waverec(xs,L,filttype);

emg_ens(j,:)=temprec-mean(temprec(1,1:1999));

end

denoised=emg_ens';

Page 78: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

68

Appendix E: Average Absolute Differences Plots, Kruskal-Wallis / ANOVA

Tables and Multiple Comparisons Plots for Wrist Muscle EMG

0 5 10 15 20 25 30 35 40 450

50

100

150

200

250

300

350

400

450

segment #

avera

ge a

bsolu

te d

iffe

rence m

illis

econds

Average Absolute Differences between Visual and Computer Estimates, AAA1

Wavelet denoising + Thresholding

Thresholding

Change-point analysis

Figure 9: AAA1 Average Absolute Differences

Table 7: AAA1 Kruskal-Wallis ANOVA

40 45 50 55 60 65 70 75 80 85

diffCP

diffHB

diffVD

Multiple Comparisons Test Plot, AAA1

2 groups have mean ranks significantly different from diffCP

Figure 10: AAA1 Multiple Comparisons Test

Page 79: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

69

0 5 10 15 20 25 30 350

50

100

150

200

250

300

350

segment #

ave

rag

e a

bso

lute

diffe

ren

ce

millise

co

nd

s

Average Absolute Differences between Visual and Computer Estimates, AAA2

Wavelet denoising + Thresholding

Thresholding

Change-point analysis

Figure 11: AAA2 Average Absolute Differences

Table 8: AAA2 Kruskal-Wallis ANOVA

20 30 40 50 60 70 80

diffCP

diffHB

diffVD

Multiple Comparisons Test Plot, AAA2

The mean ranks of groups diffCP and diffHB are significantly different

Figure 12: AAA2 Multiple Comparisons Test

Page 80: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

70

0 5 10 15 20 25 30 35 40 450

50

100

150

200

250

300

segment #

ave

rag

e a

bso

lute

diffe

ren

ce

millise

co

nd

s

Average Absolute Differences between Visual and Computer Estimates, AAA3

Wavelet denoising + Thresholding

Thresholding

Change-point analysis

Figure 13: AAA3 Average Absolute Differences

Table 9: AAA3 Kruskal-Wallis ANOVA

30 40 50 60 70 80 90

diffCP

diffHB

diffVD

Multiple Comparisons Test Plot, AAA3

The mean ranks of groups diffCP and diffHB are significantly different

Figure 14: AAA3 Multiple Comparisons Test

Page 81: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

71

1 2 3 4 5 6 7 8 9 10 110

50

100

150

200

250

300

350

400

450

500

segment #

ave

rag

e a

bso

lute

diffe

ren

ce

millise

con

ds

Average Absolute Differences between Visual and Computer Estimates, AAA4

Wavelet denoising + Thresholding

Thresholding

Change-point analysis

Figure 15: AAA4 Average Absolute Differences

Table 10: AAA4 Kruskal-Wallis ANOVA

5 10 15 20 25 30

diffCP

diffHB

diffVD

Multiple Comparisons Test Plot, AAA4

No groups have mean ranks significantly different from diffCP

Figure 16: AAA4 Multiple Comparisons Test

Page 82: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

72

0 5 10 15 20 25 30 35 40 450

50

100

150

200

250

300

350

400

450

500

segment #

ave

rage

ab

so

lute

diffe

ren

ce

millise

co

nd

s

Average Absolute Differences between Visual and Computer Estimates, AAA5

Wavelet denoising + Thresholding

Thresholding

Change-point analysis

Figure 17: AAA5 Average Absolute Differences

Table 11: AAA5 Kruskal-Wallis ANOVA

45 50 55 60 65 70 75 80

diffCP

diffHB

diffVD

Multiple Comparisons Test Plot, AAA5

No groups have mean ranks significantly different from diffCP

Figure 18: AAA5 Multiple Comparisons Test

Page 83: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

73

0 5 10 15 20 25 30 35 400

50

100

150

200

250

300

350

400

segment #

ave

rag

e a

bso

lute

diffe

ren

ce

millise

co

nd

s

Average Absolute Differences between Visual and Computer Estimates, AAA6

Wavelet denoising + Thresholding

Thresholding

Change-point analysis

Figure 19: AAA6 Average Absolute Differences

Table 12: AAA6 Kruskal-Wallis ANOVA

40 45 50 55 60 65 70 75 80 85

diffCP

diffHB

diffVD

Multiple Comparisons Test Plot, AAA6

No groups have mean ranks significantly different from diffCP

Figure 20: AAA6 Multiple Comparisons Test

Page 84: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

74

0 5 10 15 20 25 30 35 400

20

40

60

80

100

120

140

160

180

segment #

ave

rag

e a

bso

lute

diffe

ren

ce

millise

co

nd

s

Average Absolute Differences between Visual and Computer Estimates, AAA7

Wavelet denoising + Thresholding

Thresholding

Change-point analysis

Figure 21: AAA7 Average Absolute Differences

Table 13: AAA7 Kruskal-Wallis ANOVA

35 40 45 50 55 60 65 70 75 80

diffCP

diffHB

diffVD

Multiple Comparison Test Plot, AAA7

No groups have mean ranks significantly different from diffCP

Figure 22: AAA7 Multiple Comparisons Test

Page 85: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

75

0 2 4 6 8 10 12 14 16 18 200

50

100

150

segment #

ave

rag

e a

bso

lute

diffe

ren

ce

millise

co

nd

s

Average Absolute Differences between Visual and Computer Estimates, AAA8

Wavelet denoising + Thresholding

Thresholding

Change-point analysis

Figure 23: AAA8 Average Absolute Differences

Table 14: AAA8 Kruskal-Wallis ANOVA

15 20 25 30 35 40 45

diffCP

diffHB

diffVD

Multiple Comparisons Test Plot, AAA8

No groups have mean ranks significantly different from diffCP

Figure 24: AAA8 Multiple Comparisons Test

Page 86: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

76

0 5 10 15 20 25 30 35 400

50

100

150

200

250

300

350

400

450

500

segment #

ave

rage

ab

solu

te d

iffe

ren

ce m

illise

con

ds

Average Absolute Differences between Visual and Computer Estimates, AAA9

Wavelet denoising + Thresholding

Thresholding

Change-point analysis

Figure 25: AAA9 Average Absolute Differences

Table 15: AAA9 Kruskal-Wallis ANOVA

20 30 40 50 60 70 80

diffCP

diffHB

diffVD

Multiple Comparisons Test Plot, AAA9

2 groups have mean ranks significantly different from diffCP

Figure 26: AAA9 Multiple Comparisons Test

Page 87: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

77

Appendix F: Average Absolute Differences Plots, Kruskal-Wallis / ANOVA

Tables and Multiple Comparisons Plots for Trunk Muscle EMG

0 10 20 30 40 50 60 700

50

100

150

200

250

300

segment #

avera

ge a

bsolu

te d

iffe

rence

milliseco

nds

Average Absolute Differences between Visual and Computer Estimates, KM

Wavelet denoising + Thresholding

Thresholding

Change-point analysis

Figure 27: Subject 1 Average Absolute Differences

Table 16: Subject 1 Kruskal-Wallis ANOVA

80 85 90 95 100 105 110

diffCP

diffHB

diffVD

Multiple Comparisons Test Plot, KM

No groups have mean ranks significantly different from diffCP

Figure 28: Subject 1 Multiple Comparisons Test

Page 88: Application of Singular Spectrum-based Change-point ...€¦ · MASc Thesis Title: Application of Singular Spectrum-based Change-point Analysis to EMG Event Detection Year of Convocation:

78

0 5 10 15 20 25 30 35 40 450

100

200

300

400

500

600

segment #

ave

rag

e a

bso

lute

diffe

ren

ce

millise

co

nds

Average Absolute Differences between Visual and Computer Estimates, NK

Wavelet denoising + Thresholding

Thresholding

Change-point analysis

Figure 29: Subject 2 Average Absolute Differences

Table 17: Subject 2 Kruskal-Wallis ANOVA

40 50 60 70 80 90 100

diffCP

diffHB

diffVD

Multiple Comparisons Test Plot, NK

2 groups have mean ranks significantly different from diffCP

Figure 30: Subject 2 Multiple Comparisons Test