Fung, D.-2006-Methods For The Estimation of Missing Values in Time Series
Fung, D.-2006-Methods For The Estimation of Missing Values in Time Series
Research Online
Theses: Doctorates and Masters Theses
2006
Recommended Citation
Fung, D. S. (2006). Methods for the Estimation of Missing Values in Time Series. Retrieved from http://ro.ecu.edu.au/theses/63
Copyright Warning
You may print or download ONE copy of this document for the purpose
of your own research or study.
The University does not authorize you to copy, communicate or
otherwise make available electronically to any other person any
copyright material contained on this site.
You are reminded of the following:
Copyright owners are entitled to take legal action against persons
who infringe their copyright.
A reproduction of material that is protected by copyright may be a
copyright infringement. Where the reproduction of such material is
done without attribution of authorship, with false attribution of
authorship or the authorship is treated in a derogatory manner,
this may be a breach of the author’s moral rights contained in Part
IX of the Copyright Act 1968 (Cth).
Courts have the power to impose a wide range of civil and criminal
sanctions for infringement of copyright, infringement of moral
rights and other offences under the Copyright Act 1968 (Cth).
Higher penalties may apply, and higher damages may be awarded,
for offences and infringements involving the conversion of material
into digital or electronic form.
USE OF THESIS
The Use of Thesis statement is not included in this version of the thesis.
Methods for the Estimation of Missing Values in
Time Series
A thesis
Submitted to the
By
Of
2006
Abstract
Time Series is a sequential set of data measured over time. Examples of time series arise
in a variety of areas, ranging from engineering to economics. The analysis of time series
data constitutes an important area of statistics. Since, the data are records taken through
time, missing observations in time series data are very common. This occurs because an
observation may not be made at a particular time owing to faulty equipment, lost
records, or a mistake, which cannot be rectified until later. When one or more
observations are missing it may be necessary to estimate the model and also to obtain
understanding of the nature of the data is possible with more accurate forecasting.
Different series may require different strategies to estimate these missing values. It is
necessary to use these strategies effectively in order to obtain the best possible
estimates. The objective of this thesis is to examine and compare the effectiveness of
various techniques for the estimation of missing values in time series data models.
The process of estimating missing values in time series data for univariate data involves
analysis and modelling. Traditional time series analysis is commonly directed toward
development of time series analysis, the strategy has been to treat several variables
representing the model, called state space modelling. Examples of popular models that
2
can be represented in state space form are structured time series models where data is
which uses Kalman filtering, can also be used to obtain smoothed estimates of missing
values.
There are other common approaches available for modelling time series data with
missing values such as: time series decomposition; least squares approximation; and
numerical interpolation methods. Some of these approaches are quick and the model
building procedures are easy to carry out. Often these approaches are popular choices
for professionals who work within the time series analysis industries.
This thesis will examine each approach by using a variety of computer software and
simulated data sets for estimation and forecasting of data with missing values. In
addition this thesis will also explore the advantages and disadvantages of structural state
space modelling for different missing value data patterns by examining the mean
3
Declaration
I certify that this thesis does not incorporate without acknowledgment any material
previously submitted for a degree or diploma in any institution of higher education; and
that to the best of my knowledge and belief it does not contain any material previously
published or written by another person where due reference is made in the text.
Signature ………………………..
Date …………………………….
4
Acknowledgments
I would like to express my special thanks and gratitude to Associate Professor James
Campus at Edith Cowan University, for his expertise and assistance in clarifying
questions I had regarding Time Series Analysis and the advise he gave which was
Last, but not least, I would like to thank my mum and dad for their ongoing support and
5
Table of Contents
Page
Abstract ………………………………………………………………..2-3
Declaration …………………………………………………………………..4
Acknowledgments …………………………………………………………………..5
Chapter
1 Introduction
1.2 Background………………………………………….………………………..15
1.5 Data…………………………………………………………………………...19
2 Literature Review………………………………....................................................24
6
3.2 Least Squares Approximations……………………………………………….33
4.7 Interpolation………………………………………………………………….61
7
6. Analysis and Comparsion of Time Series Model
7. Conclusion
7.5 Conclusion……….…………………….……………………………………160
References ……………………………………………………………………………163
Appendix A…………………………………………………………………………...165
Appendix B …………………………………………………………………………..187
8
List of Figures
Page
Figure 4.1 Estimate missing value in AR(1) process by using Least Square Principle
………………………………………………………………………....60
Figure 4.2 Estimate two missing values in AR(1) process by using Least Square
Principle………………………………………………………………...60
Figure 5.6 Actual values and fitted values on purse snatching in Chicago……….101
9
List of Figures
Page
10
List of Figures
Page
11
List of Tables
Page
Table 3.2.1 Seven data points with three consecutive missing values……………...35
Table 4.6.1 AR(1) time series model with missing value when t = 6……………..59
Table 4.6.2 AR(1) time series model with missing value when t = 6 and 7………60
Table 5.5.1 Actual values and fitted values on purse snatching in Chicago……….101
Table 6.2.1 AR time series model with missing value at position 49……………...106
Table 6.2.4 AR time series model with missing value at position 7…………….…109
Table 6.2.7 AR time series model with missing value at position 91……………...112
Table 6.2.10 MA time series model with missing value at position 49………..115-116
Table 6.2.13 MA time series model with missing value at position 7…………118-119
12
List of Tables
Page
Table 6.2.16 MA time series model with missing value at position 91…….…121-122
13
List of Tables
Page
14
CHAPTER 1
INTRODUCTION
This chapter provides an overview of the research undertaken in this thesis. Section 1.2
will briefly discuss the background to this study while sections 1.2.1, 1.2.2 and 1.2.3
look at various approaches for modelling time series data. The aim and significance of
this research are detailed in sections 1.3 and 1.4. The data used in this thesis is described
in section 1.5. Finally, the research methodology and brief overview of each chapter are
1.2 Background
In our society, we often have to analyse and make inferences using real data that is
available for collection. Ideally, we would like to think that the data is carefully
collected and has regular patterns with no outliers or missing value. In reality, this does
not always happen, so that an important part of the initial examination of the data is to
assess the quality of the data and to consider modifications where necessary. A
common problem that is frequently encountered is missing observations for time series
data. Also data that is known or suspected to have been observed erroneously may be
regarded as having missing values. In addition, poor record keeping, lost records and
15
uncooperative responses during data collection will also lead to missing observations in
the series. One of the key steps in time series analysis is to try to identify and correct
obvious errors and fill in any missing observations enabling comprehensive analysis and
forecasting. This can sometimes be achieved using simple methods such as eyeballing,
or calculating appropriate mean value etc. However, more complex methods may be
needed and they may also require a deeper understanding of the time series data. We
may have to attempt to discover the underlying patterns and seasonality. Once we
understand the nature of the data, we can tackle the problem using common sense
combined with various mathematical approaches. This is both an art and a science.
Sometimes, we are required to forecast values beyond, or prior to, the range of known
values. To complete this task successfully we need a model which satisfactorily fits the
More complex methods for analysing time series data will depend on the type of data
that we are handling. But most of the time, we would use either a deterministic or
stochastic approach.
This method assumes the time series data corresponds to an unknown function and we
try to fit the function in an appropriate way. The missing observation can be estimated
by using the appropriate value of the function at the missing observation. Unlike
traditional time series approaches, this method discards any relationship between the
variables over time. The approach is based on obtaining the “best fit” for the time series
16
data and is usually easy to follow computationally. In this approach there is a
requirement for “best fit” process to be clearly defined. There are a variety of curves
that can be used to fit the data. This will be considered in more detail in a later chapter.
Another common time series approach for modelling data is to use Box-Jenkins’
Autoregressive Integrated Moving Average (ARIMA) models. The ARIMA models are
based on statistical concepts and principles and are able to model a wide range of time
series patterns. These models use a systematic approach to identify the known data
patterns and then select the appropriate formulas that can generate the kind of patterns
identified.
Once the appropriate model has been obtained, the known time series data can be used
to determine appropriate values for the parameters in the model. The Box-Jenkins’
ARIMA models can provide many statistical tests for verifying the validity of the
chosen model. In addition the statistical theory behind Box-Jenkins ARIMA models
However, a disadvantage of the Box-Jenkins ARIMA models is that it assumes that data
is recorded for every time period. Often time series data with missing values require us
17
1.2.3 State Space Modelling
A new approach to time series analysis is the use of state space modelling. This
modelling approach can incorporate various time series models such as Box-Jenkins
ARIMA models and structural time series. State space modelling emphasises the notion
that a time series is a set of distinct components. Thus, we may assume that
observations relate to the mean level of the process through an observation equation,
whereas one or more state equations describe how the individual components change
through time. A related advantage of this approach is that observations can be added
one at a time, and the estimating equations are then updated to produce new estimates.
(p.144 Kendall and Ord) Essentially, Kalman Filtering and Maximum Likelihood
Estimation methods are important procedures for handling state space models. The
approach continually performs estimating and smoothing calculations that depend only
on output from forward and backward recursions. With modifications on the maximum
likelihood procedure, it enables the approach to estimate and forecast for data with
missing values.
This research will investigate the above models to determine the most appropriate
technique for modelling time series data with missing values. These models can then be
used for estimating the missing values and enable forecasting. In particular, different
patterns and frequencies of missing values will be considered using a large number of
18
1.3 Aim of Research
for time series data with missing values. In addition, new insights will be provided
regarding the most appropriate modelling techniques for different missing data patterns.
1.5 Data
To test the effectiveness of each estimation method, we require many data sets that
represent different time series models. In this thesis, we have chosen a popular
these packages because of their popularity and easy access. By creating macros, both
19
packages can generate specific time series data sets without any difficulty. The specific
time series models we are going to generate are Autoregressive (AR) and Moving
All simulated data sets are going to be stationary time series with missing values based
To conduct our research, we will set a single missing value at various positions for each
data set. The aim is to compare the performance of each method for different time series
models with missing values in different positions. For different estimation methods, the
missing value positions for a 100 point data set are at follows:
ARIMA Interpolation: Missing value at position 7, 14, 21, 28, 35, 42, 49,
In each of the estimation processes, we calculate the absolute deviation between the
estimated value and the original value. After repeating the process one hundred times,
we determine the Mean Absolute Deviation (MAD) and associated standard deviation.
20
In this thesis, our objective is to examine the accuracy of various estimation approaches
to calculate missing values at different positions within a time series data set. With
minor adjustment, most of the approaches are able to be adapted to data sets with
multiple missing values. However, if a data set consists of consecutive missing values,
our estimates become less accurate due to lack of information. In this thesis, we are
going to focus our analysis on a single missing value at various positions within the data
set.
Chapter 1 Introduction
to this thesis.
21
Chapter 4 Stochastic Approach
because of its ability to adapt to different time series models such as the
added one at a time and the estimating equations are then updated to
are going to apply those approaches to simulated data sets derived from
gain an insight on how each method performs for different time series
situations.
22
Chapter 7 Conclusion
models.
23
CHAPTER 2
Literature Review
This section of the thesis covers the available research literature related to time series
During the research, we have focused on linear time series models as there is little
reference in the literature to nonlinear time series data and to spatial data with missing
values. One approach relating to spatial data with missing values was outlined by
Gomez et al (1995). It uses the bootstrap method to input missing natural resource
inventory data. In addition, two articles on non-linear time series model were identified.
The latest article is by Volker Tresp and Reimar Hofmann (1998) that develops
techniques for nonlinear time series prediction with missing and noisy data. This is an
extension of their previous article entitled Missing and Noisy Data in Nonlinear Time
Traditionally the approach to obtaining missing values for linear time series has
involved the use of curve fitting. Details of these approaches can be found in many
books such as: Applied Numerical Analysis by Curtis F. Gerald & Patrick O. Wheatley
(1994), The Analysis of Time Series An Introduction by Chris Chatfield (2003), Time
Series Forecasting Simulation & Application by Gareth Janacek and Louise Swift
(1993), Forecasting, Structural Time Series Models and the Kalman Filter by Andrew
24
C. Harvey (2001), Time Series: Theory and Methods by Peter J. Brockwell & Richard
In more recent times the focus has shifted towards more sophisticated approaches using
Box Jenkins ARIMA and State Space Modelling. A summary of relevant articles
One of the earliest articles which relates to missing values in time series using state
space modelling was written by Kalman (1960). In this article he outlined a new
approach to linear filtering and prediction problem. The author investigated the classical
matrix of the optimal estimation error. From the solution of this equation the
coefficients of the difference (or differential) equation of the optimal linear filter
25
c) The filtering problem is shown to be the dual of the noise-free regulator
The approach developed by Kalman in this article has been extended by Richard H.
Jones (1980) who derived a method of calculating the exact likelihood function of a
Markovian representation combined with Kalman recursive estimation. This state space
approach involves matrices and vectors with dimensions equal to Max (p,q+1) where p
is the order of the autoregression and q is the order of the moving average, rather than
matrices with dimensions equal to the number of observations. A key to the calculation
of the exact likelihood function is the proper calculation of the initial state covariance
matrix. The paper also included some discussion on observational error in the model
and the extension to missing observations. The use of a nonlinear optimization program
gives the maximum likelihood estimates of the parameters and allows for model
G. Gardner A.C. Harvey and G.D.A. Phillips (1980) presented an algorithm that enables
subroutines. The first, subroutine STARMA, casts the ARMA model into the “state
space” form necessary for Kalman filtering, and computes the covariance matrix
associated with the initial value of the state vector. The second subroutine, KARMA,
26
carries out the recursions and produces a set of standardized prediction errors, together
with the determinant of the covariance matrix of the observations. These two quantities
together yield the exact likelihood, this may be maximized by an iterative procedure
derivatives. In particular, the second subroutine KARMA contains a device whereby the
likelihood may be approximated to a level of accuracy which is under the control of the
user. This enables a considerable amount of computing time to be saved, with very little
compute predictions of future values of the series, together with the associated
Four years later, A. C. Harvey and R. G. Pierse (1984) discussed two related problems
involving time series with missing data. The first concerns the maximum likelihood
estimation of the parameters in an ARIMA model when some of the observations are
missing or subject to temporal aggregation. The second concerns the estimation of the
missing observations. They also pointed out both problems can be solved by setting up
the model in state space form and applying the Kalman filter. During 1986, Robert
Kohn and Craig F. Ansley showed how to define and then compute efficiently the
carried out by using the univariate version of the modified Kalman filter introduced by
Ansley and Khon (1985), which allows a partially diffuse initial state vector. They also
show how to predict and interpolate missing observations and obtain the mean squared
error of the estimate. With the help of modern computers, state space modelling has
became a much simpler process than before and mathematicians have yet to examine
27
There are many articles which focus on the use of ARIMA models as well as other
developed a method to find the optimal linear combination of the forecast and
backforecast for missing values in a time series which can be represented by an ARIMA
model. During the following year, W. Dunsmuir and P.M. Robinson (1981) derived a
method for the estimation of models for discrete time series in the presence of missing
data. They also stated the advantages for the use of this method over alternatives. At the
beginning they assessed the performance of the method used in estimating simple
models by using simulations, and then they applied it to a time series of pollution levels
compared this method using minimum mean square estimate as a measure of efficiency.
obtain the exact maximum likelihood estimates of the parameters in a regression model
with ARMA time series errors with possibly non-consecutive data. The method is based
derived for the efficient calculation of the exact likelihood function and associated
derivatives. The innovations and associated derivatives are used to develop a modified
demonstrated how to use the score principle to test for serial correlation in residuals for
static time series regression in the presence of missing data. It is applied both to the
28
likelihood conditional on the observation times, and to an unconditional form of
likelihood. Also, asymptotic distributions of the test statistics are established, under both
Osvaldo Ferreiro (1987) discussed different alternatives for the estimation of missing
indicated that the occurrence of missing observations is quite common in time series
and in many cases it is necessary to estimate them. The article offers a series of
estimation alternatives to help estimate missing observations. Two years later, Yonina
Rosen, Boaz Porat (1989) considered the estimation of the covariances of stationary
time series with missing observations. The estimation provided general formulas for the
deterministic pattern of missing values. The authors derived closed-form expressions for
the random Bernoulli pattern and for the deterministic periodic of missing observations.
These expressions are explicitly evaluated for autoregressive moving average time
series and the results are useful for constructing and analysing parameter or spectrum
estimation algorithm based on the sample covariances for stationary time series with
missing observations.
Both authors also consider the problem of spectral estimation through the autoregressive
nonlinear least squares fit of the sample covariances computed from the data to the true
29
covariances of the assumed ARMA model. The statistical properties of the algorithm
are explored and used to show that it is asymptotically optimal, in the sense of achieving
illustrated by some numerical examples. During the same year, Greta M Ljung (1989)
moving average model when there are missing values within the time series data. Also,
the method to estimate the missing values for stationary as well as nonstationary models
related to the mean squared errors are considered. Daniel Pena and George C. Tiao
(1991) demonstrated that missing values in time series can be treated as unknown
by the expectation of the unknown values given the data. They provided examples to
It is argued that the second procedure is, in general, more relevant for estimating
missing values in time series. Thomas S. Shively (1992) constructed some tests for
the disturbance terms are generated by (i) an AR(1) process and (ii) an AR(p) process
with a possible seasonal component. Also, a point optimal invariant (POI) test is
constructed for each problem to check for efficiency. In addition, the paper shows how
to compute exact small sample p-values for the tests in O(n) operations, and gives a
computationally efficient procedure for choosing the specific alternative against which
to make the POI test most powerful invariant. Steve Beveridge (1992) also extended the
concept of using minimum mean square error linear interpolator for missing values in
time series to handle any pattern of non-consecutive observations. The paper refers to
the application of simple ARMA models to discuss the usefulness of either the
30
nonparametric or the parametric form of the least squares interpolator. In more recent
years, Fabio H. Nieto and Jorge Martinez (1996) demonstrated a linear recursive
technique that does not use the Kalman filter to estimate missing observations in
univariate time series. It is assumed that the series follows an invertible ARIMA model.
This procedure is based on the restricted forecasting approach, and the recursive linear
estimators are obtained when the minimum mean-square error are optimal. In 1997,
Alberto Luceno (1997) extended Ljung’s (1989) method for estimating missing values
and evaluating the corresponding likelihood function in scalar time series to the vector
pattern of missing data existed. In order to avoid initialisation problems, the author does
not use Kalman filter iterations. Also, it does not require the series to be differenced and
data are provided by the normal equations of an appropriate regression technique. These
equations are adapted to cope with temporally aggregated data; the procedure parallels a
It can be seen from the literature that there are a variety of methods available to
estimating missing values for time series data. What is however lacking in the literature
is a comparison of different methods for different types of data sets and different
positions for the missing data. This thesis aims to provide such a comparison by using a
31
CHAPTER 3
In general, deterministic models for time series refers to the use of numerical analysis
techniques for modeling time series data. A major advantage of numerical analysis is
that a numerical answer can be obtained even when a problem has no “analytical”
The principle of numerical analysis is to assume the time series data pattern is a
realisation of an unknown function. The aim is to identify the most appropriate function
to represent the data in order to estimate the missing values. We assume the behaviour
functions and examine the time interval that involved the missing values. Sometimes
this is the most difficult part of the analysis process. We have to examine all the factors
involved and decide the appropriate length of time interval to be considered. We will
then find a polynomial that fits the selected set of points and assume that the polynomial
and the function behave nearly the same over the interval in question. Values of the
(p.213 Gerald and Wheatly 1994). However, when the data appears to have local
irregularities, then we are required to fit sub-regions of the data with different
32
For most of the time series data, we do not want to find a polynomial that fits exactly to
the data. Often functions used to fit a set of real values will create discrepancies or the
data set may come from a set of experimental measurements that are subject to error. A
technique called least squares is normally used in such cases. Based on statistical
theory, this method finds a polynomial that is more likely to approximate the true values
For any curve fitting exercise, we are trying to minimize the deviations of the data
points from the estimated curve. Our goal is to make the magnitude of the maximum
error a minimum, but for most problems this criterion is rarely undertaken because the
minimize the sum of the squares of the errors for a polynomial of given degree, the
“least-squares” principle.
In addition to giving a unique result for a given set of data, the least-squares method is
errors are normally distributed and if the standard deviation is constant for all the data,
the line determined by minimizing the sum of squares can be shown to have values of
It is highly unlikely that time series data is linear, so we need to fit the data set with
33
we will reduce the deviations of the points from the curve until the degree of the
polynomial, n, equals to one less than the number of data points, where there is an exact
match (assuming no duplicate data at the same x-value). We call this function an
y = a 0 + a1 x + a 2 x 2 + L + a m x m (1)
y1 = a0 + a1 x1 + L + a m x1m
y 2 = a 0 + a1 x 2 + L + a m x 2m
M M M M M M
y n = a0 + a1 x n + L + a m xnm . (2)
In order to solve the system of equations (2), we would use matrices to represent the
system y = Mv
where
⎡ y1 ⎤ ⎡1 x1 x12 L x1m ⎤ ⎡ a0 ⎤
⎢y ⎥ ⎢ ⎥ ⎢a ⎥
1 x2 x 22 L x 2m ⎥
y = ⎢ 2⎥, M =⎢ , v=⎢ 1⎥.
⎢M⎥ ⎢M M M M ⎥ ⎢ M ⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎣ yn ⎦ ⎢⎣1 x n x n2 L x nm ⎥⎦ ⎣a m ⎦
y = Mv
M t y = M t Mv
(M M )
t −1
(
M t y = M tM ) (M M )v
−1 t
v = ( M t M ) −1 M t y
34
Example 3.1 Estimate missing values using least square approximations.
1 1.700 1.700
2 1.285 1.285
3 (3.708) missing
4 (6.001) missing
5 (7.569) missing
6 10.170 10.170
7 8.777 8.777
Table 3.2.1 Seven data points with three consecutive missing values.
Hence,
⎡ 1.7 ⎤ ⎡1 1 1 1 ⎤ ⎡a 0 ⎤ ⎡1 1 1 1 ⎤
⎢1.285 ⎥ ⎢1 2 4 ⎥
8 ⎥ ⎢ ⎥
a1 ⎥ ⎢1 2 6 7 ⎥⎥
y= ⎢ ⎥ , M =⎢ , v= ⎢ , M =⎢
t
⎢10.17 ⎥ ⎢1 6 36 216⎥ ⎢a 2 ⎥ ⎢1 4 36 49 ⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎣8.777⎦ ⎣1 7 49 343⎦ ⎣ a3 ⎦ ⎣1 8 216 343⎦
v = ( M t M ) −1 M t y
35
⎡ 5.67 ⎤
⎢− 6.16⎥
v=⎢ ⎥
⎢ 2.4 ⎥
⎢ ⎥
⎣ − 0.21⎦
1 1.700
2 1.285
3 (3.708) Missing 3.12
4 (6.001) Missing 5.99
5 (7.569) Missing 8.62
6 10.170
7 8.777
6
4 Estimate
2
0
1 2 3 4 5 6 7
t
Example 3.1 shows that interpolating polynomial has several advantages. Firstly the
method is easy to follow and quick to produce estimating values; it is not restricted to
estimating a single missing value; and provides reasonable estimates compared to the
36
original missing values. However, this approach does not examine any natural factors
A cubic spline is a common numerical curve fitting strategy that fits a "smooth curve"
to the known data, using cross-validation between each pair of adjacent points to set the
degree of smoothing and estimate the missing observation by the value of the spline.
While splines can be of any degree, cubic splines are the most popular. We write the
Fi ( x) = Ai ( x − x i ) 3 + Bi ( x − x i ) 2 + C i ( x − x i ) + Di (3)
Fi ( xi +1 ) = Fi +1 ( xi +1 ), i = 0,1,..., n − 2; (5)
Fi ( xi +1 ) = Fi +' 1 ( xi +1 ), i = 0,1,..., n − 2;
'
(6)
Fi ( xi +1 ) = Fi +'' 1 ( xi +1 ), i = 0,1,..., n − 2;
''
(7)
37
Equations (4), (5), (6) and (7) indicate that the cubic spline fits to each of the points, is
continuous, and has continuous slope and curvature (6) and (7) throughout the region.
If there are (n + 1) points in equation (3), the number of intervals and the number of
Fi ( x)' s are n . There are thus n times four unknowns which are the { Ai , Bi , C i , Di }
Yi = Di for i = 0,1,..., (n − 1)
Yi +1 = Ai ( xi +1 − xi ) 3 + Bi ( x i +1 − xi ) 2 + Ci ( x i +1 − xi ) + Yi
To relate the shapes and curvatures of the joining splines, we differentiate the function
Fi ' ( x) = 3 Ai H i + 2 Bi H i + Ci ,
2
(9)
S i = 6 Ai ( xi − xi ) + 2 Bi ,
(11)
= 2 Bi
Si
therefore equation (11) becomes Bi = (12)
2
S i +1 = 6 Ai ( xi +1 − xi ) + 2 Bi ,
(13)
= 6 Ai H i + 2 Bi
38
S i +1 − S i
After re-arranging equations (13) and substitute (12) into (13): Ai = (14)
6H i
S i +1 − S i 3 S i
Yi +1 = H i + H i + C i H i + Yi
2
Substitute equations (12) and (14) into (8)
6H i 2
Yi +1 − Yi 2 H i S i + H i S i +1
As a result Ci = − (15)
Hi 6
Invoking the condition that the slopes of the two cubics that join at ( X i , Yi ) are the
Yi ' = 3 Ai ( xi − xi ) 2 + 2 Bi ( xi − xi ) + C i ,
where x = xi
= Ci
Yi +1 − Yi 2 H i S i + H i S i +1
= − which is equivalent to equation (15).
Hi 6
In the previous interval, from xi −1 to xi , from equation (9), the slope at its right end will
be:
Yi ' = 3 Ai −1 ( xi − xi −1 ) 2 + 2 Bi −1 ( xi − xi −1 ) + Ci −1 ,
= 3 Ai −1 H i −1 + 2 Bi −1 H i −1 + C i −1
2
S i − S i −1 S Y − Yi −1 2 H i −1 S i −1 + H i −1 S i
=3 H i −1 + 2 i −1 H i −1 + i −
2
(16)
6 H i −1 2 H i −1 6
Yi +1 − Yi Yi − Yi −1
H i −1 S i −1 + (2 H i −1 + 2 H i ) S i + H i S i +1 = 6( − ) (17)
H i −1 H i −1
39
If we write equation (17) in matrix form, we will have the following:
⎡ ⎤ ⎡ S0 ⎤
⎢H 2(H + H ) H ⎥⎢ S ⎥
⎢ 0 0 1 1 ⎥⎢ 1 ⎥
⎢ H 2(H + H ) H ⎥ ⎢ S2 ⎥
⎢ 1 1 2 2 ⎥⎢ S ⎥
⎢ H 2(H + H ) H ⎥⎢ 3 ⎥
2 2 3 3
⎢ * ⎥⎢ * ⎥
⎢ ⎥⎢ ⎥
⎢ * ⎥⎢ * ⎥
⎢ H 2(H +H ) H ⎥ ⎢S ⎥
⎢ n−2 n−2 n −1 n − 1⎥ ⎢ n − 1⎥
⎣⎢ ⎦⎥ ⎢⎣ Sn ⎥⎦
⎡ F [ x1, x2 ] − F[ x , x ] ⎤
⎢ F[ x , x ] 0 1
⎢ − F [ x , x ] ⎥⎥
2 3 1 2 (18)
⎢ F[ x , x ] − F[ x , x ] ⎥
= 6⎢ 3 4 2 3 ⎥
⎢ * * ⎥
⎢ * * ⎥
⎢ ⎥
− F[ x
⎣⎢
F [ x ,x ] ,x ]⎥
n −1 n n − 2 n −1 ⎦
As we can see from the matrix (18) we get two additional equations involving S 0 and
S n when we specify conditions pertaining to the end intervals of the whole curve. There
are four alternative conditions which we would often use and each of these conditions
will make slight changes to our coefficient matrix. This is when we:
(a) Make the end cubics approach linearity at their extremities. Hence, S 0 = 0 and
Coefficient Matrix :
⎡ ⎤
⎢2( H + H ) H ⎥
⎢ 0 1
1 ⎥
⎢ H1 2( H 1 + H 2 ) H2 ⎥
⎢ ⎥
⎢ H2 2( H 2 + H 3 ) H 3 ⎥
⎢ * ⎥
⎢ ⎥
⎢ * ⎥
⎢ H n−2 2 ( H n − 2 + H n −1 ) ⎥
⎢ ⎥
⎣⎢ ⎦⎥
40
(b) Force the slope at each end to assume specified values.
Coefficient Matrix :
⎡ ⎤
⎢2 H H1 ⎥
⎢ 0 ⎥
⎢ H0 2( H 0 + H 1 ) H ⎥
⎢ 1 ⎥
⎢ H1 2( H 1 + H 2 ) H2 ⎥
⎢ * ⎥
⎢ ⎥
⎢ * ⎥
⎢ H n−2 2 H n −1 ⎥
⎢ ⎥
⎣⎢ ⎦⎥
Hence, S 0 = S 1 , and S n −1 = S n − 2 .
Coefficient Matrix :
⎡ ⎤
⎢3 H + 2 H H1 ⎥
⎢ 0 1 ⎥
⎢ H1 2( H 1 + H 2 ) H2 ⎥
⎢ ⎥
⎢ H2 2( H 2 + H 3 ) H3 ⎥
⎢ * ⎥
⎢ ⎥
⎢ * ⎥
⎢ H n−2 ( 2 H n − 2 + 3 H n −1 ) ⎥
⎢ ⎥
⎣⎢ ⎦⎥
41
(d) Take S 0 as a linear extrapolation from S 1 and S 2 , and S n as a linear
extrapolation from S n −1 and S n − 2 . Only this condition gives cubic spline curves that
match exactly to F (x) when F (x) is itself a cubic. We use the following relations:
S1 − S0 S 2 − S1
= ,
H0 H1
At the left end:
( H 0 + H 1 )S 1 − H 0 S 2
S0 =
H1
S n − S n −1 S n −1 − S n − 2
= ,
H n −1 H n−2
At the right end:
( H n − 2 + H n −1 ) S n −1 − H n −1 S n − 2
Sn =
H n−2
(Note: After solving the set of equations, we have to use these relations again to
Coefficient Matrix :
⎡ ⎤
⎢ ( H + H )( H + 2 H ) H 21 − H 20 ⎥
⎢ 0 1 0 1
⎥
⎢ H1 H1 ⎥
⎢ H1 2( H 1 + H 2 ) H2 ⎥
⎢ ⎥
⎢ H2 2( H 2 + H 3 ) H3 ⎥
⎢ * ⎥
⎢ ⎥
⎢ * ⎥
⎢ H 2 n − 2 − H 2 n −1 ( H n −1 + H n − 2 )( H n −1 + 2 H n − 2 ) ⎥
⎢ H n−2 H n−2 ⎥
⎢ ⎥
⎣ ⎦
42
After the S i values are obtained, we get the coefficients Ai , Bi , C i and Di for the
cubics in each interval and we can calculate the points on the interpolating curve.
t −1
⎛ t −1⎞
2
43
Firstly, we have to calculate the width of ith interval Hi:
H0 = 2-1 = 1
H1 = 6-2 = 4
H2 = 7-6 = 1
H3 = 8-7 = 1
H4 = 9-8 = 1
H5 = 13-9 = 4
H6 = 14-13 = 1
⎡10 4 0 0 0 0 ⎤ ⎡ S1 ⎤ ⎡ 15.8175 ⎤
⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢ 4 10 1 0 0 0 ⎥ ⎢ S 2 ⎥ ⎢- 8.14933⎥
⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢ 0 1 4 1 0 0 ⎥ ⎢ S 3 ⎥ ⎢4.225498⎥ ,
⎢ ⎥⎢ ⎥ = ⎢ ⎥
⎢ 0 0 1 4 1 0 ⎥ ⎢ S 4 ⎥ ⎢ - 1.25552 ⎥
⎢ 0 0 0 1 10 4 ⎥ ⎢ S ⎥ ⎢20.04885⎥
⎢ ⎥⎢ 5 ⎥ ⎢ ⎥
⎢ 0 0 0 0 4 10⎥ ⎢ S ⎥ ⎢ 24.309 ⎥
⎣ ⎦⎣ 6 ⎦ ⎣ ⎦
Using these S’s, we compute the coefficients of the individual cubic splines.
Figure 3.2 show the estimated missing values using cubic spline curve.
44
Curve Fitting (cubic spline curve)
50
40
30 True Values
f(t)
20 Estimated Values
10
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14
t
Once again with the help of modern technology, this approach is easy to follow and
pair of adjacent points to set the degree of smoothing. In some cases, this is more
accurate than other interpolating polynomial approaches. As with all numerical analysis
methods, it does not examine the nature as well as the purpose of the data set. While this
is not a problem for the less complex data set, unrealistic estimations could occur in
some cases. When using the methods above to analyse a set of data, it is not required
that the user have a full background understanding of the time series analysis and
45
CHAPTER 4
In our society, data analysis is an extremely important process. Through data analysis, it
is possible to make decisions based on facts. Time series analysis is a specific type of
data analysis; we must realize that successive observations are usually not independent
and that the analysis must take into account the time order of the observations. In
chapter 3 we have mentioned deterministic models, a time series that can be predicted
exactly to its behaviour. However, most of the time series are realisations of stochastic
models. Future values are only partly determined by the past values, so that exact
Hence, the expertise and experiences of the analyst play an important role when
analysing data. Two important types of stochastic models used are stationary and non-
46
4.2 Stationary Models
Firstly, let us look at stationary time series from an intuitive point of view. If the
property of one section of the data is much like those of any other section then we can
call the series “stationary”. In other word, the series has no systematic change in mean
The stationary time series model shows that values fluctuate uniformly over a set period
of time at a fixed level. The fixed level over which it fluctuates is generally the mean of
the series. “Most of the probability theory of time series is concerned with stationary
time series, and for this reason time series analysis often requires one to turn a non-
stationary series into a stationary one so as to use this theory.”(Chatfield, 1989 p.10)
Mathematically, a time series ARMA process of order (p,q) can be defined as follows:
X t = φ1 X t −1 + ... + φ p X t − p + Et + θ1 Et −1 + ... + θ q Et − q
random variable with mean zero and variance σ 2z , and the φi ' s and θ j ' s are called the
A time series is said to be strictly stationary if the joint distribution of X (t1 ),..., X (t n ) is
the same as the joint distribution of X (t1 + τ ),..., X (t n + τ ) for all t1,....t n ,τ . In other
words, shifting the time origin by an amount τ has no effect on the joint distributions,
47
which must therefore depend only on the interval between t1, .t 2 ...t n . The above
definition holds for any value of n . (Chatfield, 2003 p.34). More information on
The following are two useful tools available to help identify different time series
models:
tools in the identification stage for building time series models. It measures
how strongly time series values at a specified number of periods apart are
correlated to each other over time. The number of periods apart is usually
autocorrelation for lag 2 measures how series values that are two periods
away from each other are correlated throughout the series. The
autocorrelation value may range from negative one to positive one, where a
cov( X t , X t − m )
ρ i = Corr ( X t , X t −m ) =
var( X t ) var( X t − k )
48
2 The Partial-autocorrelation function (PACF) is another important tool,
also range from negative one to positive one, and are very useful in some
series is plotted as a series of bars or spikes. It is probably the most widely used method
of visually demonstrating any patterns that may exist in the autocorrelations or partial-
A time series is non-stationary if it appears to have no fixed level. The time series may
also display some periodic fluctuations. Most of the time series tools only apply to
stationary time series. In other words, we have to examine the data and try to transform
any non-stationary data set into a stationary model. There are two main types of
transformations to make the series stationary. Firstly, the data can be transformed
through differencing if the stochastic process has an unstable mean. This type of
49
transformation is used for the purpose of removing the polynomial trend that is
exhibited by the data. The logarithmic and square root transformations are special cases
of the class of transformations called the Box-Cox transformation which can be used to
induce stationarity. These transformations are used if the series being examined has a
non-constant mean and variance and it results in a straighter curve plot (Box et al.,1976,
pp.7-8, 85).
In general, the Box-Jenkins models provide a common framework for time series
interactive approach. In addition, the framework can cope with non-stationary series by
Box-Jenkins’ method derives forecasts of a time series solely on the basis of the
historical behaviour of the series itself. It is a univariate method which means only one
variable is forecast. The ideas are based on statistical concepts and principles that are
The basic Box-Jenkins’ models can be represented by a linear combination of past data
and random variables. The sequence of random variables is called a white noise process.
These random variables are uncorrelated and normal with mean zero and constant
variance.
50
4.4.1 Autoregressive Models (AR models)
The most basic AR model is the model that contains only one AR parameter as follows:
X t = φX t −1 + Et
It means that any given value X t in the time series is directly proportional to the
past values. The general autoregressive model with p AR parameters can be written as:
X t = φ1 X t −1 + φ 2 X t − 2 + ... + φ p X t − p + Et
where φ1 , φ 2 ,... are the AR parameters. The subscripts on the φ ' s are called the orders of
the AR parameters. The highest order p is referred to as the order of the model. Hence,
(Box et al.,1976, pp.7-8, 85). The values of φ which make the process stationary are
such that the roots of φ ( B) = 0 lie outside the unit circle in the complex plane where B
51
4.4.2 Moving Average Models (MA models)
The second type of basic Box-Jenkins model is called the Moving Average Model.
Unlike the autoregressive model, the Moving Average Model parameters relates what
happens in period t only to the random errors that occurred in past time periods, i.e., to
Et −1 , Et − 2 ,... etc. Basic MA model with one parameter can be written as follow:
X t = Et − θ t Et −1
It means that any given X t in the time series is directly proportional only to the random
error Et −1 from the previous period plus some current random error Et .
X t = Et − θ 1 Et −1 − θ 2 Et − 2 − ... − θ p Et − p
where θ 1 ,θ 2 ,... are the MA parameters. Like the autoregressive model, the subscripts on
the θ ’s are called the orders of the MA parameters. The highest order q is referred to as
the order of the model. Hence, it is called a moving-average model of order q and is
In most case, it is best to develop a mixed autoregressive moving average model when
building a stochastic model to represent a stationary time series. The order of an ARMA
model is expressed in terms of both p and q . The model parameters relates to what
52
happens in period t to both the past values and the random errors that occurred in past
Equation (19) of the time series model will be simplified by a backward shift operator B
to obtain
φ ( B) X t = θ ( B) Et
where:
θ ( B) = 1 − θ 1 B − ... − θ q B q .
Generally, most of the time series are non-stationary and Box-Jenkins’ method
recommends the user to remove any non-stationary sources of variation then fit a
stationary model to the time series data. In practice, we can achieve stationarity by
applying regular differences to the original time series. These models are written in the
same way as the basic models, except that the differenced (stationary) series Wt is
substituted for the original series X t . In order to express ARIMA models, we have to
understand the use of difference operator. For example, the first difference of a series
Wt = X t − X t −1 (20)
53
However, the use of a symbol ∇ is used to simplify equation (20). The first differences
Wt = ∇X t
If we take the second consecutive difference of the original series X t , the expression
Wt = ∇ 2 X t = ∇( X t − X t −1 ) = ∇(∇X t )
1983, pp.52-53).
By using the difference operator, we may write the ARIMA model (21) as follow:
φ ( B)Wt = θ ( B) Et
or
φ ( B)(1 − B) d X t = θ ( B) Et .
In ARIMA models, the term integrated, which is a synonym for summed, is used
because the differencing process can be reversed to obtain the original time series
values by summing the successive values of the differenced series. (Hoff, 1983, pp.126)
54
4.5 Box-Jenkins’ Models and Missing Values
Box-Jenkins’ method is a popular choice for analyst to use on time series modelling. It
series patterns.
ii) There is a systematic approach for identifying the correct model form.
iv) The statistical theory behind Box-Jenkins’ method also allows the
forecast.
All the basic Box-Jenkins’ models have recognizable theoretical autocorrelation and
use of correlogram) and compare them with the known theoretical ACF and PACF
patterns. A summary of the theoretical ACF and PACF patterns associated with AR,
However, if missing values occurred within the time series data then it is impossible to
compute any of these values. For this reason, Box-Jenkins’ methods may not be the best
choice and they cannot be applied directly to time series which includes the missing
values. To apply Box-Jenkins’ method to time series data with missing values, we have
55
i) How often do the missing values occur?
ii) Where are the missing values located in the time series?
iii) Do we have sufficient data before, after or between the missing values to
values. In chapter 3, numerical approaches have been used to estimate missing values
within a time series. The accuracy of results is mainly dependent on the type of time
series. Once missing values have been filled with estimates, Box-Jenkins’ method can
then be applied.
Alternatively, if sufficient data exists before, between or after missing values, Box-
Jenkins’ method can be applied to sections of data that do not contain missing values. In
this case, missing values can be obtained as forward or backward forecast values are
Applying the least square principle to time series with missing values is a basic
1987 this method is intended to find missing values for stationary time series. By the
use of differencing, it can be applied to time series with one gap or more provided they
are well separated and have sufficient data to obtain an ARIMA model.
56
Consider ARMA process of order (p,q) , the process can be written in more compact
form as follow :
θ ( B) = 1 − θ1 B − ... − θ q B q
BX t = X t −1 , B i X t = X t −i
φ ( B)
Et = Xt
θ ( B)
∞
E t = ∏( B ) X t where ∏( B) = 1 − ∏1 B − ∏ 2 B 2 − .... = −∑ ∏ j B j (25)
j =0
Et = X t − ∏ 1 X t −1 − ∏ 2 X t − 2 − ...
57
To calculate the sum of squares of errors over a 2 L points the following formulas are
used:
L
SS = ∑E
t =− L
t
2
L ∞
SS = ∑ ( −∑ ∏
t =− L i =0
i X t −i ) 2
In order to minimize the sum of squares with respect to the missing values the following
Let X s be missing
∂SS L ∞
= 0 ↔ 2∑ ∏ t − s ( ∑ ∏ i X t − i ) = 0 (26)
∂Z s t =s i =0
∞ ∞
∑ ∏ j (∑ ∏ i X s + j − i ) = 0
j =0 i =0
∞
- ∑ ∏ j E s + j = ∏ ( B −1 ) E s = 0 and
j =0
E s + j = ∏( B ) X s + j
∞
E s + j = − ∑ ∏ i E s + j −i (27)
i =0
From equation (27), it is possible to obtain the least squares equation for approximating
∏( B −1 ) ∏( B) X s = 0
58
Example 4.6.1 Estimate missing value in AR(1) process by using Least Square
Principle
X t = 0.7 X t −1 + Et
(1 − 0.7 B) X t = Et
(1 − 0.7 B) = ∏( B) ; (1 − 0.7 B −1 ) = ∏( B −1 )
∏( B −1 ) ∏( B ) X s = 0
0.7 0.7
Hence, Xˆ t = X t +1 + X t −1
1.49 1.49
The data below is obtained by applying the AR(1) process with Et being a purely
random process where the mean equals zero and the variance equals one.
t Xt
1 -0.65712
2 -1.30722
3 -2.43663
4 -2.06851
5 -1.48044 Estimated
6 (-1.00819) Missing -1.17867 0.7 0.7
Xˆ t = X t +1 + X t −1
1.49 1.49
7 -1.02845
8 1.474587
9 -0.71027
10 -1.23367
Table 4.6.1 AR(1) time series model with missing value when t = 6.
59
Least Square Estimation
0
Estimate data
1 2 3 4 5 6 7 8 9 10 11
-1 Original data
-2
-3
-4
Figure 4.1 Estimate missing value in AR(1) process by using Least Square
Principle.
Example 4.6.2 Estimate two missing values in AR(1) process by using Least
Square Principle
t Xt
1 -0.65712
2 -1.30722
3 -2.43663
4 -2.06851
5 -1.48044 Estimated 0.7 ˆ 0.7
Xˆ t = X t +1 + (−1.48044)
6 (-1.00819) Missing -0.30314 1.49 1.49
0
Estimate data
1 2 3 4 5 6 7 8 9 10 11
-1 Original Data
-2
-3
-4
Figure 4.2 Estimate two missing values in AR(1) process by using Least Square
Principle.
60
The examples above show how the Box-Jenkins methods are used to estimate missing
values. However, this method is only suitable for lower order of ARMA models when
the calculations are carried out manually. For higher order ARMA (p.q) models it is
4.7 Interpolation
Interpolation is a concept which can be applied to time series data to determine missing
values. First of all, we have to determine an appropriate ARIMA time series model for
the known data. According to the position of the missing observation we can then
calculate the appropriate weightings for both the forward and backward forecast.
Finally, using a linear combination of the forward and backward forecast with the
weightings already calculated, we are able to predict the values of the missing
Let us consider the ARIMA (p, d, q) (autoregressive integrated moving average) model
φ ( B)(1 − B ) d X t = θ ( B) Et
where:
φ ( B) = 1 − φ1 B − ... − φ p B p ,
61
Given the observations x q , x q −1 ,... the minimum mean square error for forward forecast
of x q + l (l ≥ 1) at time q is
l −1
eˆq (l) = ∑ψ j Eq +l− j , ψ0 = 1
j =0
θ ( B) = (1 + ψ 1 B + ψ 2 B 2 + ...)φ ( B )(1 − B) d .
expressed as:
φ ( F )(1 − F ) d xt = θ ( F )ct
where:
Now, given x q + m + j ( j ≥ 1) the minimum mean square error for backward forecast of
xq +l at time q + m + 1 is
m −l
es (m + 1 − l) = ∑ψ j c q + l + j ,
~ s = q +m+1
j =0
62
xˆ q +l = w1l xˆ q (l) + w2 l ~
x s ( m + 1 + l)
where
w1l represent the weights yet to be calculated for the forward forecast,
∞
xˆ q (l) = ∑ π (jl ) x q − j +1 ,
j =1
∞
x s (m + 1 − l) = ∑ π (j m +1−l ) x q + m + j ,
~
j =1
l −1
π (jl ) = π j + l −1 + ∑ π hπ (jl − h ) and π (j1) = π j , j = 1,2,...
h =1
In order to calculate the weights ( w1l and w2 l ), we use the following equation:
E[ x q +l − w1l xˆ q (l) − w2 l ~
x s (m + 1 − l)]2 =
w12lσ 12 + w22lσ 21
2
+ 2 w1l w2 lσ 12 + 2 w1l (1 − w1l − w2 l )σ 10
where
∞
σ x2 = v( x q + l ) = (∑ψ 2j )σ z2 ,
j =0
l −1
σ 12 = v(eˆ) = (∑ψ 2j )σ z2 = σ 10 = cov(eˆ, x q +l ) ,
j =0
m−l
σ 22 = v(e~ ) = ( ∑ψ 2j )σ z2 = σ 20 = cov(e~, x q + l ) ,
j =0
eˆ = eˆq (l) ,
e~ = e~s (m + 1 − l) ,
63
and ψ 1 ' = (1ψ 1 ...ψ l −1 ) ,
D = (d ij ) is an l × (m + 1 − l) matrix with
d ij = E ( z q + l +1−i c q + l −1+ j )
∞
= ∑ (−π h )ψ h + i + j − 2 , π 0 = −1 ,
h =0
where
L11 = σ Z2 − σ 12 ; (31)
L12 = σ Z2 + σ 12 − σ 12 − σ 22 ; (33)
64
However in the non-stationary cases the variance is not finite and it creates a problem in
the mean square. In Abraham (1981) the proposed solution to this problem is:
(σ 22 − σ12 )
w 1l = , (36)
(σ12 + σ 22 − 2σ12 )
w 2l = 1 − w 1l
To gain further understanding of the principles detailed in this article, the above
approach is applied to some simple time series models. When only one observation is
missing, the forward and backward forecasts receive the same weighting. In addition, if
the model is non-stationary with difference equal to 1 (d=1), the estimate of the missing
value is an average of the forward and backward forecasts of the missing observations.
When a time series has one observation missing (m=1, l = 1 ), we will have the
following variance and standard deviations. Hence the weighting of the equation would
σ12 = σ 22 = σ 2z ,
∞
σ12 = (1 − ∑ π h ψ h )σ 2z (37)
h =1
w 11 = w 21 (38)
For this time series model, we have the following standards equation.
65
Rearrange equation (39), we can have the following equations:
θ(B)
Xt = Et
φ(B)
= (1 + ψ 1 B + ψ 2 B 2 + ...) Et
φ ( B)
Et = Xt
θ ( B)
= (1 − π 1 B − π 2 B 2 − ...) X t
When missing observation equal to 1 (m=1), we can obtain the variance as follow:
l −1
σ12 = v(ê) = ( ∑ ψ 2j )σ 2z (40)
j= 0
1−1
= ( ∑ ψ 02 )σ 2z
j= 0
= (1)σ 2z
= σ 2z
m −l
σ 22 = v(~e ) = ( ∑ ψ 2j )σ 2z (41)
j= 0
1−1
= ( ∑ ψ 02 )σ 2z
j= 0
= (1)σ 2z
= σ 2z
66
Example 4.7.1: Calculate weightings for ARIMA (1,0,0) model
(1 − φB)X t = E t (42)
1
Xt = Et
1 − φB
= (1 + φB + φ 2 B 2 + ...) Et
1 − φB
Et = Xt
1
Hence, we can substitute from (43) to (40) and obtain the following:
∞
σ 2x = v( x q + l ) = (∑ ψ 2j )σ 2z
j= 0
∞
σ 2x = v( x q + l ) = ( ∑ φ 2j )σ 2z
j= 0
= (1 + φ 2 + φ 4 + ...)σ Z2
⎛ 1 ⎞ 2
= ⎜⎜ ⎟⎟σ Z (44)
⎝1− φ
2
⎠
67
From equation (40) and (41) we have σ12 = σ 22 = σ 2z
We substitute equation (44) into equation (31) and obtained the following:
⎛ 1 ⎞ 2
L11 = ⎜⎜ ⎟⎟σ Z − σ Z2
⎝1− φ
2
⎠
⎛ φ2 ⎞ 2
L11 = ⎜⎜ ⎟⎟σ Z (45)
⎝1− φ
2
⎠
Substitute equation (44) into equation (32) and obtained the following:
⎛ 1 ⎞ 2
L 22 = ⎜⎜ ⎟⎟σ Z − σ Z2
⎝1− φ
2
⎠
⎛ φ2 ⎞ 2
L 22 = ⎜⎜ ⎟⎟σ Z (46)
⎝1− φ
2
⎠
Now, substitute equations (37), (40), (41) and (44) into (33) and we obtain
⎛ 1 ⎞ 2 ∞
L12 = ⎜⎜ ⎟⎟σ Z + (1 − ∑ π hψ h )σ z2 − σ Z2 − σ Z2
⎝1− φ
2
⎠ h =1
⎛ 1 ⎞ 2 ⎛ ∞ ⎞
= ⎜⎜ ⎟⎟σ Z + σ z2 − ⎜ ∑ π hψ h ⎟σ z2 − 2σ Z2
⎝1− φ
2
⎠ ⎝ h =1 ⎠
68
⎛ 1 ⎞ 2
= ⎜⎜ ⎟⎟σ Z + σ z2 − φ 2σ z2 − 2σ Z2
⎝1− φ
2
⎠
⎛ 1 − φ 2 (1 − φ 2 ) − (1 − φ 2 ) ⎞ 2
= ⎜⎜ ⎟⎟σ Z
⎝ 1−φ 2 ⎠
⎛ φ4 ⎞ 2
= ⎜⎜ ⎟⎟σ Z (47)
⎝1− φ
2
⎠
2 2
⎛ φ2 ⎞ ⎛ φ4 ⎞
H = ⎜⎜ ⎟⎟ (σ Z2 ) 2 − ⎜⎜ ⎟⎟ (σ Z2 ) 2
⎝1− φ ⎝1− φ
2 2
⎠ ⎠
φ 4 −φ8
H= (σ Z2 ) 2
(1 − φ )
2 2
⎛ φ2 ⎞ 2 ⎛⎛ φ 2 ⎞ 2 ⎛ φ 4 ⎞ 2⎞
⎜⎜ ⎟⎟σ Z ⎜ ⎜⎜ ⎟σ − ⎜⎜
2 ⎟ Z
⎟⎟σ Z ⎟
⎜ ⎟
⎝1− φ ⎠ ⎝⎝1 − φ ⎠ ⎝1− φ
2 2
⎠ ⎠
w1l =
φ 4 −φ8
(σ Z2 ) 2
(1−φ 2 2
)
⎛ φ2 ⎞ 2 ⎛⎛ φ 2 − φ 4 ⎞ 2⎞
⎜⎜ ⎟⎟σ Z ⎜ ⎜⎜ ⎟⎟σ Z ⎟
⎜ ⎟
⎝1− φ ⎠ ⎝⎝ 1 − φ
2 2
⎠ ⎠
=
φ4 −φ8
(σ Z2 ) 2
(
1−φ 2 2
)
69
φ 2 (φ 2 − φ 4 ) (1 − φ 2 )
2
= ×
(1 − φ 2 )2 φ 4 − φ 8
φ4 −φ6
=
φ 4 −φ8
φ 4 −φ6
=
(φ 4 − φ 6 )(1 + φ 2 )
1
=
1+φ 2
Therefore: w 2l = w 1l
X t = (1 − θB ) Et (48)
and from the time series model, we can establish the following :
∴ ψ 1 = −θ ; ψ2 = 0 ; ... ; ψ k = 0 (k > 1)
70
Also, equation (48) can also be expressed as
1
Et = Xt
1 − θB
Hence,
X t = (1 + θB + θ 2 B 2 + ...)E t
and
∴ π1 = − θ ; π 2 = −θ 2 ; ... ; π k = −θ k
∞
σ 2x = v( x q + l ) = (∑ ψ 2j )σ 2z
j= 0
σ x2 = (1 + θ 2 )σ Z2 (49)
σ12 = σ 22 = σ 2z
If we substitute equation (49) into (31) then the equation would become
L11 = (1 + θ 2 )σ Z2 − σ Z2
= θ 2σ Z2
71
To find L22 we have to substitute equation (49) into (32) and obtain
L 22 = (1 + θ 2 )σ Z2 − σ Z2
= θ 2σ Z2
( )
∞
L12 = 1 + θ 2 σ Z2 + (1 − ∑ π hψ h )σ z2 − σ Z2 − σ Z2
h =1
⎛ ∞ ⎞
( )
= 1 + θ 2 σ Z2 + σ z2 − ⎜ ∑ π hψ h ⎟σ z2 − 2σ Z2
⎝ h =1 ⎠
( )
= 1 + θ 2 σ Z2 + σ z2 − θ 2σ z2 − 2σ Z2
= (1 + θ 2 − θ 2 − 1)σ Z2
=0
( )
H = θ 2 (σ Z2 ) 2 − 0
2
=
(θ )σ ((θ )σ
2 2
Z
2 2
Z −0 )
(θ ) (σ )2 2 2
Z
2
=1
72
From equation (35) we know
and σ12 = σ 22 = σ 2z
Therefore w 2l = w 1l
1 − θB
Xt = Et
1 − φB
( )
= 1 + φB + φ 2 B 2 + ... (1 − θB )Et
= (... + (φ − θ )B + (φ 2 − φθ )B 2 + (φ 3 − φ 2θ )B 3 ...)Et
Hence,
1 − φB
Et = Xt
1 − θB
= (1 + θB + θ 2 B 2 + ...)(1 − φB )X t
73
(
= ... + θB − φB + θ 2 B 2 − φθB 2 + θ 3 B 3 − θ 2φB 3 ... X t )
= (... + (φ − θ )B + (θ 2 − φθ )B 2 + (θ 3 − θ 2φ )B 3 ...)X t
Hence,
∴ π1 = φ − θ ; π 2 = φθ − θ 2 ; .. ; π k = φθ k −1 − θ k (k > 1)
∞
σ 2x = v( x q + l ) = (∑ ψ 2j )σ 2z
j= 0
(
= 1 + (φ − θ ) + φ 2 − φθ
2
( ) + (φ
2 3
− φ 2θ )
2
)
+ ... σ Z2
(
= 1 + (φ − θ ) + φ 2 (φ − θ ) + φ 4 (φ − θ ) + ... σ Z2
2 2 2
)
{ [
= 1 + (φ − θ ) + φ 2 (φ − θ ) + φ 4 (φ − θ ) + ... σ Z2
2 2 2
]}
{ [ (
= 1 + (φ − θ ) 1 + φ 2 + φ 4 + ... σ Z2
2
)]}
⎧⎪ ⎡ 2⎛ ⎞⎤ ⎫⎪ 2
= ⎨1 + ⎢(φ − θ ) ⎜⎜
1
⎟⎟⎥ ⎬σ Z
⎪⎩ ⎣ ⎝1− φ ⎠⎦ ⎪⎭
2
⎛ (φ − θ ) 2 ⎞ 2
= ⎜⎜1 + ⎟⎟σ Z (52)
⎝ 1−φ 2 ⎠
⎛ (φ − θ ) 2 ⎞ 2
L11 = ⎜⎜1 + ⎟⎟σ Z − σ Z2
⎝ 1−φ 2 ⎠
⎛ (φ − θ ) 2 ⎞ 2
= ⎜⎜ ⎟⎟σ Z
⎝ 1−φ
2
⎠
74
Also, equation (32) L 22 = σ 2x − σ 22 would become
⎛ (φ − θ ) 2 ⎞ 2
L 22 = ⎜⎜1 + ⎟⎟σ Z − σ Z2
⎝ 1−φ 2 ⎠
⎛ (φ − θ ) 2 ⎞ 2
= ⎜⎜ ⎟⎟σ Z
⎝ 1−φ
2
⎠
( )( ) ( )( )
∞
∑ π h ψ h = (φ − θ)(φ − θ) + φ − φθ φθ − θ + φ − φ θ φθ − θ + ...
2 2 3 2 2 3
Consider :
h =1
= (φ − θ ) + φ (φ − θ )θ (φ − θ ) + φ 2 (φ − θ )θ 2 (φ − θ ) + ...
2
= (φ − θ ) + φθ (φ − θ ) + φ 2θ 2 (φ − θ ) + ...
2 2 2
(
= (φ − θ ) 1 + φθ + φ 2θ 2 + ...
2
)
2⎛ 1 ⎞
= (φ − θ ) ⎜⎜ ⎟⎟
⎝ 1 − φθ ⎠
=
(φ − θ )2
1 − φθ
As we know equation (33) is L12 = σ 2x + σ12 − σ12 − σ 22 , we can substitute equation (37)
⎛ (φ − θ )2 ⎞ 2 ∞
L12 = ⎜⎜1 + ⎟σ Z + (1 − ∑ π hψ h )σ z2 − σ Z2 − σ Z2
1−φ 2 ⎟
⎝ ⎠ h =1
⎛ (φ − θ )2 ⎞ 2 ⎛ ∞ ⎞
= ⎜⎜1 + ⎟σ Z + σ z2 − ⎜ ∑ π hψ h ⎟σ z2 − 2σ Z2
1−φ 2 ⎟
⎝ ⎠ ⎝ h =1 ⎠
⎛ (φ − θ )2 ⎞ 2 ⎛ (φ − θ )2 ⎞ 2
= ⎜⎜1 + ⎟σ Z + σ z2 − ⎜
⎟ ⎜ 1 − φθ
⎟σ z − 2σ Z2
⎟
⎝ 1−φ 2 ⎠ ⎝ ⎠
⎛ (φ − θ )2 (φ − θ )2 ⎞
= ⎜⎜1 + − − 1⎟⎟σ Z2
⎝ 1−φ 2
1 − φθ ⎠
75
⎛ (φ − θ )2 (1 − φθ ) − (φ − θ )2 (1 − φ 2 ) ⎞ 2
= ⎜⎜ ⎟σ Z
⎝ (1 − φ 2 )(1 − φθ ) ⎟
⎠
⎛ (φ − θ )2 (1 − φθ − 1 + φ 2 ) ⎞ 2
= ⎜⎜ ⎟σ Z
⎝ (
1 − φ 2
)(1 − φθ ) ⎟
⎠
⎛ (φ − θ )2 (φ 2 − φθ ) ⎞ 2
= ⎜⎜ ⎟σ Z
⎝ (1 − φ )(1 − φθ ) ⎠
2 ⎟
⎛ (φ − θ )2 ⎛ (φ − θ )2 (φ 2 − φθ ) ⎞
2 2
⎞
H = ⎜⎜ ⎟ (σ Z2 ) 2 − ⎜
⎟
⎟
⎜ (1 − φ 2 )(1 − φθ ) ⎟ (σ Z )
2 2
⎝ 1−φ
2
⎠ ⎝ ⎠
⎛ (φ − θ )4 ⎞ 2 2 ⎛ (φ − θ )4 (φ 2 − φθ )2 ⎞ 2 2
=⎜ ⎟(σ Z ) − ⎜ ⎟(σ Z )
⎜ (1 − φ 2 )2 ⎟ ⎜ (1 − φ 2 )2 (1 − φθ )2 ⎟
⎝ ⎠ ⎝ ⎠
⎛ (φ − θ )4 (1 − φθ )2 − (φ − θ )4 (φ 2 − φθ )2 ⎞ 2 2
=⎜ ⎟(σ Z )
⎜
⎝ (1 − φ 2 )2 (1 − φθ )2 ⎟
⎠
⎛ (φ − θ )2 ⎞ 2 ⎛ ⎛ (φ − θ )2 ⎞ 2 ⎛ (φ − θ )2 φ 2 − φθ
⎜ ⎟ ⎜⎜ ⎟ ⎜
( ) ⎞⎟σ ⎞
⎟
⎜ 1 − φ 2 ⎟σ Z ⎜ ⎜ 1 − φ 2 ⎟σ Z − ⎜ 1 − φ 2 (1 − φθ )
2
⎝ ⎠ ⎝⎝ ⎠ ⎝ ( ) ⎟
⎠
Z
⎟
⎠
w1l =
(
⎛ (φ − θ )4 (1 − φθ )2 − (φ − θ )4 φ 2 − φθ 2 ⎞ 2
⎜ ⎟σ z )
⎜
⎝ ( )
1 − φ (1 − φθ )
2 2 2 ⎟
⎠
(φ − θ )4 (1 − φθ ) − (φ − θ )4 (φ 2 − φθ ) (
1 − φ 2 ) (1 − φθ )
2 2
= ×
(1 − φ 2 )2 (1 − φθ ) (φ − θ )4 (1 − φθ )2 − (φ − θ )4 (φ 2 − φθ )2
=
(1 − φθ ) − (φ 2 − φθ ) × (1 − φθ )
1 (1 − φθ )2 − (φ 2 − φθ )2
1 − φθ
=
1 − φθ + φ 2 − φθ
1 − φθ
=
1 − 2φθ + φ 2
76
(σ 2x − σ12 )[(σ 2x − σ 22 ) − (σ 2x + σ12 − σ12 − σ 22 )]
As we know that w 2l =
(σ 2x − σ12 )(σ 2x − σ 22 ) − (σ 2x + σ12 − σ12 − σ 22 ) 2
and σ12 = σ 22 = σ 2z
Therefore: w 2l = w 1l
(σ 22 − σ12 )
w 1l = ,
(σ12 + σ 22 − 2σ12 )
σ12 = σ 22 = σ 2z
(σ 2z − σ12 )
Therefore: w 1l =
(σ 2z + σ 2z − 2σ12 )
1
w 1l =
2
Also w 2l = 1 − w 1l
1
Therefore: w 2l =
2
77
The weightings for the above cases are summarized in the following table:
1
(1,0,0)
(1 + φ 2 )
(0,0,1) 1
(1 − φθ)
(1,0,1)
(1 + φ 2 − 2φθ)
1
(p,1,r)
2
When two observations are missing, the two values of forward forecast should be
unequally weighted and this also should apply to the two values of backward forecast.
However, the first value of the forward forecast and the second value of the backward
forecast (also the second value of the forward forecast and the first value of the
For the situation where two observations are missing (m=2), we have
l = 1 , σ12 = σ 2z
σ 22 = (1 + ψ 12 )σ 2z
∞ ∞
σ12 = {(1 − ∑ ψ h π h ) + ψ 1 (ψ 1 − ∑ π h ψ h +1 )}σ 2z
h =1 h =1
l = 2 , σ12 = (1 + ψ 12 )σ 2z
σ 22 = σ 2z
∞ ∞
σ12 = {(1 − ∑ ψ h π h ) + ψ 1 (ψ 1 − ∑ π h ψ h +1 )}σ 2z
h =1 h =1
78
The weightings for these cases are summarized in the following table:
1 (1 + φ 2 ) 1
(1 + φ 2 + φ 4 ) (1 + φ + φ 4 )
2
(1,0,0)
2 w 21 w 11
(1,0,1)
2 w 21 w 11
1 1 + (1 + φ)(1 + φ − φ 3 ) 1- w 11
2 + (1 + φ)(1 + φ − 2φ 3 )
(1,1,0)
2 1- w 11 w 11
1 2−θ 1- w 11
3−θ
(0,1,1)
2 1- w 11
w 11
In 1979, an alternative approach which produced the same results as Abraham was
developed by Eivind Damsleth to find the optimal linear combination of the forward
and backward forecast for missing values in an ARIMA time series. Abraham was
unaware of Damsleth results at the time of writing his paper. The method is based on
the idea of using cross covariance to generate parameters for biased linear combination
for forward and backward forecast with a minimum error. The author states the method
requires the data to have sufficient length for parameters and the model to estimate
correctly. With shorter data length the problem is more difficult and is not discussed
79
within this paper. The advantage of this method is that it provides a step by step
algorithm for the reader to follow. Using the notation of this thesis, the algorithm as
i) Calculate the optimal forecast eˆq (l) using φ ( B)(1 − B ) d X t = θ ( B) Et and the
optimal backforecast ~
es (m + 1 − l) using φ(F)(1 − F) d x t = θ(F)c t .
θ ( B)
ii) Calculate the coefficients π j of B j in the polynomial expansion of for
φ ( B)
j = 0,1, K, max(l − 1, m − l ) .
⎛ p+ j
⎞
θ ( F )⎜⎜1 − ∑ φ i B i ⎟⎟γ ae ( j − s ) = ±α j σ 2 , − p ≤ j ≤ 0 ,
⎝ i =1 ⎠
⎛ q− j
⎞
θ ( B)⎜⎜1 − ∑θ i F i ⎟⎟γ ae ( j − s) = ±α jσ 2 , 0 ≤ j ≤ q ,
⎝ i =1 ⎠
⎧ 0 j < −p
⎪ min( p + j ,q )
⎪− φ − j + ∑ φ i − j θ i − p ≤ j ≤ −1
⎪ i =1
⎪⎪ min( p ,q )
α j = ⎨ 1 + ∑ φ iθ i j=0
⎪ i =1
min( p ,q − j )
⎪
⎪ − θ j + ∑ φ iθ i + j 1≤ j ≤ q
⎪ i =1
⎪⎩ 0 j>q
80
iv) Calculate
l −1
v(eˆ) from (∑ψ 2j )σ z2 ,
j =0
m −l
v(e~) from (∑ψ 2j )σ z2 , and
j =0
l −1 m − l
σ 12 = ∑∑ψ iψ j γ ae (i + j ) where γ ae (k ) is the cross covariance function
i =0 k =0
( Ex 2 − σ 12 )c + ( Ex 2 + σ 12 − σ 12 − σ 22 )d = Ex 2 − σ 12
( Ex 2 + σ 122 − σ 12 − σ 22 )c + ( Ex 2 − σ 22 )d = Ex 2 − σ 22
σ 22 − σ 12
c= and d = 1 − c .
σ 12 + σ 22 − 2σ 12
81
CHAPTER 5
Recently, state space modelling has become a popular approach in time series analysis.
The main advantage of this approach is that it can adapt to different time series models
such as the Box-Jenkins ARIMA and Structural Time Series. This approach emphasises
the notion that a time series is a set of distinct components. Thus, we may assume that
observations relate to the mean level of the process through an observation equation,
whereas one or more state equations describe how the individual components change
through time. In state space modelling, observations can be added one at a time and the
estimating equations are then updated to produce new estimates. In this chapter, we will
investigate the above approach and determine the most suitable time series model(s) for
assumes that the state of the process summarizes all the information from the past that is
more random variables θ t1 ,..., θ td which also occur at time t but which are not
observed. These variables are called the state variables and we can represent them by
vector θ t = (θ t1 ...θ td ) T .
The simplest model is to assume that X t is a linear function of θ ti which is shown as:
The equation (53) above is called measurement or observation equation and can be
X t = H Tθt + ε t
Although the state vector θ t is not directly observable, it is assumed that we know how
θ t changes through time and we are able to use the observation on X t to make
83
θ t2 = G21θ t1−1 + G22θ t2− 2 (55)
From equations (54) & (55), we can create the following coefficient matrix
⎡G G12 ⎤
G = ⎢ 11
⎣G 21 G 22 ⎥⎦
As usual, we have to build random noise terms into each equation to make the model
more flexible. To achieve this flexibility, we introduce the random noise vector η t into
our model. For instance, where the state dimension is 2 and there are 2 independent
random variables of noise with zero mean together with the noise vector of
As G describes the evolution from one state to the next it is called the transition matrix,
and K is called the state noise coefficient matrix for obvious reasons. (Gareth Janacek
The advantages of using state space modelling is that it is possible to put many types of
time-series models into the state space formulation. This is illustrated by the following
three examples.
84
Example 5.2.1 A simple state space model
X t = (0.5 0.5)θ t + ε t
⎡0.7 0 ⎤ ⎡1⎤
And θt = ⎢ ⎥θ t −1 + ⎢ ⎥η t
⎣ 2 0.8⎦ ⎣0.5⎦
Note : The matrix H , matrix G , matrix K all contain parameters of the model. If
these parameters are unknown they must be estimated. It is important to remember that,
in general, the state variables are not observed. Notice also that all the information in
the past of the series { X t } which can influence X t must be contained only in the state
variables θ t .
The state space modelling is assumed to have the following assumptions (Harvey, 1989,
and
⎡ε t ( ss ) ⎤ ⎛ ⎡Z t 0 ⎤⎞
⎢ η ⎥ ~ NID⎜⎜ 0, ⎢ 0 ⎟
Qt ⎥⎦ ⎟⎠
⎣ t ⎦ ⎝ ⎣
Two further assumptions are specified by (Harvey, 1981, pp. 101-102) for the state
space system:
85
c) The initial state vector, θ 0 , has a mean of a 0 and a covariance matrix P0 , that
d) The observation errors ε t (ss ) and η t are uncorrelated with each other in all time
Example 5.2.2 : Using state space modelling for the ARMA (p,p-1) model.
The ARMA (p,p-1) model representation can be obtained by changing the elements of
When ARMA is incorporated into state space model framework consideration must be
X t = α 1 X t −1 + α 2 X t − 2 + α 3 X t −3 + Z t + β 1 Z t −1 + β 2 Z t − 2
Since it has only one equation and one noise series, it does not seem compatible with
86
However, let us assume the following:
X t = (1 0 0)θ t ,
⎡α 1 1 0⎤ ⎡1⎤
θ t = ⎢⎢α 2 0 1⎥ X t −1 + ⎢⎢ β1 ⎥⎥η t
⎥ (56)
⎢⎣α 3 0 0⎥⎦ ⎢⎣ β 2 ⎥⎦
When we begin at the bottom row of (56), the state equation is X t3 = α 3 X t1−1 + β 2η t
The second row (56), the state equation is X t2 = α 2 X t1−1 + X t3−1 + β1ηt
Finally, when we look at the first row of (56), the state equation is
X t1 = α 1 X t1−1 + X t2−1 + η t
which is an ARMA model equation but in the first component of the state X t1 with
noise term Z t .
ARIMA models may also be represented in state space form. Harvey and Phillips(1979)
derived an exact maximum likelihood estimation procedure for ARIMA models. One
87
advantage of this approach is the ability to handle missing observations since we may
simply ‘update’ the estimates; that is, we may replace the missing observations by its
Other than regression ARMA models, state space modelling can also represent a trend-
appropriate. In order to apply state space modelling for ARIMA models, we need to
know H and G parameters in the model equations and also to know the variances and
covariances of the disturbance terms. The choice of suitable values for H and G
and preliminary examination of the data. In other words, the use of state space
modelling does not help to take away the usual problem of finding a suitable type of
model. (C.Chatfied 1994) Initially, we assume that such parameters are known;
Structural time series models are a specific type of state space models. These are
modelled as a sum of meaningful and separate components and are well suited to stock
assessment.
88
A Basic Structural Model is represented as the observed value in terms of one or more
unobserved components, called the state vector. These components can be divided into
S −1
separate groups. Thus, a “s” seasonal is γ t = −∑ γ t − j + η t
j =1
The structural model can be represented in a state space form. That is, the one-
example, assuming s = 4 , the basic structural model has the following observation
Observation Equation
⎡ μt ⎤
⎢β ⎥
⎢ t ⎥
X t = [1 0 1 0 0] ⎢ γ t ⎥ + ε t
⎢ ⎥
⎢ γ t −1 ⎥
⎢⎣γ t − 2 ⎥⎦
Transition Equation
⎡ μ t ⎤ ⎡1 1 0 0 0 ⎤ ⎡ μ t −1 ⎤ ⎡1 0 0⎤
⎢ β ⎥ ⎢0 1 0 0 0 ⎥⎥ ⎢⎢ β t −1 ⎥⎥ ⎢⎢0 1 0⎥⎥ ⎡η t(1) ⎤
⎢ t ⎥ ⎢ ⎢ ⎥
⎢ γ t ⎥ = ⎢0 0 − 1 − 1 − 1⎥ ⎢ γ t −1 ⎥ + ⎢0 0 1⎥ ⎢η t( 2) ⎥
⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢ γ t −1 ⎥ ⎢0 0 1 0 0 ⎥ ⎢γ t − 2 ⎥ ⎢0 0 0⎥ ⎢⎣η t(3) ⎥⎦
⎢⎣γ t −2 ⎥⎦ ⎢⎣0 0 0 1 0 ⎥⎦ ⎢⎣γ t −3 ⎥⎦ ⎢⎣0 0 0⎥⎦
89
The state space modelling can then be applied to determine the local level, trend and
seasonal components. Without the seasonal component, structural models will be:
X t = μt + ε t (57)
μ t = μ t −1 + β t −1 + η t(1) (58)
β t = β t −1 + η t( 2) (59)
The equations (57), (58) and (59) above can be referred to as a linear growth model. The
the local level, which changes through time and β t is the local trend which may evolve
through time.
⎡μ t ⎤
X t = [1 0] ⎢ ⎥ + ε t
⎣β t ⎦
⎡ μ t ⎤ ⎡1 1⎤ ⎡ μ t −1 ⎤ ⎡1 0⎤ ⎡η t(1) ⎤
⎢ β ⎥ = ⎢0 1⎥ ⎢ β ⎥ + ⎢0 1⎥ ⎢ ( 2) ⎥ , or
⎣ t⎦ ⎣ ⎦ ⎣ t −1 ⎦ ⎣ ⎦ ⎣η t ⎦
⎡1 1⎤ ⎡1 0⎤
θt = ⎢ ⎥θ t −1 + ⎢ ⎥η t
⎣0 1⎦ ⎣0 1 ⎦
For all the main structural models, the observation equation involves a linear function of
the state variables and yet does not restrict the model to be constant through time.
Rather it allows local features such as trend and seasonality to be updated through time
90
5.4 The Kalman Filter
In state space modelling, the prime objective is to estimate the state vector θ t . When
prediction, if we are trying to update current estimators then the process is called
filtering and if we are trying to find past estimators, the process is called smoothing.
The Kalman Filter provides us with a set of equations which allows us to update the
estimate of θ t when new observations become available. There are two stages involved
in this process which are called the prediction stage and the updating stage.
Firstly lets consider the update equation for state space model
θ t = Gθ t −1 + Kη t ,
where η t is still unknown at time t − 1 , therefore the estimator for θ t can be written as
∧ ∧
θ t |t −1 = Gt θ t −1
∧
where θ t −1 is the best (minimum mean square) estimator for θ t −1 and the resulting
∧
estimator as θ t|t −1 .
91
∧
Secondly the variance-covariance matrix Pt|t −1 of the estimator error of θ t|t −1 is given by
When the new observation becomes available, the estimator of θ t can be modified to
make adjustments for the additional information. Consider the state space model
X t = H Tθt + ε t .
∧
Now, the prediction error is given by ε t = X t − H T θ t |t −1 and it can be shown that the
∧ ∧
θ t = θ t −1 + K t ε t
and
Pt = Pt |t −1 − K t H T Pt |t −1
where
A major advantage of the Kalman Filter is that the calculations are recursive, therefore
the current estimates are based on the whole past. Also, the Kalman Filter converges
92
fairly quickly when there is a constant underlying model, but can also follow the
on independent Gaussian random vectors with zero means. The likelihood function is
defined as
n n
− 2 ln LY (θ ) = ∑ log Σ t (θ ) + ∑ ε t (θ ) Σ t (θ ) ε t (θ )
' −1
t =1 t =1
In this case, the most convenient way is to use Kalman filter recursions. The Kalman
filter recursions is a set of recursive equations that are used to estimate parameter values
The usual procedure is to set an initial value x0 and then use Kalman filter recursions
for the log likelihood function and its first two derivatives. Then, a Newton-Raphson
algorithm can be used successively to update the parameter values until the log
likelihood is maximized.
93
5.4.4 The Expectation-Maximisation (EM) Algorithm
When we consider the unobserved signal process θ t and an unobserved noise process
ε t (ss ) . Both processes form the function X t which is an incomplete data set. Log
likelihood log L(θ , Ψ ) may be based on the complete data set, or an incomplete data
set, where the parameters denoted by the matrix Ψ are to be estimated. For the
likelihood, the maximisation technique is usually very easy, except for the unobserved
invariant as follows:
X t = H T θ t + ε t (ss ) ,
θ t = Ttθ t −1 + Rtη t ,
94
with a0 and P0 are known, and Var (η t ) = Q is unrestricted. If the elements in the state
vector are observed for t = 0,..., N , the log-likelihood function for the X t ’s and θ t ’s
would be:
N N 1 N
log L( X t , θ ) = −
2
log 2π − log h −
2
∑ ( X t − H tθ t ) 2
2h i =1
Nn N 1 N
− log 2π − log Q − ∑ (θ t − T *θ t −1 )' Q −1 (θ t − Nθ t −1 )
2 2 2 i =1
n 1 1
− log 2π − log P0 − (θ 0 − a 0 ) P0−1 (θ 0 − a 0 ) .
2 2 2
⎡ ∂ log L ⎤
E⎢ | XN ⎥.
⎣ ∂Ψ ⎦
The expression is then set to a vector of zeros and solved to yield a new set of estimates
of Ψ . The likelihood will remain the same or increase at each iteration under suitable
In general, if we have the complete data set, we could then use the results from
In the case of incomplete data set, EM algorithm gives us an iterative method for
95
finding the maximum likelihood estimations of θ , by successively maximizing the
The overall procedure can be regarded as simply alternating between the Kalman
filtering and smoothing recursions and the multivariate normal maximum likelihood
estimators.
In practice, the Kalman filter equations are more easily to cope with missing values.
processed as usual, the updating equations cannot be processed but can be replaced by
^ ^
Pt = Pt |t −1 and θ t = θ t |t −1 .
If there is a second consecutive missing value, the prediction equations can be processed
again to give
^ ^ ^
θ t +1|t = G θ t = G 2 θ t −1 ,
96
This concept can be extended to cases with any number of consecutive missing values.
^
In addition, we can use the result of θ t 's and Pt 's as parameters in smoothing
algorithms and to efficiently obtain the estimation of the missing data themselves.
(C.Chatfied 1994)
It is very complicated to estimate the model manually and I have used the computer
estimate the time series model. The computer program, based on the work of Professor
Andrew Harvey and written primarily by Simon Peters, carries out the estimation and
testing of structural time series models. The Kalman filter plays a key role in handling
the model.
97
Figure 5.1 Plot of 71 observations on purse snatching in Chicago
From Figure 5.1, it appears that the data series have the following properties:
a) The model consists of a level and it evolve slowly over time according to a
98
Using "STAMP" to estimate to the model and the results are as follow :
99
The estimated model seems to fit the data quite well. The PURMISS data series is the
purse series, with a run of missing observations. I have used a similar technique in an
Figure 5.4 Plot on purse snatching in Chicago with a run of missing observations.
From Figure 5.4, it appears that the data series has the following properties :
a) The model consists of a level and it evolves slowly over time according to a
stochastic (random) mechanism.
Using "STAMP" to estimate to the model and the results are as follow :
100
Figure 5.6 Actual values and fitted values on purse snatching in Chicago.
Note: the fitted value on the graph have been shifted 1 time interval forward by the
software.
101
CHAPTER 6
In this chapter, we apply various estimation methods to simulated data sets derived from
different time series models. From this exercise, we can gain an insight on how each
method performs for different time series situations and make appropriate comparisons
In order to test the effectiveness of each estimation method, we require many data sets
representing different time series models. One way to obtain such a large amount of
data is by simulation using the computer. In this thesis, we have chosen to use Microsoft
Excel and Minitab for our data generation process. Microsoft Excel is a popular
popularity and easy access. The other package we used for data generation is Minitab.
By creating macros, both packages can generate specific time series data sets without
any difficulty. The specific time series models we are going to generate are AR and MA
We chose these specific Time Series Models because they are simple stationary Box-
Jenkins models that facilitate easy comparison for different parameters values. The
102
analysis will also apply for nonstationary data sets where transformations can be applied
Where the standard deviation (SD) relates to the purely random process; the data sets
We will set a single missing value at various positions for each data set. By using this
setup, we should be able to assess the performance of each method for different time
series models with missing values in different positions. For different estimation
ARIMA interpolation: Missing value at position 7, 14, 21, 28, 35, 42, 49,
To start our testing, we will first consider numerical analysis methods such as least
square approximation (polynomial curve fitting) and cubic spline curve fitting. Then we
apply ARIMA modelling using forecasting and weighted means. Finally we will
examine state space modelling. After we have applied each of the above methods, we
will examine our results to compare the efficiencies of each method for different time
series models.
The objective of least square approximation is to fit a data set with various non-linear
polynomial functions. The aim is to identify the appropriate polynomial degree with the
It could be predicted that this method is best suited for time series with a highly
irregular pattern. As there is no requirement for users to define a time series model for
the data set, we believe this method is suitable for general curve fitting situations.
104
For this method, we have used an excel plug-in written by “Advanced Systems Design
and Development”. We applied the plug-in and created a spreadsheet that will fit
polynomial.
The simulation was carried out by following a number of steps. These were:
2. Take out a specific value from the data set and store it at another cell for
comparison.
3. Apply the plug-in and try to fit the data set with different degrees of
polynomials.
4. Calculate the absolute deviation for the missing value of the absolute deviations.
5. Repeat the process one hundred times, determine the MAD and standard
deviation.
105
For each model the polynomial degree with lowest MAD is highlighted.
The results are as follows for AR time series with missing value at position 49:
Table 6.2.1 AR time series model with missing value at position 49.
Summary Table 2 deg 3 deg 4 deg 5 deg 6 deg 7 deg
106
For the AR1 model, as the Phi values approaches 1 the data has less fluctuation. The
table for Phi values greater than 0.4 shows that a higher degree of polynomial provides
the minimum MAD. Where the Phi values are negative the data fluctuates more. In this
According to our result, the relationship between mean absolute deviation and standard
standard deviation of the random noise by scale of 10, then the mean absolute deviation
When Phi values are positive we notice that there is a positive relationship between Phi
values and the mean absolute deviation. As the Phi values increase the mean absolute
deviation increases.
0.2 0.032494
0.4 0.034098
0.6 0.037837
0.8 0.043769
-0.2 0.032931
-0.4 0.034486
-0.6 0.038281
-0.8 0.050942
107
Table 6.2.3 Missing value at position 49, SD = 0.4.
0.2 0.322696
0.4 0.337069
0.6 0.373327
0.8 0.425059
-0.2 0.331757
-0.4 0.358198
-0.6 0.408827
-0.8 0.532352
In order to show the effectiveness of polynominal curve fitting for time series data, the
best MAD value is plotted against different Phi values and then graphed as seen in
tables 6.2.2 and 6.2.3. These results show that when the missing value is at position 49
this method is best suited when the Phi values are closer to 0. It should also be noted
that the standard deviation of the MAD decreases as Phi approaches 0. The above
process and analysis is repeated for missing values at beginning and end of data.
108
Table 6.2.4 summarizes the results for missing data at position 7.
109
The simulation for missing value at 7 indicated that if the missing value is at the
beginning of the AR1 data set, then we have to increase the degree of polynomials in
order to achieve a smaller MAD. When the Phi value is negative then we do not require
small MAD. Tables 6.2.5-6.2.6 also shows the best MAD value corresponding to
0.2 0.035862
0.4 0.03967
0.6 0.041655
0.8 0.043019
-0.2 0.031406
-0.4 0.034053
-0.6 0.039208
-0.8 0.054966
110
Table 6.2.6 Missing value at position 7, SD = 0.4.
0.2 0.356625
0.4 0.38571
0.6 0.408248
0.8 0.427964
-0.2 0.308674
-0.4 0.331096
-0.6 0.381146
-0.8 0.513513
The graph of best MAD values plotted for missing value at position 7 as given in
Figures 6.3 and 6.4 is similar to missing value at position 49 except that the MAD
values are higher for positive Phi values less than 0.6.
The result for an AR simulation with missing value 91 is provided in table 6.2.7.
111
Table 6.2.7 AR time series model with missing value at position 91.
112
The above simulation indicated that if the missing value is at the end of the AR1 data
set, then two degrees polynomial should be used to make a reasonable estimation for
positive Phi values. This is because it is difficult to fit a high degree polynominal curve
The best MAD values corresponding to different Phi values are provided in tables 6.2.8-
0.2 0.034568
0.4 0.033622
0.6 0.034753
0.8 0.035638
-0.2 0.034802
-0.4 0.039307
-0.6 0.046854
-0.8 0.06013
113
Table 6.2.9 Missing value at position 91, SD = 0.4.
0.2 0.332383
0.4 0.329914
0.6 0.336848
0.8 0.357084
-0.2 0.345201
-0.4 0.382155
-0.6 0.448595
-0.8 0.591065
For any AR time series model with lots of data points before the missing value, the
graph indicates that as the Phi value increases, the MAD value will become smaller than
for the data with a missing value at the beginning or middle. As a result, this method is
It can be concluded that for any AR1 process where there is a sufficient amount of past
data available, polynomials of two or three degrees should give a reasonable estimation.
If the missing value is at the beginning of the data set, then we should reverse the data
set and calculate the missing value with two degree polynomial or just use polynomial
The results are as follows for Moving Average time series with missing values at
position 49.
114
Table 6.2.10 MA time series model with missing value at position 49.
Summary Table 2 deg 3 deg 4 deg 5 deg 6 deg 7 deg
115
Summary Table 2 deg 3 deg 4 deg 5 deg 6 deg 7 deg
The MA1 time series model has more random noise within the data and for all positive
Theta values the simulation indicated that if the missing value is in the middle of the
data set then a high degree polynomial is required to give a reasonable estimation.
Whereas, the negative Theta values consist of more random noise so therefore the
behaviour of the time series model shows an erratic pattern which suggests that a lower
degree polynominal is sufficient to achieve a small MAD. It can be noted that the
standard deviation of the MAD values are smaller when the Theta values are closer to 0.
In addition, similar to the AR data, the MAD values and the standard deviation of the
116
Best MAD vs Theta Values
Table 6.2.11 Missing value at position 49, SD = 0.04.
-2.5 0.086399
-2 0.073048
-1.5 0.05864
-1 0.045712
-0.5 0.036391
0 0.031823
0.5 0.034744
1 0.042862
1.5 0.053767
2 0.06792
2.5 0.083524
-2 0.751332
-1.5 0.613804
-1 0.480751
-0.5 0.376366
0 0.321934
0.5 0.345883
1 0.438885
1.5 0.553886
2 0.690322
117
The graph shows the best MAD values plotted for missing value at position 49 indicates
that minimum MAD is achieved when Theta value is zero i.e. purely random process.
For the MA process the standard deviation of the MAD also decreases as Theta
approaches 0. For larger positive and negative Theta values the estimation is unreliable
The following table summarizes the results for missing data at position 7.
118
Summary Table 2 deg 3 deg 4 deg 5 deg 6 deg 7 deg
In the case of missing value at position 7, it is difficult to predict the appropriate degree
of polynomial to be used for different positive Theta values. One possible explanation
is that there is insufficient data before the missing value. Where, the negative Theta
values consist of more random noise so therefore the behaviour of the time series model
shows an erratic pattern which suggests that a lower degree polynomial is sufficient to
119
Best MAD vs Theta Values
Table 6.2.14 Missing value at position 7, SD = 0.04.
MA1 missing value 7
-2.5 0.081078
-2 0.066444
-1.5 0.054124
-1 0.043392
-0.5 0.034744
0 0.032394
0.5 0.043533
1 0.056781
1.5 0.07014
2 0.084502
2.5 0.099148
-2 0.683059
-1.5 0.546551
-1 0.431226
-0.5 0.342795
0 0.321829
0.5 0.417596
1 0.54341
1.5 0.677652
2 0.824428
The graph of best MAD values plotted for missing value at position 7 as given in
120
The result for an MA simulation with missing value 91 is provided in table 6.2.16.
Table 6.2.16 MA time series model with missing value at position 91.
Summary Table 2 deg 3 deg 4 deg 5 deg 6 deg 7 deg
121
Summary Table 2 deg 3 deg 4 deg 5 deg 6 deg 7 deg
Where there are lots of data points given before the missing value there will be lots of
random noise within this type of time series model, whether it is a positive or negative
Theta model. As a result it is difficult to impose a high degree polynominal to fit the
data set. The two degree polynominal should be used because it will provide the most
-2.5 0.09355
-2 0.07737
-1.5 0.063922
-1 0.051664
-0.5 0.040358
0 0.03409
0.5 0.034356
1 0.043939
1.5 0.057413
2 0.072301
2.5 0.087813
122
Table 6.2.18 Missing value at position 91, SD = 0.4.
MA1 missing value 91
-2 0.769816
-1.5 0.623993
-1 0.507052
-0.5 0.400369
0 0.334591
0.5 0.34107
1 0.435317
1.5 0.557875
2 0.703024
From the result above, it can be concluded that for any MA1 process with sufficient
amount of past data available, polynomials of two degrees should give a reasonable
estimation. If the missing value is at the beginning of the data set, then we should
reverse the data set and calculate the missing value with three degrees polynomials or
In conclusion, the results show that when the missing value is at position 49 this method
is best suited when the Theta values are closer to 0 and a minimum MAD is achieved.
The same conclusion can be applied to the case when the missing values appear at
position 91. Whereas, position 7 shows that the value of MAD still retains a minimum
value when the Theta value is close to 0. However, when the Theta value is positive the
results show that there is a significant increase in the MAD value. In conclusion this
method is not suitable for use when there is a large positive value and the missing value
123
6.3 Applying Cubic Spline to Box-Jenkins Models
Another common strategy for fitting data point is “interpolating with a cubic spline”. It
fits a “cubic polynomial” to the known data, using cross-validation between each pair of
adjacent points to set the degree of smoothing and estimate the missing observation by
The excel plug-in that was used to calculate the polynomial fit, also contained an
additional function for fitting cubic spline which was used to create a spreadsheet to
The prediction about this method is that it requires a substantial amount of data points to
be made available before the missing value can be calculated and this method can be
considered reliable.
2. Take out a specific value from the data set and store it at another cell for
comparison.
After repeating the process one hundred times, the MAD and standard deviation were
determined.
124
For AR1 case with missing data at 49, 7 and 91 the following results were obtained.
MAD
6 AR 1 -0.4 0.04 0.070114 0.08
0.06
0.053983
0.04
7 AR 1 -0.6 0.04 0.092945 0.02
0.068056 0
-1 -0.5 0 0.5 1
8 AR 1 -0.8 0.04 0.148629
0.104152
Missing 49
Summary Table Spline
No. Case Al1 SD MAD/SD
1 AR 1 0.2 0.4 0.40977
0.317756
2 AR 1 0.4 0.4 0.353888
0.281916
3 AR 1 0.6 0.4 0.310098
0.251666
4 AR 1 0.8 0.4 0.279394
0.22515 1.6
1.4
5 AR 1 -0.2 0.4 0.58708
1.2
MAD
0.434717 1
6 AR 1 -0.4 0.4 0.731758 0.8
0.6
0.540099 0.4
7 AR 1 -0.6 0.4 0.9714 0.2
0
0.706594
-1 -0.5 0 0.5 1
8 AR 1 -0.8 0.4 1.497991
1.075714
125
Table 6.3.3 AR1 Missing at position 7, S.D. 0.04.
Missing 7
Summary Table Spline
No. Case Al1 SD MAD/SD
1 AR 1 0.2 0.04 0.036933
0.029247
2 AR 1 0.4 0.04 0.032707
0.026057
3 AR 1 0.6 0.04 0.028611
0.023351
4 AR 1 0.8 0.04 0.02631
0.2
0.021008
5 AR 1 -0.2 0.04 0.053964 0.15
MAD
0.042607
0.1
6 AR 1 -0.4 0.04 0.069433
0.054567 0.05
7 AR 1 -0.6 0.04 0.09659
0
0.075585
-1 -0.5 0 0.5 1
8 AR 1 -0.8 0.04 0.166033
0.122178
Case 3 Missing 7
Summary Table Spline
No. Case Al1 SD MAD/SD
1 AR 1 0.2 0.4 0.382207
0.297965
2 AR 1 0.4 0.4 0.33237
0.261229
3 AR 1 0.6 0.4 0.297167
0.234628
4 AR 1 0.8 0.4 0.264613
2
0.206865
5 AR 1 -0.2 0.4 0.532985 1.5
MAD
0.41526
1
6 AR 1 -0.4 0.4 0.669776
0.526743 0.5
7 AR 1 -0.6 0.4 0.920359
0
0.72088
-1 -0.5 0 0.5 1
8 AR 1 -0.8 0.4 1.547551
1.137891
126
Table 6.3.5 AR1 Missing at position 91, S.D. 0.04.
Missing 91
Summary Table Spline
No. Case Al1 SD MAD/SD
1 AR 1 0.2 0.04 0.046382
0.033514
2 AR 1 0.4 0.04 0.040234
0.029274
3 AR 1 0.6 0.04 0.03546
0.025787
4 AR 1 0.8 0.04 0.031523
0.2
0.023014
5 AR 1 -0.2 0.04 0.064524 0.15
MAD
0.047818
0.1
6 AR 1 -0.4 0.04 0.081325
0.059358 0.05
7 AR 1 -0.6 0.04 0.110424
0
0.078182
-1 -0.5 0 0.5 1
8 AR 1 -0.8 0.04 0.158685
0.117034
Case 4 Missing 91
Summary Table Spline
No. Case Al1 SD MAD/SD
0.470317
1
6 AR 1 -0.4 0.4 0.813471
0.594619 0.5
7 AR 1 -0.6 0.4 1.075999
0
0.788663
-1 -0.5 0 0.5 1
8 AR 1 -0.8 0.4 1.574595
1.190278
127
The graphs in Figures 6.13-6.18 show the MAD value when using the ‘interpolating
cubic spline smooth curve’ method. Graph results show that regardless of the position
of the missing value ie 7, 49 or 91 the MAD achieved by this method will produce a
similar result. For negative Phi values the MAD and SD of the MAD is significantly
larger. The overall performance of using the cubic spline method indicates that as the
Phi values changes from negative to positive the MAD value decreases in an
exponential manner. Clearly this method is best suited to the AR1 time series model
with positive Phi values. According to all the results, the absolute deviation and
standard deviation of the random data used to generate the data are in direct proportion
to each other.
For the MA simulated data we obtain the following results for missing data at 49, 7 and
91.
Table 6.3.7 MA1 Missing at position 49, S.D. 0.04.
Missing 49
Summary Table Spline
No. Case Theta1 SD MAD/SD
1 MA 1 -2.5 0.04 0.163606
0.119362
2 MA 1 -2 0.04 0.139247
0.101447
3 MA 1 -1.5 0.04 0.114831
0.084722
4 MA 1 -1 0.04 0.090936
0.068575
5 MA 1 -0.5 0.04 0.068185
0.05218
6 MA 1 0 0.04 0.047873 0.18
0.036378 0.16
0.025675 0.12
0.02149 0.08
0.030189 0.04
0.02
10 MA 1 2 0.04 0.063375
0
0.043824
-3 -2 -1 0 1 2 3
11 MA 1 2.5 0.04 0.086267
0.059502
128
Table 6.3.8 MA1 Missing at position 49, S.D. 0.4.
Missing 49
Summary Table Spline
No. Case Theta1 SD MAD/SD
1 MA 1 -2 0.4 1.432791
1.013634
2 MA 1 -1.5 0.4 1.187897
0.845383
3 MA 1 -1 0.4 0.946709
0.680004
4 MA 1 -0.5 0.4 0.713525 1.6
0.516502 1.4
5 MA 1 0 0.4 0.498291
1.2
0.359232
1
MAD
6 MA 1 0.5 0.4 0.295619
0.8
0.25522
7 MA 1 1 0.4 0.263776 0.6
0.209129 0.4
8 MA 1 1.5 0.4 0.397509 0.2
0.294549 0
9 MA 1 2 0.4 0.622893 -3 -2 -1 0 1 2 3
0.448908
0.019848 0.08
9 MA 1 1.5 0.04 0.042571 0.06
0.029776
0.04
10 MA 1 2 0.04 0.062705
0.02
0.044422
0
11 MA 1 2.5 0.04 0.085324
-3 -2 -1 0 1 2 3
0.060348
129
Table 6.3.10 MA1 Missing at position 7, S.D. 0.4.
Missing 7
Summary Table Spline
Case Theta1 SD MAD/SD
1 MA 1 -2 0.4 1.347883
0.994823
2 MA 1 -1.5 0.4 1.09674
0.813553
3 MA 1 -1 0.4 0.860287
0.657785
4 MA 1 -0.5 0.4 0.642886
0.498423 1.6
5 MA 1 0 0.4 0.441653
1.4
0.341495
1.2
6 MA 1 0.5 0.4 0.282628
1
MAD
0.22445
0.8
7 MA 1 1 0.4 0.264801
0.6
0.197712
0.4
8 MA 1 1.5 0.4 0.384928
0.2
0.301607
9 MA 1 2 0.4 0.566299 0
-3 -2 -1 0 1 2 3
0.4418
0.020161 0.12
0.1
9 MA 1 1.5 0.04 0.043808
0.08
0.031074
0.06
10 MA 1 2 0.04 0.065944 0.04
0.050103 0.02
11 MA 1 2.5 0.04 0.089776 0
-3 -2 -1 0 1 2 3
0.070467
130
Table 6.3.12 MA1 Missing at position 91, S.D. 0.4.
Missing 91
Summary Table Spline
Case Al1 Var MAD/SD
1 MA 1 -2 0.4 1.572588
1.152809
2 MA 1 -1.5 0.4 1.305746
0.958832
3 MA 1 -1 0.4 1.041798
0.766421
4 MA 1 -0.5 0.4 0.786114
0.571236 1.8
0.389602 1.4
MAD
0.241346 1
0.207247 0.6
0.316477 0.2
9 MA 1 2 0.4 0.661222 0
-3 -2 -1 0 1 2 3
0.500881
The graphs above indicate the best MAD value achievable when using the ‘interpolating
cubic spline smooth curve’ method. Graph results show that regardless of the position
of the missing value ie 7, 49 or 91 the MAD achieved by this method will produce a
similar pattern of results. It can be seen that the MAD value decrease as Theta
approaches 1 and then increases. The minimum MAD value for MA1 occurs when
Theta value is 1. The overall performance of using the cubic spline method indicates
that for Theta values less than 1 the MAD value decreases in a linear pattern. Clearly
the use of this method is best suited for positive Theta MA1 time series model. As
before the SD of the MAD is smallest at the minimum MAD value corresponding to
Theta of 1.
131
According to all the results, the absolute deviation and standard deviation of the random
data generated are in direct proportion to each other. Results indicate that if we increase
the standard deviation of the random data generated by scale of 10 then the means
absolute deviation and the standard deviation is also increased approximately by ten
times. Results are analysed by commenting on the Phi and Theta values rather than
In general time series can be represented by stochastic models. It means that the future
values are only partly determined by the past values, so that the exact predictions are
impossible and must be replaced by the idea that future values have a probability
distribution which is conditioned by a knowledge of the past. By using the time series
approach, we have to determine the time series model for the data series first.
2. Take out a specific value from the data set and store it at another cell for
comparison.
132
4. Repeat the process one hundred times.
5. Calculate the mean absolute deviation and standard deviation for comparison.
Each case looks at a particular time series model (i.e. AR and MA) with a particular
variable (i.e. Phi and Theta), which is applied to the forecasting to generate the different
simulations. To enable this to occur a macro from the computer package “minitab” will
automatically test missing values at position 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84
and 91. After one hundred times, the macro will produce a table summarising the mean
absolute deviation (MAD) and the standard deviation (SD) of the residuals. The results
are then graphed. In each case we compare the forward forecasting, backward
the most accurate results. These results are detailed in the Appendix B
According to the results, the absolute deviation and standard deviation of the random
data generated are in direct proportion to each other. Results indicate that if we
increased the standard deviation of the random data generated by scale of 10 then the
means absolute deviation and the standard deviation is also increased approximately by
ten times. These results are analysed by commenting on the Phi and Theta values rather
Also, our results show that when the ARIMA interpolation method is applied to AR1
time series model with positive Phi value less than or equal to 0.2 and the missing value
is at the first half of the data set the backward forecast will produce a smaller MAD. As
the missing value moves towards the end of the data set the MAD will increase
accordingly. We notice from the simulations the forward forecast will produce more
133
accurate results if the missing value appears in the second half of the data set. A
combination of the backward and forward forecast (ie combined interpolation method)
shows that the MAD result was similar to the forward forecasting where the missing
values appear in the first half of the data set. The second half of the data set shows that
The following tables sumarise the results for missing data at position 7, 49 and 91 for
AR(1) process.
134
Table 6.4.3 AR1 Missing at position 7, S.D. 0.04.
AR1 Missing7
MAD
MAD R
0.035
MAD RF
-0.4 0.0367039 0.0417334 0.0299332 0.033
0.031 MAD RB
-0.2 0.0393637 0.0406404 0.0304429 0.029
0.027
0.2 0.0383548 0.0394706 0.0349698 0.025
-1 -0.5 0 0.5 1
0.4 0.0354171 0.0391116 0.0370822
135
Table 6.4.6 AR1 Missing at position 91, S.D. 0.4.
AR1 Missing91
MAD
MAD R
0.3 MAD RF
-0.4 0.3064 0.321163 0.356815
0.28 MAD RB
-0.2 0.333653 0.324851 0.344324
0.26
0.2 0.32465 0.326182 0.32928 0.24
-1 -0.5 0 0.5 1
0.4 0.296121 0.325865 0.313798
In the case of AR1 time series model with various Phi values, the tables and graphs
show that for Phi values greater than 0.4 the use of the combined interpolation method
will produce a lower MAD than the two forecasting methods and consequently a more
accurate result.
The forward and backward forecasting methods produced similar MAD values however
as the Phi values approach negative one the combined interpolation method was able to
It doesn’t matter whether the Phi values are positive or negative the results indicate that
the MAD will follow the same pattern. The tables show positive Phi values of 0.2
through to 0.8 will produce the same results as the negative Phi values of -0.2 through to
-0.8. The MAD value and standard deviation of the combined interpolation method
decrease as the Phi value approaches positive or negative one. This indicates that there
is less variation in the estimation of missing values for this method. In other words, for
missing values in all positions combined interpolation method will provide a more
136
accurate result when Phi values are greater than approximately 0.2. In addition, when
we compare the MAD value of combined interpolation method with forward forecasting
or backward forecasting methods, the difference between the MAD values increase as
The following tables summarize the results for missing data at position 7, 49 and 91 for
MA(1) process..
0.05
-2 0.057751 0.066374 0.064237 MAD RF
0.04
MAD RB
-1.5 0.036482 0.050362 0.048376 0.03
0.02
-1 0.007523 0.033378 0.032155
0.01
-0.5 0.030472 0.034035 0.030166 0
-3 -2 -1 0 1 2 3
0 0.033308 0.033066 0.032012
137
Table 6.4.8 MA1 Missing at position 49, S.D. 0.4.
MA1 Missing49
0.8
MAD R MAD RF MAD RB
0.7
MAD
0.4 MAD RF
-1 0.074205 0.331129 0.326705
0.3 MAD RB
-0.5 0.293773 0.335526 0.300666 0.2
0 0.335296 0.330553 0.324336 0.1
0
0.5 0.298836 0.32456 0.339511
-3 -2 -1 0 1 2 3
1 0.081639 0.330267 0.322867
2 0.553836 0.61774 0.646211 Figure 6.32 Interpolation -MA1 Missing 49 S.D. 0.4.
2.5 0.085494 0.101122 0.077717 Figure 6.33 Interpolation -MA1 Missing 7 S.D. 0.04.
138
Table 6.4.10 MA1 Missing at position 7, S.D. 0.4.
MA1 Missing7
1
MAD R MAD RF MAD RB 0.9
0.8
-2 0.694264 0.703989 0.633501
0.7
MAD
-1.5 0.455329 0.506209 0.477089 0.6 MAD R
0.5 MAD RF
-1 0.270955 0.384059 0.339572
0.4 MAD RB
-0.5 0.325232 0.368127 0.291597 0.3
0.2
0 0.377457 0.37886 0.324823 0.1
0
0.5 0.351274 0.389328 0.38042
-3 -2 -1 0 1 2 3
1 0.27056 0.50292 0.342362
2 0.69476 0.866275 0.635341 Figure 6.34 Interpolation -MA1 Missing 7 S.D. 0.4.
0.06 MAD R
-2 0.065363 0.070457 0.072767 0.05 MAD RF
0.04 MAD RB
-1.5 0.042868 0.055127 0.054559
0.03
-1 0.014676 0.034161 0.038218 0.02
0.01
-0.5 0.031162 0.032078 0.037918 0
-3 -2 -1 0 1 2 3
0 0.035431 0.033098 0.035601
139
Table 6.4.12 MA1 Missing at position 91, S.D. 0.4.
MA1 Missing91
0.8
MAD R MAD RF MAD RB 0.7
0.6
-2 0.652825 0.710873 0.712933
MAD
0.5 MAD R
-1.5 0.415098 0.541671 0.522161 0.4 MAD RF
0.3 MAD RB
-1 0.146873 0.326743 0.37071
0.2
-0.5 0.310928 0.318738 0.37288
0.1
0 0.349438 0.31944 0.351491 0
-3 -2 -1 0 1 2 3
0.5 0.309007 0.320209 0.338771
Results indicate that when the ARIMA interpolation method is applied to MA1 time
series model and where the missing value appears in the middle of the data set, and the
Theta value is greater than 0.5 then it is more desirable to use the combined
interpolation method. If the Theta value is less than 0.5, it is more desirable to use
backward forecasting method. For these cases where the missing value appears in the
first half of the data set and the Theta value is greater than 0.5 and less than 2, the use of
the combined interpolation method will produce a lower MAD than the two forecasting
methods and consequently a more accurate result. Otherwise, the backward forecasting
method will produce smaller mean absolute deviation. In addition if the missing value
appears in the second half of the set and the Theta value is greater than 0.5, we find that
the combined interpolation method is still performing better than the other two
forecasting methods. When the Theta value is less than 0.5, it is more desirable to
140
It doesn’t matter whether the Theta values are positive or negative the results indicate
that they will follow the same pattern ie they are almost symmetric. The tables show
positive Theta values of 0 through to 2 which will produce the same results as the
When looking at the combined interpolation method, where the Theta values are
positive, the MAD values will decrease until the Theta values equal one and increases
thereafter. This is explained by the factor that the highest correlation between
consecutive values occurs at one. The graph above also shows this behaviour is same
for negative Theta values and applies to all moving average time series models.
With regards to the MA time series model, when we compare the MAD value of
methods, the results showed that the difference between the MAD values is at its
It is important to note that where the missing value appears at the beginning or end of
the data, the combined interpolation method cannot be used because it is impossible to
obtain both forward and backward forecasts, therefore only forward forecasting or
141
6.5 Applying Structural Time Series Analysis (STSA) to Box-Jenkins
Models
In this section, we will briefly examine the use of state space modelling in time series. It
carry out the analysis efficiently and accurately. The advantage of using this approach is
that it can adapt to different time series models such as the Box-Jenkins ARIMA and
Structural Time Series. This approach emphasises the notion that a time series is a set of
distinct components. Thus, we may assume that observations relate to the mean level of
the process through an observation equation, whereas one or more state equations
describe how the individual components change through time. In State Space
Modelling, observations can be added one at a time and the estimating equations are
then updated to produce new estimates. During the analysis process, a number of
computer software. There is only one software package “STAMP” available to conduct
structural time series analysis. That is why we are using the structural time series
compare the effectiveness of each method, I applied the structure time series to the same
1. Select 5 data sets for each time series models from previous simulation with
The models chosen were: AR models with Phi values -0.8, -0.2, 0.2 and 0.8.
142
2. Take out a specific value from the data set as a missing value.
3. Convert the data sets for specific time series models into text file.
4. Import the data for specific time series model into “STAMP”.
When we apply structural time series analysis, we have to setup the software with the
correct settings before the analysis processes can begin. The following settings were
1. Stochastic level
2. No slope
3. No Seasonals
9. The results generated by “STAMP” is not comparable with other results in this
thesis. Hence, we have to export the results as text file format then use a macro
143
The results of the analysis process is as follow:
MAD
0.1
0.2 0.041506 0.08
0.06
0.8 0.018745
0.04
0.02
0
-1 -0.5 0 0.5 1
0.06
0.2 0.031523
0.04
0.8 0.051045
0.02
0
-1 -0.5 0 0.5 1
As we only have 5 sets of data for each model, there is considerable variation within the
residuals and it is difficult to identify specific patterns. However, it can be noted from
144
above that the structural time series model produced the largest MAD value when Phi is
-0.8. This indicates that Structural Time Series model is not an appropriate state space
model for fitting an AR(1) data series when Phi is a large negative value. In addition, it
can be noted that the MAD corresponding with missing value at position 49 is less than
MAD
-1 0.040845
0.04
0 0.0127 0.03
0.02
1 0.052433 0.01
0
2 0.068496 -3 -2 -1 0 1 2 3
-1 0.065875 0.08
0.06
0 0.042888 0.04
0.02
1 0.041206 0
-4 -2 0 2 4
2 0.085761
0.06
0 0.037778 0.04
0.02
1 0.033753 0
-3 -2 -1 0 1 2 3
2 0.07613
145
It can be noted from the above graphs that the structural time series model produced the
largest MAD value which occurred when Theta are large positive and negative values.
This indicates that Structural Time Series model is not an appropriate state space model
for fitting an MA(1) data series when Theta is a large positive or negative value. In
addition, it can be noted that the MAD corresponding with missing value at position 49
146
CHAPTER 7
Conclusion
The purpose of this research is to investigate various modelling approaches and try to
determine the most appropriate technique for modelling time series data with missing
value. We have examined each of the methods individually and gained some insight into
the appropriateness of these methods for estimating missing values. In this section, we
compare the MAD values from different methods for the same simulated data set.
The following tables are comparisons of the MAD between the estimated and actual
value for all the non-state space modelling methods discussed in this thesis. We also
graphed the values and identified the features for each method. Results are then
analysed by commenting on the Phi and Theta values for each ARIMA model.
147
Case 1: AR Data
0.16
0.14
poly
0.12
0.1 spline
MAD
0.08 MAD R
0.06 MAD RF
0.04 MAD RB
0.02
0
-1 -0.5 0 0.5 1
148
Table 7.2.2 AR1 Missing at position 7, S.D. 0.04.
0.18
0.16
0.14 poly
0.12 spline
MAD
0.1 MAD R
0.08
0.06 MAD RF
0.04 MAD RB
0.02
0
-1 -0.5 0 0.5 1
149
Table 7.2.3 AR1 Missing at position 91, S.D. 0.04.
0.18
0.16
0.14 poly
MAD
0.12 spline
0.1 MAD R
0.08
0.06 MAD RF
0.04 MAD RB
0.02
0
-1 -0.5 0 0.5 1
It can be observed that if the Phi value is negative then the cubic spline produces the
largest MAD value in comparison to the other methods mentioned. When the Phi value
is greater than approximately 0.5 then the cubic spline will produce a similar result as
the combined interpolation method. When the Phi value is close to 0 the graph
indicated that a low degree polynominal will provide acceptable results for estimating
150
Case 2: MA data
0.18
0.16
0.14
Poly
0.12
spline
0.1
MAD
MAD R
0.08 MAD RF
0.06 MAD RB
0.04
0.02
0
-3 -2 -1 0 1 2 3
151
Table 7.2.5 MA1 Missing at position 7, S.D. 0.04.
0.16
0.14
0.12
Poly
0.1 spline
0.08 MAD R
MAD
MAD RF
0.06
MAD RB
0.04
0.02
0
-3 -2 -1 0 1 2 3
152
Table 7.2.6 MA1 Missing at position 91, S.D. 0.04.
0.2
0.18
0.16
0.14 Poly
0.12 spline
MAD
0.1 MAD R
0.08 MAD RF
0.06 MAD RB
0.04
0.02
0
-3 -2 -1 0 1 2 3
153
For the MA time series generated data the results above indicate that if there is
sufficient data before the missing value then a low degree polynominal will provide an
acceptable estimation where the Theta value is close to 0. When the Theta value is
greater than approximately 0.5 then the combined interpolation method will produce a
smaller MAD. However, where there is insufficient data before the missing value the
results indicate that the cubic spline will provide an estimation similar to the combined
interpolation method.
From the above it appears that for most of the ARIMA time series models, ARIMA
interpolation appears to be the most suitable method for estimating the missing value. In
the case where the missing value occurs in the second half of the series, interpolation
with forward and backward forecast seems to give the best estimate. The results also
indicated if the missing value occurs in the first half of the series, then backward
forecast can also give good estimate result. In addition for AR1 time series with Phi
values between 0.5 and 1, a cubic spline provides a good estimation. In the case of MA1
time series model, the results indicated that cubic spline approach only produces good
estimations when the Theta value is between positive 1 and 2. Hence, usages of cubic
In regards to state space modelling, the software STAMP that was used within this
thesis is an earlier version and it can only work on one set of time series data at any
given time and has limited capacity to deal with data. As a result, it is difficult to make a
154
fair comparison between state space modelling with all the other methods mentioned
above.
Although it is difficult to obtain a fair comparison, we still would like to give some idea
of the MAD values from the structural time series analysis approach compared to all the
between each method, we used the same five data sets for each of the methods
considered previously as well as state space modelling. The outline of this simulation is
as follows:
1. Use the same 5 data sets for each time series models from previous simulation
The models chosen are: AR models with Phi values -0.8, -0.2, 0.2 and 0.8.
2. Take out a specific value from the data set as a missing value.
4. Apply the plug-in and try to fit the data set with different degree of polynomials.
7. Calculate the mean absolute deviation and standard deviation for comparison.
155
After the simulation, we obtained the following results:
0.045
0.04
0.035 STSA
0.03 Spline
0.025 Poly
MAD
0.02 MAD R
0.015 MAD RF
0.01 MAD RB
0.005
0
-1 -0.5 0 0.5 1
Phi values
0.045
0.04
0.035 STSA
0.03 Spline
0.025 Poly
MAD
0.02 MAD R
0.015 MAD RF
0.01 MAD RB
0.005
0
-1 -0.5 0 0.5 1
Phi values
156
Table 7.3.3 AR1 Missing at position 91 S.D. 0.04.
Position SD 0.04
91 AR1 STSA Spline Poly MAD R MAD RF MAD RB
-0.8 0.072952 0.1458479 0.0461086 0.0009614 0.0019591 0.0014623
-0.2 0.039776 0.048814 0.0354803 0.0014845 0.0020288 0.0013059
0.2 0.055622 0.0446829 0.0472979 0.0017608 0.0024536 0.0015462
0.8 0.039186 0.0240632 0.0348626 0.001044 0.0020468 0.0014848
0.05
0.045
0.04 STSA
0.035 Spline
0.03
Poly
MAD
0.025
MAD R
0.02
0.015 MAD RF
0.01 MAD RB
0.005
0
-1 -0.5 0 0.5 1
Phi values
0.045
0.04
0.035 STSA
0.03 Spline
0.025 Poly
MAD
0.02 MAD R
0.015 MAD RF
0.01 MAD RB
0.005
0
-3 -2 -1 0 1 2 3
Theta values
157
Table 7.3.5 MA1 Missing at position 7 S.D. 0.04.
Position 7 SD 0.04
MA1 STSA Spline Poly MAD R MAD RF MAD RB
-2 0.123219 0.1481649 0.0828996 0.0037578 0.0036544 0.0050339
-1 0.065875 0.1032381 0.0458992 0.0007621 0.0024738 0.001082
0 0.042888 0.0607298 0.0475895 0.0025278 0.0024398 0.0025226
1 0.041206 0.0300274 0.0237 0.0009791 0.0016975 0.0009865
2 0.085761 0.0968157 0.0760574 0.0044391 0.0047032 0.0045801
0.05
0.045
0.04
STSA
0.035
Spline
0.03
Poly
MAD
0.025
MAD R
0.02
MAD RF
0.015
0.01 MAD RB
0.005
0
-3 -2 -1 0 1 2 3
Theta values
0.045
0.04
0.035 STSA
0.03 Spline
0.025 Poly
MAD
0.02 MAD R
0.015 MAD RF
0.01 MAD RB
0.005
0
-3 -2 -1 0 1 2 3
Theta values
158
Since structural time series analysis is a type of state space modelling it has the
advantage of being able to modify to suit various types of time series models including
nonstationary data types. This method adapted a one-step ahead forecasting method to
predict the future value which makes this method particularly popular in handling
missing values. Nonetheless, this is not the most user friendly method for an average
person to use in estimate missing values. It is difficult to identify the correct time series
model and to incorporate the data into the state space model framework. In addition,
there maybe more appropriate state space models that could be used to obtain the
missing value such as ARIMA state space model. However, such a model is very
difficult to identify and apply. The calculations required complex algorithms which
make it impossible to check manually and the availability of software to handle such
complicated analysis is limited. Hence, state space modelling may not be a feasible
solution in some cases. From the simulations above, we compared the MAD values
from each of the approaches mentioned in this thesis to find the minimum value
possible. As a result, we discovered that using structural time series analysis on ARIMA
simulated data does not produce the best estimate for missing value. This may due to the
addition, the data sets used are generated by ARIMA modeling algorithm that are biased
towards methods that are suited to the stationary model. Finally, we also have to be
aware that due to software limitation, only five data sets were used for comparison.
While there was considerable variation within the residuals there was sufficient
evidence to suggest that alternative methods are more appropriate for such data that was
159
7.4 Future research direction
In this thesis we have only examined a limited range of time series data with missing
value. In order to gain a better understanding and be able to estimate missing values
more accurately, further research needs to be undertaken. For instance, we could apply
the analysis methods discussed on non-stationary time series data and explore their
effectiveness. Also, we should broaden our research to involve different types of data
e.g. multivariate data in time series model. Other instances such as when consecutive
missing values occurred in time series data, study of various techniques have to be taken
on their efficiency and accuracy. Furthermore, there is a need to examine the accuracy
of estimation for each method with real life time series data. Lastly, time series models
other than ARIMA also require further research by using more advance methods such as
7.5 Conclusion
The aim of this research was to review various modelling approaches for time series
data with missing values. In addition we investigated the most appropriate modelling
We have examined both deterministic and stochastic approaches for time series with
missing values. In order to compare their performance, simulated datasets for AR and
MA processes were used in each method and MAD values were calculated. The
objective was to minimize the MAD between the actual and forecast missing values.
Due to the limitation of software used in this thesis, the testing was separated into two
160
parts. Firstly, we examined non-state space modelling approaches. We graphed and
commented on the relationship between MAD and the AR/MA parameters for different
ARIMA models. For AR1 time series data, our simulations indicated cubic spline is not
suitable for any time series with negative values of Phi. As the Phi value approaches
one, the combined interpolation and polynomial curve fitting seems to produce similar
results. Likewise, the MA1 time series data with negative values of Theta indicate that
cubic spline is not suitable. In general, combined interpolation gives acceptable results
for time series where there is sufficient data available before the missing value. When
the Theta value is close to 0, polynomial curve fitting gives the best estimate. However,
where there is insufficient data before the missing value and the Theta value is greater
than 1, the cubic spline and combined interpolation method provides the most suitable
approach.
In addition, we have also examined the structural time series analysis through the use of
the computer software STAMP. Although this approach is famous for its adaptability,
the calculation is extremely complex and it is hard to identify and apply the time series
simulated data does not give the best estimate for missing value.
In conclusion, our research has indicated that for most of the ARIMA time series
models, ARIMA interpolation appears to be the most suitable method for estimating a
missing value where there is sufficient data to obtain a reliable ARIMA model. In most
cases, the method gives the smallest MAD, In some cases similar results can be
obtained from numerical methods, ie for data fitting an AR model with high positive
161
method for fitting data. Similarly where there is insufficient data to fit and ARIMA
model it would be more appropriate to use a simple numerical approach or State Space
In this thesis, our finding is limited to AR1 and MA1 models with single missing value.
future research direction would extend to considering consecutive missing values and
162
REFERENCES
Brockwell, P. J., & Davis, R. A. (1991). Time Series: Theory and Methods. New York,
USA : Springer-Verlag.
Gardner, G., Harvey, A. C., & Phillips, G. D. A. (1980). An Algorithm for Exact
Maximum Likelihood Estimation of Autoregressive-Moving Average Models by Means
of Kalman. Applied Statistics, 29, 311-322.
Gomez, I. A., Burton, D. M., & Love, H. A. (1995). Imputing Missing Natural Resource
Inventory Data and the Bootstrap. Natural Resource Modelling, 9(4), 299-328.
Hamilton, J. D. (1994). Time Series Analysis. New Jersey, USA : Princeton University
Press.
Harvey, A. C. (2001). Forecasting, Structural Time Series Models and the Kalman
Filter. Cambridge, UK : Cambridge University Press.
Harvey, A. C., & Pierse, R.G. (1984). Estimating Missing Observations in Economic
Time Series. Journal of the American Statistical Association, 79(385), 125-131.
Janacek, G., & Swift, L. (1993). Time Series Forecasting Simulation & Application.
West Sussex, England : Ellis Horwood Limited.
163
Kohn, R., & Ansley, C. F. (1986). Estimation, Prediction, and Interpolation for ARIMA
Models with Missing Data. Journal of the American Statistical Association, 81(395),
751-761.
Nieto, F. H., & Martfncz, J. (1996). A Recursive Approach for Estimating Missing
Observations in An Univariate Time Series. Communications in statistics Theory A,
25(9), 2101-2116.
Pena, D., & Tiao, G. C. (1991). A Note on Likelihood Estimation of Missing Values in
Time Series. The American statistician, 45(3), 212-213.
Robinson, P. M., & Dunsmuir, W. (1981). Estimation of Time Series Models in the
Presence of Missing Data. Journal of the American Statistical Association, 76(375),
560-568.
Rosen, Y., & Porat, B. (1989). Optimal ARMA Parameter Estimation Based on The
Sample Covariances for Data with Missing Observations. IEEE Transactions on
Information Theorey, 35(2), 342-349.
Rosen, Y., & Porat, B. (1989). The Second-Order Moments of The Sample Covariances
for Time Series with Missing Observations. IEEE Transactions on Information Theorey,
35(2), 334-341.
Tresp, V., & Hofmann, R. (1998). Nonlinear Time-Series Prediction with Missing and
Noisy Data. Neural Computation, 10, 731-747.
164
Appendix A
During this study, I used macros to help me at different stages for analyzing time series
data and examine the effectiveness of different analysis methods.
In this thesis, I have written macros for Microsoft Excel spreadsheet to generate data
sets. Also, I used Excel to evaluate the accuracy of various prediction methods such as
interpolating with a cubic spline and least squares approximations. The following
macros must be used in conjunction with excel_curvefit_analysis_book v4.5 and plugin
from XlXtrFunDistribution.
Excel Macros :
**********************************************************************
Option Explicit
Option Compare Text
Sub Analysis()
'declare variables
Dim Message, Title
165
'check value of bOK that was set by the buttons on the form
If Not bOK Then Exit Sub
'if an item is selected, exit the loop
If UserForm1.ListBox1.ListIndex > -1 Then Exit Do
'if no item selected, display a message
MsgBox "No selection was made"
Loop
'store the values of the listbox for later use
indexNum = UserForm1.ListBox1.ListIndex
numberInList = indexNum + 1
chosenValue = UserForm1.ListBox1.Value
'unload the userform
Unload UserForm1
'display a message box of what was selected
MsgBox "List index number* of item picked: " & indexNum & Chr(13) & _
Chr(13) & _
"Number of item in the list: " & numberInList & Chr(13) & _
Chr(13) & _
"list text of item picked: " & chosenValue & Chr(13) & _
Chr(13) & _
Chr(13) & _
"* Please note that the index number of the first item in a list is 0, not 1"
Case 0
Message = "Enter the value for the first constant ?"
Title = "Simulation Data Analysis for AR1 model"
Phi1 = InputBox(Message, Title)
Case 1
Message = "Enter the value for the first constant ?"
Title = "Simulation Data Analysis for AR2 model"
Phi1 = InputBox(Message, Title)
Message = "Enter the value for the second constant ?"
Title = "Simulation Data Analysis for AR2 model"
Phi2 = InputBox(Message, Title)
Case 2
Message = "Enter the value for the first constant ?"
Title = "Simulation Data Analysis for MA1 model"
Theta1 = InputBox(Message, Title)
Case 3
Message = "Enter the value for the first constant ?"
Title = "Simulation Data Analysis for MA2 model"
166
Theta1 = InputBox(Message, Title)
Message = "Enter the value for the second constant ?"
Title = "Simulation Data Analysis for MA2 model"
Theta2 = InputBox(Message, Title)
Case 4
Message = "Enter the value for the first MA constant ?"
Title = "Simulation Data Analysis for ARIMA 011 model"
Theta1 = InputBox(Message, Title)
Case 5
Message = "Enter the value for the first AR constant ?"
Title = "Simulation Data Analysis for ARIMA 110 model"
Phi1 = InputBox(Message, Title)
Case 6
Message = "Enter the value for the first AR constant ?"
Title = "Simulation Data Analysis for ARIMA 101 model"
Phi1 = InputBox(Message, Title)
Message = "Enter the value for the first MA constant ?"
Title = "Simulation Data Analysis for ARIMA 101 model"
Theta1 = InputBox(Message, Title)
Case 7
Message = "Enter the value for the first AR constant ?"
Title = "Simulation Data Analysis for ARIMA 111 model"
Phi1 = InputBox(Message, Title)
Message = "Enter the value for the first MA constant ?"
Title = "Simulation Data Analysis for ARIMA 111 model"
Theta1 = InputBox(Message, Title)
Case 8
'Seasonal Model
Message = "Enter the value for the constant ?"
Title = "Simulation Data Analysis for SARIMA (1,0,0)(0,1,0)12 model"
Phi1 = InputBox(Message, Title)
Case Else
'Extra option
End Select
167
End If
End Sub
Sub Summary_Analysis()
row_index1 = 1
row_index2 = 1
respond = 2
Message = "Enter '1' for Excel to simulate data set or '0' for user's data set"
Title = "Information"
respond = InputBox(Message, Title)
For counter1 = 1 To 20
column_index1 = 1
column_index2 = 1
indexNum = 99
Sheets("Summary").Select
168
If model = "AR 1" Then
indexNum = 0
ElseIf model = "AR 2" Then
indexNum = 1
ElseIf model = "MA 1" Then
indexNum = 2
ElseIf model = "MA 2" Then
indexNum = 3
ElseIf model = "ARIMA 011" Then
indexNum = 4
ElseIf model = "ARIMA 110" Then
indexNum = 5
ElseIf model = "ARIMA 101" Then
indexNum = 6
ElseIf model = "ARIMA 111" Then
indexNum = 7
ElseIf model = "Seasonal" Then
indexNum = 8
End If
If counter1 = 1 Then
Sheets("DataSets (2)").Select
ElseIf counter1 = 2 Then
Sheets("DataSets (3)").Select
ElseIf counter1 = 3 Then
Sheets("DataSets (4)").Select
ElseIf counter1 = 4 Then
Sheets("DataSets (5)").Select
ElseIf counter1 = 5 Then
Sheets("DataSets (6)").Select
ElseIf counter1 = 6 Then
Sheets("DataSets (7)").Select
ElseIf counter1 = 7 Then
Sheets("DataSets (8)").Select
ElseIf counter1 = 8 Then
Sheets("DataSets (9)").Select
ElseIf counter1 = 9 Then
Sheets("DataSets (10)").Select
ElseIf counter1 = 10 Then
Sheets("DataSets (11)").Select
ElseIf counter1 = 11 Then
Sheets("DataSets (12)").Select
ElseIf counter1 = 12 Then
Sheets("DataSets (13)").Select
ElseIf counter1 = 13 Then
Sheets("DataSets (14)").Select
ElseIf counter1 = 14 Then
Sheets("DataSets (15)").Select
169
ElseIf counter1 = 15 Then
Sheets("DataSets (16)").Select
ElseIf counter1 = 16 Then
Sheets("DataSets (17)").Select
ElseIf counter1 = 17 Then
Sheets("DataSets (18)").Select
ElseIf counter1 = 18 Then
Sheets("DataSets (19)").Select
ElseIf counter1 = 19 Then
Sheets("DataSets (20)").Select
ElseIf counter1 = 20 Then
Sheets("DataSets (21)").Select
End If
Range("A3:CV102").Select
Selection.Copy
Sheets("DataSets").Select
Range("A3:CV102").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
If respond = 1 Then
row_index1 = row_index1 + 2
For counter2 = 1 To 7
170
ActiveSheet.Range("H97").Cells(row_index2, counter2).Value =
Sheets("case4").Range("AF104").Cells(1, column_index2).Value
ActiveSheet.Range("H98").Cells(row_index2, counter2).Value =
Sheets("case4").Range("AF105").Cells(1, column_index2).Value
Else
Sheets("Summary").Select
ActiveSheet.Range("H7").Cells(row_index2, counter2).Clear
ActiveSheet.Range("H8").Cells(row_index2, counter2).Clear
ActiveSheet.Range("H52").Cells(row_index2, counter2).Clear
ActiveSheet.Range("H53").Cells(row_index2, counter2).Clear
ActiveSheet.Range("H97").Cells(row_index2, counter2).Clear
ActiveSheet.Range("H98").Cells(row_index2, counter2).Clear
End If
column_index2 = column_index2 + 4
Next counter2
row_index2 = row_index2 + 2
Next counter1
End Sub
Sub Processing(Phi1, Phi2, Theta1, Theta2, indexNum, var1, counter1)
'declare variables
171
colindex = 1
rwindex = 3
colindex2 = 1
rwindex2 = 4
colindex3 = 1
rwindex3 = 108
colindex6 = 1
rwindex6 = 212
colindex4 = 1
rwindex4 = 4
colindex5 = 1
rwindex5 = 108
colindex7 = 1
rwindex7 = 212
clear_data
Sheets("DataSets").Range("A3:cv102").Clear
For counter = 0 To 99
seed = counter + counter1
Sheets.Add.Name = "Temp"
Range("b5:b124").Select
Selection.ClearContents
Case 0
ActiveSheet.Range("a1").Value = Phi1
ActiveSheet.Range("b4").Value = ActiveSheet.Range("a5").Value
ActiveCell.FormulaR1C1 = "=R1C1*R[-1]C+R[1]C[-1]"
Case 1
ActiveSheet.Range("a1").Value = Phi1
ActiveSheet.Range("a2").Value = Phi2
ActiveSheet.Range("b3").Value = ActiveSheet.Range("a5").Value
ActiveSheet.Range("b4").Value = ActiveSheet.Range("a6").Value
ActiveCell.FormulaR1C1 = "=r1c1*r[-1]c+r2c1*r[-2]c+r[2]c[-1]"
Case 2
ActiveSheet.Range("a1").Value = Theta1
ActiveSheet.Range("b4").Value = ActiveSheet.Range("a5").Value
ActiveCell.FormulaR1C1 = "=R1C1*RC[-1]+R[1]C[-1]"
172
Case 3
ActiveSheet.Range("a1").Value = Theta1
ActiveSheet.Range("a2").Value = Theta2
ActiveSheet.Range("b3").Value = ActiveSheet.Range("a5").Value
ActiveSheet.Range("b4").Value = ActiveSheet.Range("a6").Value
ActiveCell.FormulaR1C1 = "=r1c1*rc[-1]+r2c1*r[1]c[-1]+r[2]c[-1]"
Case 4
ActiveSheet.Range("a1").Value = Theta1
ActiveSheet.Range("b4").Value = ActiveSheet.Range("a5").Value
ActiveSheet.Range("c4").Value = ActiveSheet.Range("a5").Value
ActiveCell.FormulaR1C1 = "=R1C1*RC[-1]+R[1]C[-1]"
Range("c5").Select
ActiveCell.FormulaR1C1 = "=R[-1]C+RC[-1]"
Case 5
ActiveSheet.Range("a1").Value = Phi1
ActiveSheet.Range("b4").Value = ActiveSheet.Range("a5").Value
ActiveSheet.Range("c4").Value = ActiveSheet.Range("a5").Value
ActiveCell.FormulaR1C1 = "=R1C1*R[-1]C+R[1]C[-1]"
Range("c5").Select
ActiveCell.FormulaR1C1 = "=R[-1]C+RC[-1]"
Case 6
ActiveSheet.Range("a1").Value = Phi1
ActiveSheet.Range("a2").Value = Theta1
ActiveSheet.Range("b4").Value = ActiveSheet.Range("a5").Value
ActiveCell.FormulaR1C1 = "=r1c1*r[-1]c+r2c1*rc[-1]+r[1]c[-1]"
Case 7
ActiveSheet.Range("a1").Value = Phi1
ActiveSheet.Range("a2").Value = Theta1
ActiveSheet.Range("b4").Value = ActiveSheet.Range("a5").Value
ActiveSheet.Range("c4").Value = ActiveSheet.Range("a5").Value
ActiveCell.FormulaR1C1 = "=r1c1*r[-1]c+r2c1*rc[-1]+r[1]c[-1]"
Range("c5").Select
ActiveCell.FormulaR1C1 = "=R[-1]C+RC[-1]"
Case 8
'Seasonal Model
ActiveSheet.Range("a1").Value = Phi1
ActiveSheet.Range("b1").Value = ActiveSheet.Range("a5").Value
ActiveSheet.Range("b2").Value = ActiveSheet.Range("a6").Value
ActiveSheet.Range("b3").Value = ActiveSheet.Range("a7").Value
ActiveSheet.Range("b4").Value = ActiveSheet.Range("a8").Value
ActiveSheet.Range("b5").Value = ActiveSheet.Range("a9").Value
ActiveSheet.Range("b6").Value = ActiveSheet.Range("a10").Value
ActiveSheet.Range("b7").Value = ActiveSheet.Range("a11").Value
ActiveSheet.Range("b8").Value = ActiveSheet.Range("a12").Value
ActiveSheet.Range("b9").Value = ActiveSheet.Range("a13").Value
173
ActiveSheet.Range("b10").Value = ActiveSheet.Range("a14").Value
ActiveSheet.Range("b11").Value = ActiveSheet.Range("a15").Value
ActiveSheet.Range("b12").Value = ActiveSheet.Range("a16").Value
ActiveSheet.Range("b13").Value = ActiveSheet.Range("a17").Value
Range("b14").Select
ActiveCell.FormulaR1C1 = "=r1c1*r[-1]c-r1c1*r[-13]c+r[-12]c+r[4]c[-1]"
Case Else
'Extra option
End Select
Case 0, 1, 2, 3, 4, 5, 6, 7
Range("B5:c5").Select
Selection.AutoFill Destination:=Range("B5:c108"), Type:=xlFillDefault
Case 8
Range("B14:c14").Select
Selection.AutoFill Destination:=Range("B14:c128"), Type:=xlFillDefault
Case Else
' extra option
End Select
Case 0, 1, 2, 3, 6
Range("b5:b104").Select
Case 4, 5, 7
Range("c5:c104").Select
Case 8
Range("b14:b113").Select
Case Else
'Extra option
End Select
Selection.Copy
Sheets("case1").Select
Range("b6").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
174
Sheets("DataSets").Select
Range("a1:cv105").Cells(rwindex, colindex).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
colindex = colindex + 1
Sheets("Temp").Select
Application.CutCopyMode = False
Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Sheets("case1").Select
Range("b6").Select
M49 = ActiveSheet.Range("B54").Value
Sheets("case2").Select
S49_1 = ActiveSheet.Range("G54").Value
Range("ad1").Cells(rwindex2, colindex2).Value = M49
Range("ae1").Cells(rwindex2, colindex2).Value = S49_1
Sheets("case1").Select
M1 = ActiveSheet.Range("B12").Value
Sheets("case3").Select
S1 = ActiveSheet.Range("G12").Value
Range("ad1").Cells(rwindex2, colindex2).Value = M1
Range("ae1").Cells(rwindex2, colindex2).Value = S1
Sheets("case1").Select
M99 = ActiveSheet.Range("B96").Value
Sheets("case4").Select
S99 = ActiveSheet.Range("G96").Value
Range("ad1").Cells(rwindex2, colindex2).Value = M99
Range("ae1").Cells(rwindex2, colindex2).Value = S99
Sheets("case1").Select
For dcounter = 2 To 7
Sheets("case1").Range("d3").Value = dcounter
Sheets("case2").Select
P49_1 = ActiveSheet.Range("F54").Value
Range("ai1").Cells(rwindex4, colindex4).Value = P49_1
Sheets("case3").Select
P1 = ActiveSheet.Range("F12").Value
Range("ai1").Cells(rwindex4, colindex4).Value = P1
Sheets("case4").Select
P99 = ActiveSheet.Range("F96").Value
175
Range("ai1").Cells(rwindex4, colindex4).Value = P99
colindex4 = colindex4 + 4
colindex5 = colindex5 + 4
colindex7 = colindex7 + 4
Next dcounter
rwindex2 = rwindex2 + 1
rwindex3 = rwindex3 + 1
rwindex4 = rwindex4 + 1
rwindex5 = rwindex5 + 1
rwindex6 = rwindex6 + 1
rwindex7 = rwindex7 + 1
colindex4 = 1
colindex5 = 1
colindex6 = 1
colindex7 = 1
Next counter
End Sub
Sub clear_data()
Sheets("case2").Range("Ad4:ae103,ai4:ai103,am4:am103,aq4:aq103,au4:au103,ay4:ay1
03,bc4:bc103").Clear
Sheets("case3").Range("Ad4:ae103,ai4:ai103,am4:am103,aq4:aq103,au4:au103,ay4:ay1
03,bc4:bc103").Clear
Sheets("case4").Range("Ad4:ae103,ai4:ai103,am4:am103,aq4:aq103,au4:au103,ay4:ay1
03,bc4:bc103").Clear
End Sub
Sub Processing2(Phi1, Phi2, Theta1, Theta2, indexNum, var1)
'declare variables
176
Dim rwindex5 As Integer
Dim colindex5 As Integer
Dim rwindex6 As Integer
Dim colindex6 As Integer
Dim rwindex7 As Integer
Dim colindex7 As Integer
Dim dcounter As Integer
Dim counter As Integer
colindex = 1
rwindex = 3
colindex2 = 1
rwindex2 = 4
colindex3 = 1
rwindex3 = 108
colindex6 = 1
rwindex6 = 212
colindex4 = 1
rwindex4 = 4
colindex5 = 1
rwindex5 = 108
colindex7 = 1
rwindex7 = 212
clear_data
For counter = 0 To 4
Sheets("DataSets").Select
Range(Cells(3, colindex), Cells(102, colindex)).Select
'Range("a1:cv105").Cells(3, colindex).Select
Selection.Copy
Sheets("case1").Select
Range("b6").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
colindex = colindex + 1
Sheets("case1").Select
Range("b6").Select
M49 = ActiveSheet.Range("B54").Value
Sheets("case2").Select
S49_1 = ActiveSheet.Range("G54").Value
Range("ad1").Cells(rwindex2, colindex2).Value = M49
Range("ae1").Cells(rwindex2, colindex2).Value = S49_1
Sheets("case1").Select
M1 = ActiveSheet.Range("B12").Value
177
Sheets("case3").Select
S1 = ActiveSheet.Range("G12").Value
Range("ad1").Cells(rwindex2, colindex2).Value = M1
Range("ae1").Cells(rwindex2, colindex2).Value = S1
Sheets("case1").Select
M99 = ActiveSheet.Range("B96").Value
Sheets("case4").Select
S99 = ActiveSheet.Range("G96").Value
Range("ad1").Cells(rwindex2, colindex2).Value = M99
Range("ae1").Cells(rwindex2, colindex2).Value = S99
Sheets("case1").Select
For dcounter = 2 To 7
Sheets("case1").Range("d3").Value = dcounter
Sheets("case2").Select
P49_1 = ActiveSheet.Range("F54").Value
Range("ai1").Cells(rwindex4, colindex4).Value = P49_1
Sheets("case3").Select
P1 = ActiveSheet.Range("F12").Value
Range("ai1").Cells(rwindex4, colindex4).Value = P1
Sheets("case4").Select
P99 = ActiveSheet.Range("F96").Value
Range("ai1").Cells(rwindex4, colindex4).Value = P99
colindex4 = colindex4 + 4
colindex5 = colindex5 + 4
colindex7 = colindex7 + 4
Next dcounter
rwindex2 = rwindex2 + 1
rwindex3 = rwindex3 + 1
rwindex4 = rwindex4 + 1
rwindex5 = rwindex5 + 1
rwindex6 = rwindex6 + 1
rwindex7 = rwindex7 + 1
colindex4 = 1
colindex5 = 1
colindex6 = 1
colindex7 = 1
Next counter
End Sub
**********************************************************************
178
In addition, I have also written the following macros for Minitab to examine the
accuracy of interpolation method in Box Jenkins approach. During my study, I have
made numerous alternations on my macros, sometimes fine tuning is required for the
macros to suit different conditions. In this thesis, I have only provided the two macros
that I considered as the most common used as references.
Minitab Macros:
a) Generate time series data using minitab
**********************************************************************
GMACRO
ARIMA
#
179
ENDDO
LET K18=K17+1
DO K2=K18:100
LET C2(K2)=C1(K2)
IF K15 = 0
GOTO 3
ENDIF
DO K3=1:K15
LET C2(K2)=C2(K2)+C92(K3)*C2(K2-K3)
ENDDO
MLABEL 3
IF K16=0
GOTO 4
ENDIF
DO K3=1:K16
LET C2(K2)=C2(K2)+C94(K3)*C1(K2-K3)
ENDDO
MLABEL 4
ENDDO
Note TSPLOT C2
Let k991=c91
Let k993=c93
Set c3
1( 1 : 100 / 1 )1
End.
Copy C2 c4;
Omit 49:100.
Copy C2 c110;
Omit 1:49.
Set c111
1( 1 : 51 / 1 )1
End.
Sort C110 c5;
By c111;
Descending c111.
ARIMA k991 0 k993 C4;
NoConstant;
Forecast 1 c116.
ARIMA K991 0 k993 c5;
NoConstant;
Forecast 1 c117.
If k991=1
if k993=0
Let K99=1/(1+c92*c92)
endif
if k993=1
Let k99=(1-c92*c94)/(1+c92*c92-2*c92*c94)
180
endif
endif
If k991=0
if k993=1
Let k99=1
endif
endif
Name c10='Estimate'
Name c12='Actual'
Name c14='Residual'
Name c15='ResiF'
Name c6='Forecast'
Name c7='Backcast'
Let c6(k30)=c116
Let c7(k30)=c117
Let c10(k30)=k99*(c116+c117)
Let c12(k30)=c2(49)
Let c114(k30)=c10(k30)-c12(k30)
Let c115(k30)=c6(k30)-c12(k30)
ENDDO
Let 'Residual'=c114
Let 'ResiF'=c115
Describe c114.
Histogram Residual;
MidPoint;
Bar.
Describe c115.
Histogram ResiF;
MidPoint;
Bar.
ENDMACRO
**********************************************************************
b) Import data sets from Excel, forecast and evaluate missing value using different
interpolation methods.
**********************************************************************
GMACRO
ARIMA
Let k43=1
# Do k42=1:20
Erase C1-C1000
#Erase K1-K1000
Erase M1-M100
Let K998 = '*'
Let K999 = 2.7182818
Let K1000 = 3.14159265
181
Let c500(1)=k43
if c500(1)=1
XDGET 'excel' 'DataSets (2)' 'r3c1:r102c100'
endif
if c500(1)=2
XDGET 'excel' 'DataSets (3)' 'r3c1:r102c100'
endif
if c500(1)=3
XDGET 'excel' 'DataSets (4)' 'r3c1:r102c100'
endif
if c500(1)=4
XDGET 'excel' 'DataSets (5)' 'r3c1:r102c100'
endif
if c500(1)=5
XDGET 'excel' 'DataSets (6)' 'r3c1:r102c100'
endif
if c500(1)=6
XDGET 'excel' 'DataSets (7)' 'r3c1:r102c100'
endif
if c500(1)=7
XDGET 'excel' 'DataSets (8)' 'r3c1:r102c100'
endif
if c500(1)=8
XDGET 'excel' 'DataSets (9)' 'r3c1:r102c100'
endif
if c500(1)=9
XDGET 'excel' 'DataSets (10)' 'r3c1:r102c100'
endif
if c500(1)=10
XDGET 'excel' 'DataSets (11)' 'r3c1:r102c100'
endif
if c500(1)=11
XDGET 'excel' 'DataSets (12)' 'r3c1:r102c100'
endif
if c500(1)=12
XDGET 'excel' 'DataSets (13)' 'r3c1:r102c100'
endif
if c500(1)=13
XDGET 'excel' 'DataSets (14)' 'r3c1:r102c100'
endif
if c500(1)=14
XDGET 'excel' 'DataSets (15)' 'r3c1:r102c100'
endif
if c500(1)=15
XDGET 'excel' 'DataSets (16)' 'r3c1:r102c100'
endif
if c500(1)=16
XDGET 'excel' 'DataSets (17)' 'r3c1:r102c100'
182
endif
if c500(1)=17
XDGET 'excel' 'DataSets (18)' 'r3c1:r102c100'
endif
if c500(1)=18
XDGET 'excel' 'DataSets (19)' 'r3c1:r102c100'
endif
if c500(1)=19
XDGET 'excel' 'DataSets (20)' 'r3c1:r102c100'
endif
if c500(1)=20
XDGET 'excel' 'DataSets (21)' 'r3c1:r102c100'
endif
# Let K40=c495(1)
#Let c491(1)=1
LET K15=C491(1)
Let c194(1)=c491(1)
IF K15 =0
Let c492(1)=0
GOTO 1
ENDIF
Let c195(1)=c492
MLABEL 1
#Let c493(1)=0
183
LET K16=C493(1)
Let c196(1)=c493(1)
IF K16 = 0
Let c494(1)=0
GOTO 2
ENDIF
#Note Make sure you have copy data set from Excel
#Note Data set should start from "C2" column
Let k40=7
Do k45=1:13
Let K1 = 1
Do k30=1:100
Let c102=ck1
Set c103
1( 1 : 100 / 1 )1
End.
Let K41=100-k40
Set c211
1( 1 : k41 / 1 )1
End.
184
Forecast 1 c219.
Let c106(k30)=c218
Let c107(k30)=c219
Let k97=(1-c492*c494)/(1+c492*c492-2*c492*c494)
Let c110(k30)=k97*(c106(k30)+c107(k30))
Let c112(k30)=c102(k40)
Let c214(k30)=c110(k30)-c112(k30)
Let c215(k30)=c106(k30)-c112(k30)
Let c216(k30)=c107(k30)-c112(k30)
Let k1=k1+1
ENDDO
Let c114=c214
Let c115=c215
Let c116=c216
Let c305(k45)=c201(1)
Let c306(k45)=c199(1)
Let c307(k45)=c202(1)
Let c308(k45)=c200(1)
Let c309(k45)=c203(1)
Let c310(k45)=c198(1)
Let c304(k45)=k40
Let k40=k40+7
enddo
Name c110='Estimate'
Name c112='Actual'
Name c114='Residual'
185
Name c115='Resid_F'
Name c106='Forecast'
Name c107='Backcast'
Name c201='C MAD R'
Name c202='C MAD RF'
Name c203='c MAD RB'
Name c305='MAD R'
Name c307='MAD RF'
Name c309='MAD RB'
Name c306='SD R'
Name c308='SD RF'
Name c310='sd RB'
Name c194='AR'
Name c195='Phi'
Name c196='MA'
Name c197='Theta'
# Let k43=k43+1
# Pause
# enddo
ENDMACRO
**********************************************************************
186
Appendix B
AR 1 , Phi 0.2 and Var 0.04
0.04
0.039
0.038
0.037
0.036 MA D R
0.035 MA D RF
0.034 MA D RB
0.033
0.032
0.031
0.03
0 20 40 60 80 100
0.038
0.036
MAD R
0.034 MAD RF
MAD RB
0.032
0.03
0.028
0 20 40 60 80 100
187
AR 1 , Phi 0.6 and Var 0.04
0.04
0.038
0.036
MA D R
0.034
MA D RF
0.032
MA D RB
0.03
0.028
0.026
0 20 40 60 80 100
0.035
0.033
MA D R
0.031
MA D RF
0.029
MA D RB
0.027
0.025
0.023
0 20 40 60 80 100
188
AR 1 , Phi -0.2 and Var 0.04
0.043
0.041
0.039
MA D R
0.037
MA D RF
0.035
MA D RB
0.033
0.031
0.029
0 20 40 60 80 100
0.041
0.039
0.037 MA D R
0.035 MA D RF
0.033 MA D RB
0.031
0.029
0.027
0 20 40 60 80 100
189
AR 1 , Phi -0.6 and Var 0.04
0.041
0.039
0.037
0.035 MA D R
0.033 MA D RF
0.031 MA D RB
0.029
0.027
0.025
0 20 40 60 80 100
190
AR 1 , Phi 0.2 and Var 0.4
0.405
0.385
0.365
MA D R
0.345 MA D RF
MA D RB
0.325
0.305
0.285
0 20 40 60 80 100
0.39
0.37
MA D R
0.35
MA D RF
0.33
MA D RB
0.31
0.29
0.27
0 20 40 60 80 100
191
AR 1 , Phi 0.6 and Var 0.4
0.39
0.37
0.35
MA D R
0.33
MA D RF
0.31
MA D RB
0.29
0.27
0.25
0 20 40 60 80 100
0.34
0.32
MA D R
0.3
MA D RF
0.28
MA D RB
0.26
0.24
0.22
0 20 40 60 80 100
192
AR 1 , Phi -0.2 and Var 0.4
0.4
0.38
0.36
MA D R
0.34 MA D RF
MA D RB
0.32
0.3
0.28
0 20 40 60 80 100
0.39
0.37
MA D R
0.35
MA D RF
0.33
MA D RB
0.31
0.29
0.27
0 20 40 60 80 100
193
AR 1 , Phi -0.6 and Var 0.4
0.39
0.37
0.35
MA D R
0.33
MA D RF
0.31 MA D RB
0.29
0.27
0.25
0 20 40 60 80 100
0.35
0.33
MA D R
0.31
MA D RF
0.29
MA D RB
0.27
0.25
0.23
0 20 40 60 80 100
194
MA 1 , Theta 0.2 and Var 0.04
0.042
0.04
0.038
MAD R
0.036 MAD RF
MAD RB
0.034
0.032
0.03
0 20 40 60 80 100
0.039
0.037
MA D R
0.035
MA D RF
0.033
MA D RB
0.031
0.029
0.027
0 20 40 60 80 100
195
MA 1 , Theta 0.6 and Var 0.04
0.043
0.041
0.039
0.037
0.035 MA D R
0.033 MA D RF
0.031 MA D RB
0.029
0.027
0.025
0.023
0 20 40 60 80 100
0.0425
0.0375
MA D R
0.0325 MA D RF
MA D RB
0.0275
0.0225
0.0175
0 20 40 60 80 100
196
MA 1 , Theta -0.2 and Var 0.04
0.039
0.038
0.037
0.036
0.035 MA D R
0.034 MA D RF
0.033 MA D RB
0.032
0.031
0.03
0.029
0 20 40 60 80 100
0.039
0.037
MA D R
0.035
MA D RF
0.033
MA D RB
0.031
0.029
0.027
0 20 40 60 80 100
197
MA 1 , Theta -0.6 and Var 0.04
0.039
0.037
0.035
0.033 MA D R
0.031 MA D RF
0.029 MA D RB
0.027
0.025
0.023
0 20 40 60 80 100
0.036
0.031 MA D R
MA D RF
0.026 MA D RB
0.021
0.016
0 20 40 60 80 100
198
MA 1 , Theta 0.2 and Var 0.4
0.4
0.39
0.38
0.37
0.36 MA D R
0.35 MA D RF
0.34 MA D RB
0.33
0.32
0.31
0.3
0 20 40 60 80 100
0.38
0.36
MA D R
0.34 MA D RF
MA D RB
0.32
0.3
0.28
0 20 40 60 80 100
199
MA 1 , Theta 0.6 and Var 0.4
0.43
0.41
0.39
0.37
0.35 MA D R
0.33 MA D RF
0.31 MA D RB
0.29
0.27
0.25
0.23
0 20 40 60 80 100
0.41
0.36
MA D R
0.31 MA D RF
0.26 MA D RB
0.21
0.16
0 20 40 60 80 100
200
MA 1 , Theta -0.2 and Var 0.4
0.38
0.37
0.36
0.35
MA D R
0.34
MA D RF
0.33
MA D RB
0.32
0.31
0.3
0.29
0 20 40 60 80 100
0.37
0.35
MA D R
0.33 MA D RF
MA D RB
0.31
0.29
0.27
0 20 40 60 80 100
201
MA 1 , Theta -0.6 and Var 0.4
0.39
0.37
0.35
0.33 MA D R
0.31 MA D RF
0.29 MA D RB
0.27
0.25
0.23
0 20 40 60 80 100
0.35
MA D R
0.3
MA D RF
0.25 MA D RB
0.2
0.15
0 20 40 60 80 100
202