Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

Type of variation

Stationary time series


Transformations

Simple Descriptive Techniques

Dr. Bo Li

January 9, 2012

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Stationary time series
Transformations

Simple Descriptive Techniques


I Descriptive methods should generally be tried before
attempting more complicated procedures, because they can be
vital in “cleaning” the data, and then getting a “feel” for
them, before trying to generate ideas a regards a suitable
model.
I If a time series contains trend, seasonality or some other
systematic component, the usual summary statistics (e.g.,
mean and standard deviation)can be seriously misleading and
should not be calculated.
I Moreover, even when a series do not contain any systematic
components, the summary statistics do not have their usual
properties.
I Focus on ways of understanding typical time-series effects,
such as trend, seasonality and correlations between successive
observations.
Dr. Bo Li Simple Descriptive Techniques
Type of variation
Stationary time series
Transformations

Type of variation – decomposing the variation in a series


I Seasonal variation: many time series exhibits variation that is
annual in period. For example, unemployment is typically
“high” in winter but lower in summer.
I Other cyclic variation: apart from seasonal effects, some time
series exhibit variation at a fixed period due to some other
physical cause. E.g., daily variation in temperature.
I Trend: loosely defined as “long term change in the mean
level”. Take into account the number of observations
available and make a subjective assessment of what is meant
by the phrase “long term”.
I Other irregular fluctuations: After trend and cyclic variations
have been removed, the residuals may or may not be
“random”. Check whether any cyclic variation is still left or
irregular variation maybe explained in terms of probability
models.
Dr. Bo Li Simple Descriptive Techniques
Type of variation
Stationary time series
Transformations

Example of type of variation

*
80

* * * *
* * * * *
* * * * * * * * * * * * *
* *
* * * * * ** *
60

* * *
*
* * * *
*
*
counts

* * * *
* *
** * * * * * * ** *
40

* **
* ** * ** ** ** * * * * * * * * *
**
* *
* *
***
* ** * *
*
* * * * ** * ** * * * * * * * * * * ** * * * * * * ** * * * *
** ** * * * ** * * * ** * * * * * * *
* * ** * * * * ** ** * * * *
20

* * * * * * **
* * * * * * * ** ** * * ** ** * * ** *
* * * **
*
0

0 100 200 300

days

Hospital admission counts for circulatory (black line) and


respiratory (red line) disease in 2002.

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Stationary time series
Transformations

Stationary time series

I A time series is said to be stationary if there is no systematic


change in mean (no trend), if there is no systematic change in
variance and if strictly periodic variations have been removed.
I Intuitively, the properties of one section of the data are much
like those of any other section.
I Strictly speaking, there is no such thing as “stationary time
series”, as the stationarity property is defined for a model.
I However, the phrase is often used for time-series data
meaning that they exhibit characteristics that suggest a
stationary model can sensibly be fitted.

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Time series with a trend
Stationary time series
Autocorrelation and correlogram
Transformations

Three main reasons for transformation

I Stabilize the variance: If there is a trend in the series and the


variance appears to increase with the mean, then it may be
advisable to transform the data.
I In particular, if the standard deviation is directly proportional
to the mean, a logarithmic transformation is indicated.
I On the other hand, if the variance changes through time
without a trend being present, then a transformation will not
help. Instead, a model that allows fro changing variance should
be considered.

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Time series with a trend
Stationary time series
Autocorrelation and correlogram
Transformations

Three main reasons for transformation

I Make the seasonal effect additive: If there is a trend in the


series and the size of the seasonal effect appears to increase
with the mean, then it may be advisable to transform the data
so as to make the seasonal effect constant from year to year.
I additive: constant seasonal effect
I multiplicative: the size of the seasonal effect is directly
proportional to the mean. A logarithmic transformation is
appropriate to make the effect additive.
I Make the data normally distributed: model building and
forecasting are usually carried out on the assumption that the
data are normally distributed. For example, Box-Cox
transformation

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Time series with a trend
Stationary time series
Autocorrelation and correlogram
Transformations

Three main reasons for transformation

Use with caution!


I There are problems in practice with transformations in that a
transformation, which makes the seasonal effect addtive, may
fail to stabilize the variance. Thus it may be impossible to
achieve all the above requirement at the same time.
I It is more difficult to interpret and forecasts produced by the
transformed model may have to be “transformed back” in
order to be of use. This can introduce biasing effects.

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Time series with a trend
Stationary time series
Autocorrelation and correlogram
Transformations

Time Series with a trend

The simplest type of trend is the familiar “linear trend + noise”:

Xt = α + βt + t ,

where α, β are constants and t denotes a random error term with


zero mean. The mean level a time t is given by

mt = α + βt

The analysis of a time series that exhibits trend depends on


whether one wants to
I measure the trend
I remove the trend in order to analyse the local fluctuations

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Time series with a trend
Stationary time series
Autocorrelation and correlogram
Transformations

Time Series with a trend

Three approaches to describe trend:


I Curve fitting: A traditional method of dealing with
non-seasonal data that contain a trend, particular yearly data,
is to fit a simple function of time such as a polynomial curve
(linear, quadratic, etc.).
I The fitted function provides a measure of the trend, and the
residuals provide an estimate of local fluctuations, where the
residuals are the differences between the observations and the
corresponding values of the fitted curve.
I Polynomial curve: mt = α + βt, e.g, mt = 0.4 + 2t
I Gompertz curve: log(mt ) = a + br t , e.g.,
log(mt ) = 3 + 2 × 0.5t
I 0.7
Logistic cruve: mt = 1+bea −ct , e.g., mt = 1+0.3e −2t

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Time series with a trend
Stationary time series
Autocorrelation and correlogram
Transformations

Time Series with a trend


Three approaches to describe trend:
I Filtering Linear filter converts one time series, xt , into
another, yt , by the linear interpolation
+s
X
yt = ar xt+r .
r =−q
P
If ar = 1, the operation is referred to as a moving average.
Moving averages are often symmetric with s = q and
aj = a−j .
1
e.g. ar = 2q+1 for r = −q, . . . , +q, and the smoothed value
of xt is given by
+q
1 X
Sm(xt ) = xt+r .
2q + 1 r =−q

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Time series with a trend
Stationary time series
Autocorrelation and correlogram
Transformations

Time Series with a trend

I Filtering
Having estimated the trend, we can look at the local
fluctuations by examing
Res(xt ) = residual from
P smoothed value
= xt − yt = sr =−q br xt+r .

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Time series with a trend
Stationary time series
Autocorrelation and correlogram
Transformations

Time Series with a trend

P+∞
I Convolution: ck = r =−∞ ar bk−r

ck = ar ? bj

Example: (1/4, 1/2, 1/4) = (1/2, 1/2) ? (1/2, 1/2)


I Differencing

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Time series with a trend
Stationary time series
Autocorrelation and correlogram
Transformations

Analyzing series that contain seasonal variation

I Three common seasonal models:


A Xt = mt + St + t
B Xt = mt St + t
C Xt = mt St t
I Smoothing average for monthly, quarterly data...
I Seasonal differencing

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Time series with a trend
Stationary time series
Autocorrelation and correlogram
Transformations

Autocorrelation and correlogram

P
i −x̄)(yi −ȳ )
I Sample autocorrelation coefficients r = √(xP 2 2 (yi −ȳ )
I Autocorrelation coefficient or serial correlation coefficient
PN−k
(xt − x̄)(xt+k − x̄)
rk = t=1PN
2
t=1 (xt − x̄)

1 PN−k
I Autocovariance ck = N t=1 (xt − x̄)(xt+k − x̄). Then,
rk = ck /c0
I Correlogram: The plot of sample autocorrelation coefficients
rk against k for k = 0, 1, ..., M.

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Time series with a trend
Stationary time series
Autocorrelation and correlogram
Transformations

Autocorrelation and Correlogram

Correlogram is also called sample AutoCorrelation Function (ac.f.)


ac.f. for house sales
Series sales
1.0
0.8
0.6
ACF

0.4
0.2
−0.2 0.0

0 5 10 15 20

Lag

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Time series with a trend
Stationary time series
Autocorrelation and correlogram
Transformations

Autocorrelation and Correlogram

ac.f. for wheat price index


Series wheat
1.0
0.8
0.6
ACF

0.4
0.2
0.0

0 5 10 15 20 25

Lag

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Time series with a trend
Stationary time series
Autocorrelation and correlogram
Transformations

Autocorrelation and Correlogram

ac.f. for instrumental temperatures


Series temp$temperature
1.0
0.8
0.6
ACF

0.4
0.2
0.0
−0.2

0 5 10 15 20

Lag

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Time series with a trend
Stationary time series
Autocorrelation and correlogram
Transformations

Autocorrelation and Correlogram


R code to generate the correlogram
acf(sales)
acf(wheat)
acf(temp$temperature)
help(acf)

Another Example:
x <- 1:100
y <- sin(x)
plot(y)
plot(y,type=’l’)
acf(y)

Dr. Bo Li Simple Descriptive Techniques


Type of variation
Time series with a trend
Stationary time series
Autocorrelation and correlogram
Transformations

Interpreting the correlogram

I Random series
I Short-term correlation
I Alternating series
I Non-stationary series
I Seasonal series
I Outliers

Dr. Bo Li Simple Descriptive Techniques

You might also like