Professional Documents
Culture Documents
Singular Spectrum Analysis using R Hossein Hassani full chapter instant download
Singular Spectrum Analysis using R Hossein Hassani full chapter instant download
Hossein Hassani
Visit to download the full and correct content document:
https://ebookmass.com/product/singular-spectrum-analysis-using-r-hossein-hassani/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...
https://ebookmass.com/product/exploratory-data-analysis-
using-r-1st-edition-ronald-k-pearson/
https://ebookmass.com/product/biostatistics-and-computer-based-
analysis-of-health-data-using-r-1st-edition-christophe-lalanne/
https://ebookmass.com/product/using-r-for-data-analysis-in-
social-sciences-a-research-project-oriented-approach-li/
https://ebookmass.com/product/reproducible-econometrics-using-r-
jeffrey-s-racine/
Special Relativity: A Heuristic Approach Sadri Hassani
https://ebookmass.com/product/special-relativity-a-heuristic-
approach-sadri-hassani/
https://ebookmass.com/product/practical-business-analytics-using-
r-and-python-2nd-edition-umesh-r-hodeghatta/
https://ebookmass.com/product/valuing-businesses-using-
regression-analysis-c-fred-hall/
https://ebookmass.com/product/practical-business-analytics-using-
r-and-python-solve-business-problems-using-a-data-driven-
approach-2nd-edition-umesh-r-hodeghatta/
https://ebookmass.com/product/beyond-racial-capitalism-1st-
edition-hossein/
Hossein Hassani Rahim Mahmoudvand
•
Singular
Spectrum Analysis
Using R
Hossein Hassani Rahim Mahmoudvand
Research Institute of Energy Department of Statistics
Management and Planning Bu-Ali Sina University
University of Tehran Hamedan, Iran
Tehran, Iran
Time series analysis is crucial in the modern world as time series data
emerge naturally in the field of statistics. As a result, the application of time
series analysis covers diverse areas, including those relating to ecological
and environmental data, medicine and more importantly economic and
financial time series analysis. In the past, time series analysis was restricted
by the necessity to meet certain assumptions, for example, normality. In
addition, the presence of outlier events, such as the 2008 recession, which
causes structural changes in time series data, has further implications by
making the time series non-stationary. Whilst methods have been devel-
oped using condemning time series models, such as variations of autore-
gressive moving average models, ARIMA models, such methods are largely
parametric. In contrast, Singular Spectrum Analysis (SSA) is a
non-parametric technique and requires no prior statistical assumptions
such as stationarity or linearity of the series and works with both linear and
non linear data. In addition, SSA has outperformed methods such as
ARIMA, ARAR and Holt-Winters in terms of forecast accuracy in a
number of applications. The SSA method consists of two complementary
stages, known as decomposition and reconstruction, and both stages
include two separate steps. At the first stage the time series is decomposed
and at the second stage the original series is reconstructed and this series,
which is noise free, is then used to forecast new data points. The practical
benefits of SSA have resulted in its wide using over the last decade. As a
result, the successful applications of SSA can now be identified across
varying disciplines such as physics, meteorology, oceanology, astronomy,
medicine, climate data, image processing, physical sciences, economics and
finance. Practically there are few programs, such as SAS and Caterpillar,
which allow performing the SSA technique, but these require payments
which are sometimes not economical for an individual researcher. R is an
open-source software package that was developed by Robert Gentleman
and Ross Ihaka at the University of Auckland in 1999. Since then, it has
experienced a huge growth in popularity within a short span of time. R is a
programme which allows the user to create their own objects, functions
and packages. The R system is command driven and it documents the
analysis steps making it easy to reproduce or update the analysis and figure
errors. R can be installed on any platform and is license free. A major
advantage with R is that it allows integrating and interacting with other
paid platforms such as SAS, Stata, SPSS and Minitab. Although there are
some books in the market relating to SSA, this book is unique as it not only
details the theoretical aspects underlying SSA, but also provides a com-
prehensive guide enabling the user to apply the theory in practice using the
R software. This book provides the user with step-by-step coding and
guidance for the practical application of the SSA technique to analyse their
time series databases using R. We provided some basic R commands in
Appendix, so the readers who are not familiar with this language please
learn the very basics in the Appendix at first.
The help of Prof. Kerry Patterson and Prof. Michael Clements in editing
the text is gratefully acknowledged. Discussions with Kerry and Michael
helped to clarify various questions treated on the following pages. We
thank both for their encouragement.
As this book endeavours to provide a concise introduction to SSA, as
well as to its application procedures to time series analysis, it is mainly
aimed at masters and Ph.D.’s students with a reasonably strong
stats/maths background who wants to learn SSA, and is already acquainted
with R. It is also appropriate for practitioners wishing to revive their
knowledge of times series analysis or to quickly learn about the main
mechanisms of SSA. On the time series side, it is not necessary to be an
expert on what is popularly called Box-Jenkins modelling. In fact this could
be a disadvantage since SSA modelling start from a somewhat different
point and in doing so challenges some of the underlying assumptions of the
Box-Jenkins approach.
Index 147
FIGURES
1.1 Introduction
There are several different methods for analysing time series all of which
have sensible applications in one or more areas. Many of these methods are
largely parametric, for example, requiring linearity or nonlinearity of a par-
ticular form. An alternative approach uses non-parametric techniques that
are neutral with respect to problematic areas of specification, such as lin-
earity, stationarity and normality. As a result, such techniques can provide
a reliable and often better means of analysing time series data. Singular
Spectrum Analysis (SSA) is a relatively new non-parametric method that
has proved its capability in many different time series applications rang-
ing from economics to physics. For the history of SSA, see Broomhead
et al. (1987), and Broomhead and King (1986a, b). SSA has subsequently
2 H. HASSANI AND R. MAHMOUDVAND
require specification of a model; they are quite easy to apply and are used
in all applied areas of time series analysis. However, there are a few disad-
vantages of using HP filter; (i) “the HP filter produces series with spuri-
ous dynamic relations that have no basis in the underlying data-generating
process; (ii) a one-sided version of the filter reduces but does not elimi-
nate spurious predictability and moreover produces series that do not have
the properties sought by most potential users of the HP filter” Hamilton
(2017).
Two main important applications of SSA are filtering and smoothing,
and forecasting, which will be discussed in the following sections.
L ,K
X = [X 1 , . . . , X K ] = xi j i, j=1
⎛ ⎞ ⎛ ⎞
x11 x12 · · · x1K y1 y2 · · · y K
⎜ x21 x22 · · · x2K ⎟ ⎜ y2 y3 · · · y K +1 ⎟
⎜ ⎟ ⎜ ⎟
=⎜ . . . . ⎟≡⎜ . .. . . . ⎟
⎝ .. .. . . .. ⎠ ⎝ .. . . .. ⎠
x L1 x L2 · · · x L K y L y L+1 · · · y N
(1.1)
Note that the output from the embedding step is the trajectory matrix
X, which is a Hankel matrix. This means that all the elements along the
diagonal i + j = const are equal, for example, x12 = x21 = y2 . Note
also that, the first column of X includes the observations 1 to L of the
time series, the second column corresponds to observations 2 to L + 1 and
so on. One preference in preparing SSA is the use of matrices rather than
vectors. Moreover, the majority of signal processing techniques can be seen
as applied linear algebra and thus we are able to benefit accordingly. If a
time series Y is defined in R (for more information about defining new
time series, see Appendix A), then, the following R code will produce the
Hankel matrix X.
The next step is to select a value for L which is the input at the embedding
step.
L<-7 #
K<-length(Y)-L+1
X<-outer((1:L),(1:K),function(x,y) Y[(x+y-1)])
Finally, in order to see the Hankel matrix typing in X results in the following
output:
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,] 1 2 3 4 5 6 7 8 9
[2,] 2 3 4 5 6 7 8 9 10
[3,] 3 4 5 6 7 8 9 10 11
1 UNIVARIATE SINGULAR SPECTRUM ANALYSIS 5
[4,] 4 5 6 7 8 9 10 11 12
[5,] 5 6 7 8 9 10 11 12 13
[6,] 6 7 8 9 10 11 12 13 14
[7,] 7 8 9 10 11 12 13 14 15
√
The singular values of X, that is the λi , for any given time series can be
extracted using the code:
lambda<-sqrt(SVD$d)
Likewise, the left and right eigenvectors for a given time series can be
extracted as follows:
U<-SVD$u
V<-SVD$v
X = UΛVT , (1.2)
√ √
where Λ denotes the diagonal matrix with diagonal entities λ1 , . . . , λ L .
This equality can be checked by the following code in R.
U%*%Lambda%*%t(V)
Applying the above codes, the first component X1 of Example 1.1 can be
obtained as below (Note that some of the R conventions are explained in
the Appendix A):
SVD<-svd(X)
lambda<-SVD$d
Lambda<-diag(lambda)
U<-SVD$u
V<-SVD$v
X1<-lambda[1]*U[,1]%*%t(V[,1])
round(X1,2)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,] 2.79 3.42 4.04 4.67 5.29 5.92 6.55 7.17 7.80
[2,] 3.27 4.01 4.74 5.48 6.21 6.94 7.68 8.41 9.15
[3,] 3.75 4.60 5.44 6.28 7.12 7.97 8.81 9.65 10.49
[4,] 4.24 5.19 6.14 7.09 8.04 8.99 9.94 10.89 11.84
1 UNIVARIATE SINGULAR SPECTRUM ANALYSIS 7
[5,] 4.72 5.78 6.84 7.89 8.95 10.01 11.07 12.13 13.19
[6,] 5.20 6.37 7.53 8.70 9.87 11.04 12.20 13.37 14.54
[7,] 5.68 6.96 8.23 9.51 10.78 12.06 13.33 14.61 15.88
XI j = X , j = 1 . . . , m.
∈I j
As you will see in the following sections, at the grouping step we have the
option of analysing the periodogram, scatterplot of right eigenvectors or the
eigenvalue functions graph to differentiate between noise and signal. Once
we have selected the eigenvalues corresponding to the noise and signal,
we can then evaluate the effectiveness of this separability via the weighted
correlation (w-correlation) statistic. The w-correlation measures the depen-
(1) (2)
dence between any two time series (here, e.g. consider Y N and Y N each
reconstructed using the eigenvalues in X1 and X2 , respectively) and if the
separability is sound then the two time series will report a w-correlation of
zero. In contrast, if the w-correlation between the reconstructed compo-
nents is large, then this indicates that the components should be considered
as one group.
2nd Step: Diagonal averaging. The purpose of diagonal averaging is to
transform a matrix to the form of a Hankel matrix, which can be subse-
quently converted to a time series. If z i j stands for an element of a matrix
Z, then the k-th term of the resulting series is obtained by averaging z i j
over all i, j, such that i + j = k + 1. By performing the diagonal averaging
of all matrix components of X I j in the expansion of X in the grouping step,
another expansion is obtained: X = X I1 +· · ·+ X Im , where X I j is the diago-
nalized version of the matrix X I j . This is equivalent to the decomposition of
m ( j)
the initial series Y N = (y1 , . . . , y N ) into a sum of m series; yt = j=1 yt ,
( j) ( j) ( j)
where YN = ( y1 , . . . , y N )
corresponds to the matrix X I j .
It is worth mentioning, that if xr,s is the r sth entry of the matrix X I j ,
then applying the diagonal averaging formula it follows that:
s2
1
yt ( j) = xi,t+1−i , (1.3)
s2 − s1 + 1
i=s1
D<-NULL
N<-length(Y)
for(t in 1:N){
s1<-max(1,(t-N+L))
s2<-min(L,t)
place<-(s1:s2)+L*(((t+1-s1):(t+1-s2))-1)
D[t]<-mean(XI[place])}
round(D,2)
[1] 2.79 3.34 3.93 4.56 5.22 5.92 6.66 7.61
[9] 8.56 9.69 10.86 12.06 13.30 14.57 15.88
The four functions to perform steps 1 and 2 of the first stage and
steps 1 and 2 of the second stage of SSA are given below. They are called
UniHankel(), SVD(), Group() and DiagAver(), respectively.
We begin by performing the Hankelization.
MAP OF
AFGHANISTAN
BY
Angus Hamilton
Fellow of the Royal Geographical Society
London: H. Heinemann. Stanford’s Geogˡ Estabᵗ London
INDEX
Abdur Rahman, 91, 152, 247, 253, 258, 355-356, 433
Accession of Habib Ullah and, 432
Administrative system of, 269, 272
Afridi Elders and, 421-422, 424
Army under, 318-321, 325
Chitral crisis and, 415
Decline and death of, 432-434, 439
Lord Dufferin and, 401
Sir M. Durand and, 406
Lord Elgin and, 416, 418, 420
Europeans employed by, 394
Fiscal policy of, 231, 290-291
Foreign relations, 356-357, 403, 446
Frontier disturbances, 419, 422, 424
Gifts to, 402
Gun-running, 397
Sir Lepel Griffin and, 400
Imports of munitions, 407
Indian Government and, 419-425
Invited to England, 409
Mobilisation scheme, 432
Mullahs and, 415-416, 442
Queen Victoria, 433
Reception of Turkish visitor by, 416
Recognition of, as Amir, 400
Refusal to visit India, 403
Refusal to receive Roberts Mission, 405
Lord Ripon and, 400
Shir Afzal, 413, 414
and South African War, 432
Subsidy, 407
Swat-Tochi rising, 417
Theological studies of, 415
Treaties, 406, 412, 455
Tribal affairs, 270-271, 443, 447
Visits Afghan-Turkestan, 402
Warns Viceroy, 409
Western therapeutics and, 389
Abramoff, General, 40
Adiz Abad, 69
Afghan Turkestan, 94, 242, 262
Area of, 247
Coal deposits in, 396
Subjugation of, 250
Visited by Abdur Rahman, 402
Afghan War, First, 148
Second, 151, 152, 448
Afghanistan, administrative system of, 269-287
British relations with, 147-149, 155-156, 187-189, 220, 250, 356,
373, 375, 446, 455, 457, 458
Climate of, 261, 262
Currency of, 283
Ethnographic distribution, 262-263, 267-268
Khanates of, 250-253
Laws of, 275-280
Minerals of, 304
Orology of, 259, 260
Products and manufactures, 298-307
Provinces of, 242-247
Revenue of, 282-287
Rivers in, 260-276 (See Rivers)
Russian relations with, 121-122, 356, 440, 443, 447, 457-458
Trade of, 236, 288-298, 306
Afridis, 264, 408, 417, 418, 419, 423, 446
Agerskski valley, 14
Agreements (See Treaties)
Ahmed Khan, Sirdar, 189
Ahmed, Shah, tomb of, 190, 193
Akcha, 247, 258
Akrobat, 401
Aktash, 174
Ak-Tepe, 117
Aktinbinsk, 6, 7, 9, 13, 14
Alai mountains, 25, 26, 30
Alayar Khan, 62
Alcock, Surgeon-Captain A. W., 156
Alexander II., 60
Alexander of Macedon, 58, 62, 109
Alexandrovski, 18
Alexeieffski, 120, 124
Alichm Pamir, 174
Ali Mardan Khan, 377
Ali Masjid, 419 (See also Khyber)
Ali Yai Khan, remarks of, 445
Alvar, 259
Amir Ullah Khan, 362, 436
Ampthill, Lord, 452
Amritsar, 202
Amu Daria (See Oxus)
Amu Daria flotilla, 74, 75, 96, 97, 98, 102-104
Anardara, 204
Anderab, 244, 253
Anderson, Mr., 409
Andijan, 6, 11, 43, 49, 59, 110
Andkhui, 173, 242, 247, 258-259
Anglo-Afghan Boundary Mission, 155
Anglo-Russian Boundary Mission, 138, 141
Annenkoff, General, 7, 76
Annenkovo, 76, 77
Aral sea, 10, 16, 95, 96
Ardewan pass, 126, 157
Aris, 11
Army, 308-326
Under Abdur Rahman, 318-321, 325
Under Dost Mahommed, 308-311
Under Habib Ullah, 321-324
Under Shir Ali, 311-318
Askhabad, 3, 4, 5, 11, 70, 103, 173
Aslam Khan, Colonel, 419
Asmar valley, 403, 408, 425
Auckland, Lord, 1, 148
Aulie-ata, 8
Ayub Khan, 152, 187
Baber, 346
Badakshan, 242, 243, 244, 250-253, 405
Badghis, 156
Bad-i-sad-o-bist roz, 223
Badjira, 129
Baghdad, 237, 238
Baglan, 253
Bairam Ali, 77, 78, 79
Bajaur-Mohmands, 408, 412, 413, 414, 417
Bakhtiaris, 204
Bakwa plain, 181
Bala Murghab, 119, 135, 142
Balfour, Mr. A. J., speeches of, 457
Balkan hills, 96
Balkash, 8
Balkh, 173, 177, 242, 247, 250, 256-257, 260, 310-311
Balkh-Herat route, list of marches, 329-330
Baluchis, 204, 226, 227, 228, 241
Baluchistan, 189
Bam, 237
Bamian, 182, 243, 247
Band-i-Turkestan, 258
Bangash, Upper, 243
Bannu, 429
Barak pass, 228
Barakail, 250
Barkhani, 76
Barnaul, 8
Baroghil pass, 244
Barton, Captain, 419
Basawul, 359
Basra, 238
Basra-Baghdad-Kermanshah-Teheran route, comparison of, with
Nushki-Seistan route, 237, 238
Belgian customs in Seistan, 235
Beetroot in Chimkent district, 19
Bell, Captain R. C., 241
Bellew, cited, 197
Benadar Kalan, 185
Benn, Major, 232
Ber Kazan, 10
Bibi Halima, 360, 361, 366, 369
Biggs, General Yeatman, 419
Binket (See Tashkent)
Bird, Major, 357, 358, 394, 395
Bird, General Corrie, 416
Bish Agatchski, 49
Black Sands of Bokhara (See Kara Kum)
Blood, General Sir Bindon, 417, 425
Bodorodski, 59
Bokhara, Khanate of, 25-39
City, 2, 6, 30, 36-39, 49, 52, 70-71, 104
Bazaars, 34, 44
Commercial relations, 70, 71
Imports from Kandahar, 203
Irrigation, 94
Masjid-i-Jama, 36
Medjidi Kalyan, 35
Medresse Mir-i-Arab, 36
Minai Kalan, 36
Population, 26, 29, 30, 33
Products, 29-30
Registan, 34
Soil, 29-30
Submission to Russia, 150
Walls of, 30
Water difficulty, 25, 26, 33, 72
Women in, 33, 34
Bolan pass, 230
Bombay, imports from, into Kandahar, 201-202
Bori valley, 260
Bozai Gumbaz, 85
British agent in Kabul, 374
Agent at Koh-i-Malik-Siah, 234
Interests in Persia, 220 in Seistan, 241
Merchants at Bunder Abbas, 237
Relations with Afghanistan, 147, 148, 149, 155, 156, 220, 250,
373-375, 446, 454, 457, 458
Relations with Russia, 1-3, 187, 188, 189, 448
Support of Abdur Rahman as Amir, 356
Brett, Lieutenant, 241
Brodrick, Mr. St. John, 452
Brooke, Captain Victor, 453
Brown, The Misses, 354, 395, 399
Bruce, Mr., 409
Buluna Khel, 408
Bunder Abbas, 234, 237
British merchants at, 237
Rate of camel-hire, 234
Buner, 408
Burnes, Alexander, 147-148
Burrows, General, 152, 187
Bushire, 237
Bustan, 69
Butkhak, 243