Вы находитесь на странице: 1из 8

A Sample Introductory Time Series Analysis

Martin Minchev
February 3, 2018

Introduction
ACF of SQRT of the Time Series

0.8
This project examines the monthly production of
chocolate confectionery(in tonnes) in Australia for

0.6
the period July 1957 – Aug 1995. Link to data

ACF

0.4
This file is generated with R Markdown and the code

0.2
can be replicated with R Studio.

0.0
Monthly Production of Chocolate Confectionery (in tonnes) in Australia
0 1 2 3 4

Lag

9000

PACF of SQRT of the Time Series


Production (in tonnes)

0.8
6000

0.4
Partial ACF

3000
0.0

1960 1970 1980 1990


−0.4

Month

We see an increase in the variation with time and 0 1 2 3 4


in order to minimize this effect, we will work from
Lag
now on with the sqrt-data. Below are presented
the sqrt and log data and we can see that the sqrt We observe the obvious periodicity with pe-
transformation seems more suitable in this case. riod 12(months) - the expected annual pe-
SQRT of Data LOG of Data
riodicity. Furthermore, stationary models
would be inappropriate for modelling in this
9.0

90
case. Thus, we examine the first difference:
Sqrt of Production (in tonnes)

Log of Production (in tonnes)

8.5 First difference of the TS

70
30

8.0
20
Differences

10

50 7.5
0
−10

7.0
30
1960 1970 1980 1990 1960 1970 1980 1990
Month Month
−30

1960 1970 1980 1990

Time

Choosing suitable SARIMA models

First, we examine the (estimated)autocorrelation and


partial autocorrelation functions(ACF and PACF)

1
ACF of the First Difference of the TS Data After First Difference and First Seasonal Difference
0.8

15
10
0.6

5
0.4

0
ACF

t
0.2

−10
0.0
−0.2

−20
0 2 4 6 8 1960 1970 1980 1990

Lag Time

PACF of the First Difference of the TS ACF After First Difference and First Seasonal Difference
0.2

0.2
0.0
Partial ACF

0.0
−0.6 −0.4 −0.2

ACF

−0.2
−0.4

0 2 4 6 8 0 2 4 6 8

Lag Lag

PACF After First Difference and First Seasonal Difference


0.2

## AR/MA
## 0 1 2 3 4 5 6 7 8 9 10 11 12 13
Partial ACF

0.0

## 0 x x x o o o o o x x x x x x
## 1 x x o o o o o o o x o x x x
−0.2

## 2 x x o o o o o o o o o x x x
## 3 x x o o o o o o o o o x x x
−0.4

## 4 x x x o o o o o o o o x x x
## 5 x x x o o o o o o o o x x x 0 2 4 6 8
## 6 x x x o o x o o o o o x x x Lag
## 7 x o x x x o o o o o o x x x

## AR/MA
## 0 1 2 3 4 5 6 7 8 9 10 11 12 13
## 0 x o o o o o o o o o x x x o
Seasonal trend continues to be obvious(with lag ## 1 x o o o o o o o o o x x x x
12). Also the ACF decrease is not exponential ## 2 x o o o o o o o o o o x x x
but linear, that is why we can take also one ## 3 x x o x o o o o o o o x o o
seasonal difference. However, we can examine ## 4 x x x o x o o o o o o x x o
ARMA(1/2,2) or ARMA(0,3) models for the non- ## 5 x x x x o o o o o o o x o o
seasonal part and ARMA(1,0) for the seasonal ## 6 x o x x o o o o o o o x x x
part(ignoring the slow decrease in the ACF). So ## 7 x x x o o o o o o o o x x o
we add the models SARIMA(0,1,3)x(1,0,0)[12],
SARIMA(1,1,2)x(1,0,0)[12], The seasonal difference did hardly any good. However,
SARIMA(2,1,2)x(1,0,0)[12] in our list for further we can further examine SARIMA(0,1,1)x(1,1,0)[12],
examination. SARIMA(1,1,2)x(1,1,0)[12].

2
We will note that the function auto.arima from the Comparing chosen models
‘forecast’ library returns SARIMA(2,1,0)x(1,0,0)[12]
for the sqrt-data and after 1st difference and
SARIMA(1,1,2)(0,1,1)[12] after 1st and seasonal dif-
ference.

3
ACF of the Residuals of an SARIMA(0,1,3)x(1,0,0)[12] ACF of the Residuals of an SARIMA(1,1,2)x(1,1,0)[12]

0.10
0.1
0.0

0.00
ACF

ACF
−0.1

−0.10
−0.2

−0.20
−0.3

0 2 4 6 8 0 2 4 6 8

Lag Lag

ACF of the Residuals of an SARIMA(1,1,2)x(1,0,0)[12] ACF of the Residuals of an SARIMA(2,1,0)x(1,0,0)[12]

0.1
0.1

0.0
0.0
ACF

ACF

−0.1
−0.1

−0.2
−0.2

−0.3
−0.3

0 2 4 6 8 0 2 4 6 8

Lag Lag

ACF of the Residuals of an SARIMA(2,1,2)x(1,0,0)[12] ACF of the Residuals of an SARIMA(1,1,2)x(0,1,1)[12]


0.00 0.05 0.10
0.1
0.0
ACF

ACF
−0.1
−0.2

−0.10
−0.3

0 2 4 6 8 0 2 4 6 8

Lag Lag

ACF of the Residuals of an SARIMA(0,1,1)x(1,1,0)[12]


0.1
0.0
ACF

−0.1
−0.2

0 2 4 6 8

Lag

4
Residuals of an SARIMA(0,1,3)x(1,0,0)[12] Residuals of an SARIMA(1,1,2)x(1,1,0)[12]

4
Standartized Residuals

Standartized Residuals
2

3
2
0

1
0
−2

−2 −1
−4

1960 1970 1980 1990 1960 1970 1980 1990

Time Time

Residuals of an SARIMA(1,1,2)x(1,0,0)[12] Residuals of an SARIMA(2,1,0)x(1,0,0)[12]

3
2
Standartized Residuals

Standartized Residuals
2

1
0
0

−1
−2

−2
−3
−4

1960 1970 1980 1990 1960 1970 1980 1990

Time Time

Residuals of an SARIMA(2,1,2)x(1,0,0)[12] Residuals of an SARIMA(1,1,2)x(0,1,1)[12]


4
Standartized Residuals

Standartized Residuals
2

2
0

0
−2

−2
−4

1960 1970 1980 1990 1960 1970 1980 1990

Time Time

Residuals of an SARIMA(0,1,1)x(1,1,0)[12]
4
Standartized Residuals

2
0
−2

1960 1970 1980 1990

Time

5
SARIMA(0,1,3)x(1,0,0)[12],
Normal Q−Q Plot
Shapiro-Wilk normality test p-value - 0.1472:

4
Normal Q−Q Plot

Sample Quantiles

2
2
Sample Quantiles

0
0

−2
−2

−3 −2 −1 0 1 2 3
−4

Theoretical Quantiles
−3 −2 −1 0 1 2 3

Theoretical Quantiles
SARIMA(1,1,2)x(1,1,0)[12],
Shapiro-Wilk normality test p-value - 0.02209:
SARIMA(1,1,2)x(1,0,0)[12],
Normal Q−Q Plot
Shapiro-Wilk normality test p-value - 0.1369:
Normal Q−Q Plot

4
3
Sample Quantiles

2
2

1
Sample Quantiles

0
0

−2 −1
−2

−3 −2 −1 0 1 2 3
−4

Theoretical Quantiles
−3 −2 −1 0 1 2 3

Theoretical Quantiles
SARIMA(2,1,0)x(1,0,0)[12],
Shapiro-Wilk normality test p-value - 0.2987:
SARIMA(2,1,2)x(1,0,0)[12],
Normal Q−Q Plot
Shapiro-Wilk normality test p-value - 0.1572:
3

Normal Q−Q Plot


2
Sample Quantiles

1
0
2
Sample Quantiles

−1
−2
0

−3
−2

−3 −2 −1 0 1 2 3
−4

Theoretical Quantiles
−3 −2 −1 0 1 2 3

Theoretical Quantiles
SARIMA(1,1,2)x(0,1,1)[12], Shapiro-Wilk
normality test p-value - 0.0005131:
SARIMA(0,1,1)x(1,1,0)[12],
Shapiro-Wilk normality test p-value - 0.1536:

6
Fits
Normal Q−Q Plot

SARIMA(2,1,2)x(1,0,0)[12] Fit
4
Sample Quantiles

SQRT of Chocolate Confectionery


2

90
0

Legend
70 Fitted Values
−2

Real Data

−3 −2 −1 0 1 2 3 50

Theoretical Quantiles

30
1960 1970 1980 1990
Based on the Shapiro-Wilk test we ex- Month
clude the SARIMA(1,1,2)x(1,1,0)[12] and SARIMA(1,1,2)x(1,0,0)[12] Fit
SARIMA(1,1,2)x(0,1,1)[12] models.
For brevity, we plot the fits and forecast for three of

SQRT of Chocolate Confectionery


the remaining 5 models : SARIMA(1,1,2)x(1,0,0)[12], 90

SARIMA(2,1,2)x(1,0,0)[12] and
SARIMA(2,1,0)x(1,0,0)[12]. Legend
70 Fitted Values
Real Data

50

30
1960 1970 1980 1990
Month

SARIMA(2,1,0)x(1,0,0)[12] Fit
110
SQRT of Chocolate Confectionery

90

Legend
70 Fitted Values
Real Data

50

30
1960 1970 1980 1990
Month

We can observe that these models almost always


underestimate the January shock in chocolate
confectionery. A more detailed approach should be
considered for examining this phenomena.

7
Forecasts Forecasts from ARIMA(2,1,2)(1,0,0)[12]

SQRT of Chocolate Confectionery


100

level
75 80
95

50

1960 1970 1980 1990


Month

SARIMA(2,1,0)x(1,0,0)[12] Forecast with TSA Package


SARIMA(1,1,2)x(1,0,0)[12] Forecast with TSA Package

SQRT of Chocolate Confectionery

140
SQRT of Chocolate Confectionery

120
100

100
90

80
80
70

60
60

1990 1992 1994 1996


1990 1992 1994 1996
Month
Month
Forecasts from ARIMA(2,1,0)(1,0,0)[12]
Forecasts from ARIMA(1,1,2)(1,0,0)[12]

120
SQRT of Chocolate Confectionery
SQRT of Chocolate Confectionery

100

90 level
80
level
75 95
80
95

60

50

30
1960 1970 1980 1990
Month
1960 1970 1980 1990
Month

SARIMA(2,1,2)x(1,0,0)[12] Forecast with TSA Package


Conclusion
SQRT of Chocolate Confectionery

Although the data was not simulated, we observe that


it can be reasonably modeled with an appropriate
100

seasonal ARIMA model.


90
80
70
60

1990 1992 1994 1996

Month

Вам также может понравиться