Serii de Timp
-
Upload
piscuc-dinu -
Category
Documents
-
view
118 -
download
4
description
Transcript of Serii de Timp
![Page 1: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/1.jpg)
1
SERII DE TIMP – CURSUL 4
Netezirea exponențială (Exponential smoothing)
- Tehnică de ajustare care se poate aplica unei serii de timp cu o pronunțată componentă aleatoare. - Este utilizată în principal la realizarea de predicții, atunci cînd alte metode (ARIMA, Trend
determinist etc.) nu dau rezultate.
Context
Fie seria de timp A1 , A2 , · · · ,An..
Modelele de predicție au drept scop estimarea următoarelor componente:
1. Media
2. Trendul
3. Componenta sezonieră
4. Componenta ciclică
Procesul de predicție
1. Se estimează parametrii modelului folosind date istorice.
2. Se testează modelul prin back-testing.
3. Se utilizează modelul pentru realizarea de predicții în viitor.
Indicatori de acuratețe a predicției
- Mean absolute deviation (MAD)
n
ttt FA
nMAD
1
1
- Mean square error (MSE)
n
ttt FA
nMSE
1
2)(1
- Root mean square error (RMSE)
n
ttt FA
nRMSE
1
2)(1
- Sum of forecast errors (SFE)
n
ttt FASFE
1
)(
- Tracking signal (TS) TS = SFE/MAD
![Page 2: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/2.jpg)
2
Senzitivitate vs. stabilitate
Senzitivitate – abilitatea unui model de predicție de a răspunde la schimbările de trend din seria de timp reală.
Stabilitate – abilitatea unui model de predicție de a nu fi influențat de schimbările temporare de trend.
Modele staționare
Metoda mediilor mobile
kAAAF kttt
t11
1
Exponential Smoothing
tttttt FAFAFF )1()(1
- 0<α<1 - constanta de netezire; valori marisenzitivitate mai mare, valori micistabilitate mai mare
33
22
11 )1()1()1(ˆttttt AAAAY
- Valorile mai recente primesc ponderi mai marimemorie scurtă.
Exemplu
Month Apr-07 May-07 Jun-07 Jul-07 Aug-07 Sep-07 Oct-07 Nov-07 Dec-07
Actual 115 111 120 99 132 120 141 116 141
SMA (6 months)
104.8 108.0 111.7 111.5 109.5 114.8 116.2 120.5 121.3
ES(α = 0.2) 104.8 106.8 107.7 110.1 107.9 112.7 114.2 119.5 118.8
![Page 3: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/3.jpg)
3
MAD MSE SFE TS
Simple Moving Average 12.30 210.52 76.67 6.23
Exponential Smoothing 13.53 250.43 92.37 6.83
Predicție pentru primele trei luni ale anului 2008
Simple moving average
Forecast = (99+132+120+141+116+141)/6 = 124.8
Exponential smoothing
Forecast = 0.2(141) +(1.0 - 0.2)(118.8) = 123.3
Modele nestaționare
Double Exponential Smoothing
Metoda estimează valoarea așteptată la momentul t (Et) și modificarea la momentul t (Tt). Predicția la momentul t+n este
ttnt nTEF
0
20
40
60
80
100
120
140
160
1 2 3 4 5 6 7 8 9
Actual
SMA (6 months)
ES(α = 0.2)
![Page 4: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/4.jpg)
4
unde
)()1( 11 tttt TEAE
11 )1()( tttt TEET
- α (0 < α < 1) este parametrul care controlează media - β (0 < β < 1) este parametrul care controlează trendul.
Holt-Winters Additive Method
- estimează în plus componenta sezonieră, cu periodicitatea p. - predicția la momentul t+n este
pntttnt SnTEF
Unde:
)()1()( 11 ttpttt TESAE
11 )1()( tttt TEET
ptttt SEAS )1()(
-parametrul γ (0 < γ < 1) este folosit pentru estimarea componentei sezoniere.
Holt-Winters Multiplicative Method
pntttnt SnTEF )(
)()1( 11
ttpt
tt TE
SAE
11 )1()( tttt TEET
pt
t
tt S
EAS )1(
Filtrul Hoddrick-Prescott
- metodă utilizată pentru estimarea trendului în serii care prezintă componentă ciclică
yt = τt + ct
![Page 5: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/5.jpg)
5
})]()[()(min{1
1
2
211
2
T T
ttttttt y
- λ = 1600 pentru date trimestriale - date lunare: 100000-150000 - date anuale: 5-15
![Page 6: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/6.jpg)
6
Serii de timp sezoniere
Sezonalitate:
- Stochastică SARIMA - Deterministă medii sezoniere + trend sau sinusoide
• Dacă f(.) este o serie deterministă, atunci f(.) este periodică cu perioada s dacă ,2,1,0, ksktftf .
• Dacă Yt este un process stochastic, acesta este sezonier (periodic) de perioadă s dacă Yt și Yt+ks au aceeași distribuție.
Sezonalitate deterministă Regression with seasonal dummies
D1 = (1,0,0,0, 1,0,0,0, 1,0,0,0,...) D2 = (0,1,0,0, 0,1,0,0, 0,1,0,0,…) D3 = (0,0,1,0, 0,0,1,0, 0,0,1,0,...) D4 = (0,0,0,1, 0,0,0,1, 0,0,0,1,...)
16,000
20,000
24,000
28,000
32,000
36,000
40,000
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
PIB
![Page 7: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/7.jpg)
7
Sezonalitate + trend: t
s
iitit aDtY
1
.
hn
s
ihniihn aDhnY
1, .
Predicția:
s
ihniihn DhnY
1,ˆˆˆ .
Exemplu Numărul de pasageri transportați pe aeroporturile din România
Transformata Box-Cox pentru a stabiliza varianța: tt YY ln
500,000
1,000,000
1,500,000
2,000,000
2,500,000
3,000,000
3,500,000
2004
q1
2005
q1
2006
q1
2007
q1
2008
q1
2009
q1
2010
q1
2011
q1
2012
q1
2013
q1
2014
q1
PASAGERI
![Page 8: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/8.jpg)
8
Testul pentru trend determinist
Dependent Variable: LOG(PASAGERI) Method: Least Squares Date: 03/09/15 Time: 20:00 Sample (adjusted): 2004Q1 2014Q3 Included observations: 43 after adjustments
Variable Coefficient Std. Error t-Statistic Prob. C 13.74419 0.066799 205.7531 0.0000
@TREND 0.030092 0.002739 10.98836 0.0000 R-squared 0.746513 Mean dependent var 14.37612
Adjusted R-squared 0.740331 S.D. dependent var 0.437319 S.E. of regression 0.222848 Akaike info criterion -0.119257 Sum squared resid 2.036113 Schwarz criterion -0.037341 Log likelihood 4.564032 Hannan-Quinn criter. -0.089049 F-statistic 120.7441 Durbin-Watson stat 1.092921 Prob(F-statistic) 0.000000
13.2
13.6
14.0
14.4
14.8
15.2
2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014
LNPAS
![Page 9: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/9.jpg)
9
Corelograma reziduurilor
Corelograma seriei logaritmate
![Page 10: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/10.jpg)
10
Model cu trend și sezonalitate
ti
itit aDtY
4
1 sau t
iitit aDtY
4
1ln .
Dependent Variable: PASAGERI Method: Least Squares Date: 03/09/15 Time: 20:07 Sample (adjusted): 2004Q1 2014Q3 Included observations: 43 after adjustments
Variable Coefficient Std. Error t-Statistic Prob. @TREND 48471.73 2725.701 17.78322 0.0000
D1 517092.2 86194.22 5.999151 0.0000 D2 963172.0 87943.46 10.95217 0.0000 D3 1345242. 89741.39 14.99021 0.0000 D4 712056.6 90442.35 7.873044 0.0000
R-squared 0.917148 Mean dependent var 1906305.
Adjusted R-squared 0.908427 S.D. dependent var 731756.8 S.E. of regression 221437.0 Akaike info criterion 27.56261 Sum squared resid 1.86E+12 Schwarz criterion 27.76740 Log likelihood -587.5961 Hannan-Quinn criter. 27.63813 Durbin-Watson stat 0.758846
Dependent Variable: LOG(PASAGERI) Method: Least Squares Date: 03/09/15 Time: 20:08 Sample (adjusted): 2004Q1 2014Q3 Included observations: 43 after adjustments
Variable Coefficient Std. Error t-Statistic Prob. @TREND 0.029384 0.001964 14.96505 0.0000
D1 13.55297 0.062092 218.2721 0.0000 D2 13.80789 0.063352 217.9545 0.0000 D3 13.97890 0.064647 216.2330 0.0000 D4 13.69018 0.065152 210.1258 0.0000
R-squared 0.879620 Mean dependent var 14.37612
Adjusted R-squared 0.866949 S.D. dependent var 0.437319 S.E. of regression 0.159517 Akaike info criterion -0.724383 Sum squared resid 0.966941 Schwarz criterion -0.519592 Log likelihood 20.57423 Hannan-Quinn criter. -0.648862 Durbin-Watson stat 0.118787
![Page 11: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/11.jpg)
11
Corelograma reziduurilor
-.3
-.2
-.1
.0
.1
.2
.3
13.0
13.5
14.0
14.5
15.0
15.5
04 05 06 07 08 09 10 11 12 13 14
Residual Actual Fitted
![Page 12: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/12.jpg)
12
Predicția
0
1,000,000
2,000,000
3,000,000
4,000,000
5,000,000
6,000,000
04 05 06 07 08 09 10 11 12 13 14
L UPASAGERI PASAGERIF
0
1,000,000
2,000,000
3,000,000
4,000,000
5,000,000
6,000,000
7,000,000
04 05 06 07 08 09 10 11 12 13 14
PASAGERIF ± 2 S.E.
Forecast: PASAGERIFActual: PASAGERIForecast sample: 2004Q1 2014Q4Included observations: 43Root Mean Squared Error 305878.4Mean Absolute Error 254579.7Mean Abs. Percent Error 13.74182Theil Inequality Coefficient 0.073921 Bias Proportion 0.006671 Variance Proportion 0.104974 Covariance Proportion 0.888355
![Page 13: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/13.jpg)
13
Sezonalitate Stochastică SARIMA
SARIMA (P, D, Q)s : ts
QtDss
P aBYBB 01 , unde
sPP
sssP BBBB 2
211
sQQ
sssQ BBBB 2
211 .
Exemplu: SARIMA(0,0,1)12=SMA(1)12
120 ttt aaY .
• Condiția de invertibilitate: ||< 1.
![Page 14: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/14.jpg)
14
• E(Yt) = 0.
• 221 atYVar
•
altfel
kACF k
,0
12,1: 2 .
Exemplu: SARIMA(1,0,0)12
tt aYB 0121 - model AR sezonal.
ttt aYY 012 .
• Condiția de staționaritate:||<1.
•
1
0tYE .
• 2
2
1 a
tYVar .
• ,2,1,0,: 12 kACF kk .
Modelul multiplicativ sezonal
SARIMA(p, d, q)(P,D,Q)s : ts
QqtDsds
Pp aBBYBBBB 011 .
Condiție: rădăcinile polinoamelor (B); (Bs); (B) și (Bs) sînt în afara cercului unitate!
• Exemplu: modelul SARIMA(0,1,1)(0,1,1)12
tt aBBYBB 1212 1111 , unde ||<1 și ||<1.
• Fie Wt = (1 B)(1 B12)Yt, unde Δ= (1 B) este diferența standard, iar Δ12= (1 B12) este diferența sezonieră.
•
0~
11
13121
12
IWaaaaW
aBBW
t
ttttt
tt
.
![Page 15: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/15.jpg)
15
•
..,013,11,
12,1
1,1
0,11
2
22
22
222
wok
k
k
k
a
a
a
a
k
.
•
..,0
13,11,11
12,1
1,1
22
2
2
wo
k
k
k
k
.
SARIMA(1, 1, 1)(1,1,1)12.
12 12 121 1 (1 )(1 ) ln 1 1t tB B B B Y B B
AR(1) ne-sezonier*AR(1) sezonier*diferență ne-sezonieră*diferență sezonieră=
MA(1) ne-sezonier*MA(1) sezonier
Exemplu – Numărul de pasageri transportați de liniile aeriene în Român, valori lunare.
![Page 16: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/16.jpg)
16
a. Logaritmarea pentru inducerea staționarității în varianță: tt YY ln .
b. Eliminarea trendului prin diferențiere: 1lnlnln)1(ln tttt YYYBY
200,000
400,000
600,000
800,000
1,000,000
1,200,000
2005
m1
2006
m1
2007
m1
2008
m1
2009
m1
2010
m1
2011
m1
2012
m1
2013
m1
2014
m1
PASAGERI
-.6
-.4
-.2
.0
.2
.4
.6
2005 2006 2007 2008 2009 2010 2011 2012 2013 2014
DLNPAS
![Page 17: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/17.jpg)
17
c. Corelograma seriei logaritmate și differentiate
d. Desezonalizare: Xt = (1 - B)(1 - B12)ln Yt
series dlnpas=d(lnpas,1) series x=dlnpas-dlnpas(-12)
e. Corelograma seriei Xt
![Page 18: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/18.jpg)
18
f. Includerea termenului sezonier SMA(12)
Dependent Variable: X Method: Least Squares Date: 03/09/15 Time: 21:48 Sample (adjusted): 2006M02 2014M09 Included observations: 104 after adjustments Convergence achieved after 13 iterations MA Backcast: 2005M01 2006M01
Variable Coefficient Std. Error t-Statistic Prob. C -0.002467 0.000847 -2.913685 0.0044
MA(1) -0.741865 0.067615 -10.97193 0.0000 SMA(12) -0.932179 0.030537 -30.52573 0.0000
R-squared 0.643076 Mean dependent var -0.000836
Adjusted R-squared 0.636008 S.D. dependent var 0.157868 S.E. of regression 0.095244 Akaike info criterion -1.836318 Sum squared resid 0.916222 Schwarz criterion -1.760037 Log likelihood 98.48852 Hannan-Quinn criter. -1.805414 F-statistic 90.98681 Durbin-Watson stat 1.702707 Prob(F-statistic) 0.000000
Inverted MA Roots .99 .86-.50i .86+.50i .74 .50-.86i .50+.86i .00+.99i -.00-.99i -.50+.86i -.50-.86i -.86+.50i -.86-.50i -.99
![Page 19: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/19.jpg)
19
g. Includerea componentei sezoniere SAR(12)
Dependent Variable: X Method: Least Squares Date: 03/09/15 Time: 21:50 Sample (adjusted): 2007M03 2014M09 Included observations: 91 after adjustments Convergence achieved after 31 iterations MA Backcast: 2006M02 2007M02
Variable Coefficient Std. Error t-Statistic Prob. C -0.003168 0.002761 -1.147497 0.2544
AR(1) 0.378653 0.135663 2.791137 0.0065 SAR(12) -0.330655 0.056928 -5.808277 0.0000 MA(1) -0.850327 0.079750 -10.66237 0.0000
SMA(12) 0.974889 0.015391 63.34215 0.0000 R-squared 0.742181 Mean dependent var -0.005014
Adjusted R-squared 0.730190 S.D. dependent var 0.148348 S.E. of regression 0.077057 Akaike info criterion -2.235168 Sum squared resid 0.510648 Schwarz criterion -2.097208 Log likelihood 106.7001 Hannan-Quinn criter. -2.179510 F-statistic 61.89199 Durbin-Watson stat 1.975411 Prob(F-statistic) 0.000000
Inverted AR Roots .88+.24i .88-.24i .64-.64i .64-.64i .38 .24-.88i .24+.88i -.24+.88i -.24-.88i -.64+.64i -.64-.64i -.88+.24i -.88-.24i
Inverted MA Roots .96+.26i .96-.26i .85 .71-.71i .71+.71i .26-.96i .26+.96i -.26+.96i -.26-.96i -.71-.71i -.71-.71i -.96-.26i -.96+.26i
Model final:
12 121 0.37 1 0.33 1 0.85 1 0.97t tB B X B B unde t este WN N(0, =0.07).
12 12 121 0.37 1 0.33 (1 )(1 ) ln 1 0.85 1 0.97t tB B B B Y B B unde t este WN N(0, =0.07).
![Page 20: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/20.jpg)
20
Predicția
-.3
-.2
-.1
.0
.1
.2
-.6
-.4
-.2
.0
.2
.4
.6
2007 2008 2009 2010 2011 2012 2013 2014
Residual Actual Fitted
200,000
400,000
600,000
800,000
1,000,000
1,200,000
1,400,000
2007 2008 2009 2010 2011 2012 2013 2014
PASAGERIF ± 2 S.E.
Forecast: PASAGERIFActual: PASAGERIForecast sample: 2005M01 2014M09Adjusted sample: 2007M03 2014M09Included observations: 91Root Mean Squared Error 50852.49Mean Absolute Error 37763.02Mean Abs. Percent Error 5.429306Theil Inequality Coefficient 0.032662 Bias Proportion 0.000374 Variance Proportion 0.003338 Covariance Proportion 0.996288
![Page 21: Serii de Timp](https://reader034.fdocumente.com/reader034/viewer/2022050706/5695d4a91a28ab9b02a2422a/html5/thumbnails/21.jpg)
21
400,000
600,000
800,000
1,000,000
1,200,000
1,400,000
I II III IV I II III IV I II III
2012 2013 2014
UPPER PASAGERIFPASAGERI LOWER