Professional Documents
Culture Documents
Time Series 3 - Model Trend
Time Series 3 - Model Trend
Lecture 3: Trend
Semester 6A
Program Studi Matematika
Fakultas Sains dan Teknologi
UIN Syarif Hidayatullah Jakarta
2015/2016
Stationary model
Non-stationary model
= +
= + 1 +
where ~ 0, 2 .
= +
= + 1 +
where ~ 0, 2 .
It is easy to see that
= =
but
= 2 and = 2
60
40
20
0
y(t)
80
100
120
y(t) = 0.5*t + e
y(t) = 0.5 + y(t-1) + e
50
100
Time
150
200
20
40
y(t)
60
80
y(t) = 0.5*t + e
y(t) = 0.5 + y(t-1) + e
50
100
t
150
200
Deterministic trend
= 0 + 1 + 2 2 +
In general:
= +
Regression Analysis
0 , 1 =
0 + 1
=1
We find that:
1 =
=1
=1
0 = 1
where =
+1
2
Example 1
library(TSA)
data(rwalk)
plot(rwalk, type = "o")
model1 <- lm(rwalk~time(rwalk))
summary(model1)
2
0
-2
>
>
>
>
>
10
20
30
Time
40
50
60
Example 1
R Output:
Example 1
R Output:
= 1.01 + 0.13
-2
10
20
30
40
50
60
Example 2
10
20
30
40
50
60
70
Temperature
1964
1966
1968
1970
Time
1972
1974
1976
R Code:
>
>
>
>
data(tempdub)
month. <- season(tempdub) # period added to improve table display
model2 <- lm(tempdub ~ -1 + month.) # -1 removes the intercept term
summary(model2)
R Output:
R Code:
> model3 <- lm(tempdub ~ month.) # January is dropped automatically
> summary(model3)
R Output:
=1
2
=1
For large :
120 (1 + 21 )
(1 ) =
(2 1)
If is a white noise:
1
120 1 + 21
120
=
=
2
( 1)
(2 1)
120 1 + 21
120 (0.2)
=
=
2
( 1)
(2 1)
=1
R output:
Residual analysis
-2
-1
Standardized Residuals
1964
1966
1968
1970
Time
1972
1974
1976
-2
-1
Standardized Residuals
J
JO
F O
M
D
S
JM N
A
F
M
N M
A
A
D
DJ
A A
A
J
J M
A
O A
M J D AO
S
S
J
N
A
S
AJ
D
A M S JJ
J
N
NF
J J
D
N J
S J J O J SN J S F J S
AJ
N
F
O
O
F
JN
M
F
AJAS
AO
F
MJJ A
A
M AO F
JO
M
A
A
N
M
M DJM D
M
A
D MJ S
O
N
D
J JF N
S
MA
M
O
A
J
J
F
J
D
M
J
M
FM
1964
1966
1968
1970
Time
1972
1974
1976
-1
J
J
J
J
J
J
J
J
-2
Standardized Residuals
J
J
D
F
F
F
F
F
F
F
D
D
D
D
D
D
D
D
M
M
M
M
M
O
O
N
N
N
N
N
N
N
N
N
N
A
A
A
A
A
A
A
A
A
A
O
O
O
O
O
O
O
M
M
S
M
M
S
M S
S
S
S
M
M
M S
M S
M
J
A
A
J
J
A
J
A
J
A J
J
J
J
J A
A J
J
A J
J A J
J
M
M
J
20
30
40
50
60
70
R Code:
> hist(rstudent(model3),xlab='Standardized Residuals, main = )
> qqnorm(rstudent(model3))
> shapiro.test(rstudent(model3))
1
0
-2
-1
Sample Quantiles
20
15
10
5
0
Frequency
25
30
35
-3
-2
-1
Standardized Residuals
-2
-1
Theoretical Quantiles
R Code:
-0.15
-0.05
ACF
0.05
0.15
> acf(rstudent(model3))
10
15
Lag
20
= 1.01 + 0.13
-2
10
20
30
40
50
60
Residual plots:
1
0
-1
-2
Standardized Residuals
10
20
30
40
50
60
time
The plot is too smooth and hang
together too much for white
noise.
Residual plots:
0
-1
-2
residuals
0
-1
8
6
4
-2
2
0
Frequency
10
Sample Quantiles
12
14
Histogram of rstudent(model)
-3
-2
-1
rstudent(model)
-2
-1
0
Theoretical Quantiles
0.2
0.4
0.6
Series rstudent(model)
-0.4
-0.2
0.0
ACF
10
Lag
15
8.0
8.5
9.0
9.5
Wages
1982
1983
1984
1985
Time
1986
1987
8.0
8.5
9.0
9.5
Wages
1982
1983
1984
1985
Time
1986
1987
-3
-2
-1
Residual plot:
standardized residuals
10
20
30
40
Index
50
60
70
-0.2
0.0
0.2
0.4
0.6
0.8
Series r
ACF
10
Lag
15