SlideShare a Scribd company logo
1 of 61
Download to read offline
ESGF 5IFM Q1 2012
Financial Econometric Models
  Vincent JEANNIN – ESGF 5IFM
            Q1 2012




                                vinzjeannin@hotmail.com
                                      1
ESGF 5IFM Q1 2012
Summary of the session (Est. 3h)

•   Reminder of Last Session
•   Time Series Analysis Principles
•   Auto Regressive Process




                                      vinzjeannin@hotmail.com
•   Moving Average Process
•   ARMA
•   Conclusion




                                            2
Be logic!
                                                          Reminder of Last Session




            vinzjeannin@hotmail.com   ESGF 5IFM Q1 2012
  3
Differentiation possible




                                                  ESGF 5IFM Q1 2012
                                                  vinzjeannin@hotmail.com
������������������������������ = ln⁡ ������)
               (
                                                        4
Time can be a factor of a regression




                                       vinzjeannin@hotmail.com   ESGF 5IFM Q1 2012
          5
Differentiation can add value




                                    vinzjeannin@hotmail.com   ESGF 5IFM Q1 2012
                                6
Check ACF/PACF for autocorrelation




                                     vinzjeannin@hotmail.com   ESGF 5IFM Q1 2012
         7
Time Series Analysis Principles




                                  ESGF 4IFM Q1 2012
    Reminders of the 3 steps




                                  vinzjeannin@hotmail.com
                   Identify

                   Fit

                   Forecast




                                        8
ESGF 4IFM Q1 2012
Reminders of the 3 components




                                vinzjeannin@hotmail.com
              Trend

              Seasonality

              Residual




                                      9
Lag



������������������ = ������������−1




                               ESGF 4IFM Q1 2012
      Difference




                               vinzjeannin@hotmail.com
∆������������ = ������������ − ������������−1



      Seasonality Difference



∆30 ������������ = ������������ − ������������−30      10
ESGF 4IFM Q1 2012
Differentiate series to obtain stationary series



Time series analysis and forecast simpler with stationary series




                                                                   vinzjeannin@hotmail.com
Different models involved with stationary or heteroscedasticity




                                                                   11
Properties of stationary series


          Same distribution of the following




                                                              ESGF 4IFM Q1 2012
     (������1 , ������2 , ������3 , … , ������������ )
     (������2 , ������3 , ������4 , … , ������������+1 )

          Distribution not time dependent




                                                              vinzjeannin@hotmail.com
          Rare occurrence


                  Stationarity accepted if

          ������(������������ ) = ������               Constant in the time
                                                              12
     ������������������(������������ , ������������−������ )           Depends only on n
Acceptable Shortcut




                                                                 ESGF 4IFM Q1 2012
A series is stationary if the mean and the variance are stable


Which one is more likely to be stationary?




                                                                 vinzjeannin@hotmail.com
                                                                 13
About the residuals…


        White noise!




                                                       ESGF 4IFM Q1 2012
Normality test




                                                       vinzjeannin@hotmail.com
     Have an idea with

           Skewness

           Kurtosis


      Proper tests: KS, Durbin Watson, Portmanteau,…
                                                       14
Auto Regressive Process
   Main principle




                                                                         ESGF 4IFM Q1 2012
    There is a correlation between current data and previous data



         ������������ = ������ + ������1 ������������−1 + ������2 ������������−2 + ⋯ + ������������ ������������−������ + ������������




                                                                         vinzjeannin@hotmail.com
    ������������ Parameters of the model
    ������������ White noise


    AR(n)


    If the parameters are identified, the prediction will be easy        15
Let’s upload some data

DATA<-read.csv(file="C:/Users/vin/Desktop/Series1.csv",header=T)
plot(DATA$Val, type="l")




                                                                   ESGF 4IFM Q1 2012
                                                                   vinzjeannin@hotmail.com
                                                                   16
Is this a white noise?


              hist(DATA$Val, breaks=20)




                                          ESGF 4IFM Q1 2012
                                          vinzjeannin@hotmail.com
                                          17
Probably not…


                 Portmanteau test




                                                                                                 ESGF 4IFM Q1 2012
                           Test the autocorrelation of a series

                           If there is autocorrelation, data aren’t independently distributed




                                                                                                 vinzjeannin@hotmail.com
                                      Let’s use Ljung–Box statistics

                             H0: Data are independently distributed
                            H1: Data aren’t independently distributed

                      ������
                             ������2 ������                       With α confidence interval rejection
   ������ = ������(������ + 2)                                        following a Chi Square distribution
                            ������ − ������
                     ������=1
                                                                                                 18
������������    Autocorrelation at the lag k                                   ������ > Χ 21−������,ℎ
> Box.test(DATA$Val)




                                                                 ESGF 4IFM Q1 2012
 Box-Pierce test

data: DATA$Val
X-squared = 188.3263, df = 1, p-value < 2.2e-16




                                                                 vinzjeannin@hotmail.com
     H0 is rejected, the data aren’t independently distributed




                                                                 19
Let’s try a regression and analyse residuals

      TReg<-lm(DATA$Val~DATA$t)
      plot(DATA$Val, type="l")




                                               ESGF 4IFM Q1 2012
      abline(TReg, col="blue")




                                               vinzjeannin@hotmail.com
                                               20
eps<-resid(TReg)
ks.test(eps, "pnorm")
layout(matrix(1:4,2,2))
plot(TReg)




                          ESGF 4IFM Q1 2012
                          vinzjeannin@hotmail.com
                          21
Box-Pierce test




                                                       ESGF 4IFM Q1 2012
data: eps
X-squared = 187.6299, df = 1, p-value < 2.2e-16




Residuals aren’t a white noise




                                                       vinzjeannin@hotmail.com
Regression rejected




     Not a surprise, did the series look stationary?

                                                       22
     What next then?
lag.plot(DATA$Val, 9, do.lines=FALSE)




                                            ESGF 4IFM Q1 2012
                                            vinzjeannin@hotmail.com
                                            23
Differentiation seems to be interesting
Does the differentiation create a stationary series?

           plot(diff(DATA$Val), type="l")




                                                       ESGF 4IFM Q1 2012
                                                       vinzjeannin@hotmail.com
                                                       24
ACF & PACF

    par(mfrow=c(2,1))
    acf(diff(DATA$Val),20)




                                                              ESGF 4IFM Q1 2012
    pacf(diff(DATA$Val),20)




                                                              vinzjeannin@hotmail.com
                              ACF decreasing




                              PACF cancelling after order 1
                                                              25
Decreasing ACF




                                            ESGF 4IFM Q1 2012
PACF cancel after order 1




                                            vinzjeannin@hotmail.com
      Typically an Autoregressive Process



      AR(1) ?


                                            26
Let’s try to fit an AR(1) model
     Modl<-ar(diff(DATA$Val),order.max=20)
     plot(Modl$aic)




                                                ESGF 4IFM Q1 2012
                                                vinzjeannin@hotmail.com
                                                27
The likelihood for the order 1 is significant
> ar(diff(DATA$Val),order.max=20)

       Call:
       ar(x = diff(DATA$Val), order.max = 20)

       Coefficients:
             1       2            3




                                                                 ESGF 4IFM Q1 2012
        0.5925 -0.1669       0.1385

       Order selected 3     sigma^2 estimated as        0.8514




                                                                 vinzjeannin@hotmail.com
We have our coefficient and standard deviation

          > ARDif<-diff(DATA$Val)
          > ARDif[1]
          [1] 0.3757723


We know the first term of our series

             ������������ = 0.3757723 + 0.5925. ������������−1 + ������������
                                                                 28
Here is our model
Need to test the residuals




                                                                        ESGF 4IFM Q1 2012
Box.test(Modl$resid)

        Box-Pierce test




                                                                        vinzjeannin@hotmail.com
data: Modl$resid
X-squared = 7e-04, df = 1, p-value = 0.9789




   H0 accepted, residuals are independently distributed (white noise)


      The differentiated series is a AR(1)
                                                                        29
> predict(arima(diff(DATA$Val), order = c(1,0,0)), n.ahead = 7)
          $pred
          Time Series:
          Start = 193
          End = 199
          Frequency = 1
          [1] -0.81359048 -0.43300609 -0.22850452 -0.11861853 -0.05957287 -




                                                                                                                                  ESGF 4IFM Q1 2012
          0.02784553 -0.01079729

          $se
          Time Series:
          Start = 193
          End = 199
          Frequency = 1




                                                                                                                                  vinzjeannin@hotmail.com
          [1] 0.923352 1.048210 1.081582 1.091027 1.093739 1.094521 1.094747
120

115

110

105

100

95

90
                                                                                                                                  30
85

80
      1    6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96 101106111116121126131136141146151156161166171176181186191196
ESGF 4IFM Q1 2012
Another typical example?




                                vinzjeannin@hotmail.com
       You make the comments!




                                31
DATA<-read.csv(file="C:/Users/vin/Desktop/Series2.csv",header=T)
plot(DATA$Ser2, type="l")
hist(DATA$Ser2, breaks=20)




                                                                   ESGF 4IFM Q1 2012
                                                                   vinzjeannin@hotmail.com
                                                                   32
> Box.test(DATA$Ser2)


        Box-Pierce test

data: DATA$Ser2
X-squared = 149.9227, df = 1, p-value < 2.2e-16




                                                                  ESGF 4IFM Q1 2012
                                                                  vinzjeannin@hotmail.com
                                     TReg<-lm(DATA$Ser2~DATA$t)
                                     plot(DATA$Ser2, type="l")
                                     abline(TReg, col="blue")




                                                                  33
> eps<-resid(TReg)
> Box.test(eps)

 Box-Pierce test

data: eps
X-squared = 148.5669, df = 1, p-value < 2.2e-16




                                                  ESGF 4IFM Q1 2012
  > layout(matrix(1:4,2,2))
  > plot(TReg)




                                                  vinzjeannin@hotmail.com
                                                  34
> lag.plot(DATA$Ser2, 9, do.lines=FALSE)




                                                ESGF 4IFM Q1 2012
                                                vinzjeannin@hotmail.com
                                                35

Much less obvious but clues of autoregression
par(mfrow=c(2,1))
plot(diff(DATA$Ser2), type="l")
plot(diff(DATA$Ser2, lag=2), type="l")




                                         ESGF 4IFM Q1 2012
                                         vinzjeannin@hotmail.com
                                         36
par(mfrow=c(2,1))
plot(diff(DATA$Ser2), type="l")
plot(diff(DATA$Ser2, lag=2), type="l")




                                                             ESGF 4IFM Q1 2012
                                     ACF decreases 2 by 2




                                                             vinzjeannin@hotmail.com
                                     PACF cancelling after
                                     order 2

                                                             37
First order differentiation, strong AR(2) clues

      par(mfrow=c(1,1))




                                                  ESGF 4IFM Q1 2012
      Modl<-ar(diff(DATA$Ser2),order.max=20)
      plot(Modl$aic)




                                                  vinzjeannin@hotmail.com
                                                  38
Parameters estimation

> ar(diff(DATA$Ser2),order.max=20)




                                                  ESGF 4IFM Q1 2012
Call:
ar(x = diff(DATA$Ser2), order.max = 20)

Coefficients:
      1       2          3




                                                  vinzjeannin@hotmail.com
 0.5919 -0.8326     0.1086

Order selected 3   sigma^2 estimated as   0.877



> ARDif<-diff(DATA$Ser2)
> ARDif[1]
[1] 0.3757723




                                                  39
> predict(arima(diff(DATA$Ser2), order = c(2,0,0)), n.ahead = 7)
$pred
Time Series:
Start = 193
End = 199
Frequency = 1
[1] 0.4505213 2.0075741 0.6639701 -1.2321156 -1.1409989 0.3866745
1.0879588




                                                                            ESGF 4IFM Q1 2012
$se
Time Series:
Start = 193
End = 199
Frequency = 1
[1] 0.9220713 1.0332515 1.1413067 1.2938326 1.2957576 1.3932158 1.4080266




                                                                            vinzjeannin@hotmail.com
115


110


105


100


95


90
                                                                            40
85


80
      101
      106
      111
      116
      121
      126
      131
      136
      141
      146
      151
      156
      161
      166
      171
      176
      181
      186
      191
      196
        1
        6
       11
       16
       21
       26
       31
       36
       41
       46
       51
       56
       61
       66
       71
       76
       81
       86
       91
       96
> Box.test(Modl$resid)

        Box-Pierce test




                                                              ESGF 4IFM Q1 2012
data: Modl$resid
X-squared = 0.0023, df = 1, p-value = 0.9619




                                                              vinzjeannin@hotmail.com
  Model accepted



  The more factors the harder the prediction is


  The more factors there are the more stationary need to be
  the series for a good prediction
                                                              41
Moving Average Process
   Main principle




                                                                        ESGF 4IFM Q1 2012
   Stationary series with auto correlation of errors



        ������������ = ������ + ������������ + ������1 ������������−1 + ������2 ������������−2 + ⋯ + ������������ ������������−������




                                                                        vinzjeannin@hotmail.com
   ������������ Parameters of the model
    ������������ White noise


   MA(n)


   More difficult to estimate than a AR(n)                              42
plot(Data, type="l")
hist(Data, breaks=20)




                        ESGF 4IFM Q1 2012
                        vinzjeannin@hotmail.com
                        43
acf(Data,20)
pacf(Data,20)




                                                 ESGF 4IFM Q1 2012
                              ACF cancels
                              after order 1




                                                 vinzjeannin@hotmail.com
                              PACF decays to 0




                                                 44
   ACF & PACF suggest MA(1)
> arima(Data, order = c(0, 0, 1),include.mean = FALSE)

Call:
arima(x = Data, order = c(0, 0, 1), include.mean = FALSE)

Coefficients:
          ma1




                                                                            ESGF 4IFM Q1 2012
      -0.4621
s.e.   0.0903

sigma^2 estimated as 0.937:    log likelihood = -138.76,     aic = 281.52




                                                                            vinzjeannin@hotmail.com
     > Box.test(Rslt$residuals)

      Box-Pierce test

     data: Rslt$residuals
     X-squared = 0, df = 1, p-value = 0.9967




                                                                            45
                It works, MA(1), 0 mean, parameter -0.4621
Fore<-predict(Rslt, n.ahead=5)
U = Fore$pred + 2*Fore$se
L = Fore$pred - 2*Fore$se
minx=min(Data,L)
maxx=max(Data,U)
ts.plot(Data,Fore$pred,col=1:2,
ylim=c(minx,maxx))
lines(U, col="blue", lty="dashed")




                                     ESGF 4IFM Q1 2012
lines(L, col="blue", lty="dashed")




                                     vinzjeannin@hotmail.com
                                     46
ESGF 4IFM Q1 2012
Another typical example?




                                vinzjeannin@hotmail.com
       You make the comments!




                                47
plot(Data, type="l")
hist(Data, breaks=20)




                        ESGF 4IFM Q1 2012
                        vinzjeannin@hotmail.com
                        48
vinzjeannin@hotmail.com   ESGF 4IFM Q1 2012
49
> arima(Data, order = c(0, 0, 2),include.mean = FALSE)

Call:




                                                                         ESGF 4IFM Q1 2012
arima(x = Data, order = c(0, 0, 2), include.mean = FALSE)

Coefficients:
          ma1      ma2
      -0.5365   0.6489
s.e.   0.0701   0.1044




                                                                         vinzjeannin@hotmail.com
sigma^2 estimated as 1.005:   log likelihood = -142.74,   aic = 291.48

> Box.test(Rslt$residuals)

        Box-Pierce test

data: Rslt$residuals
X-squared = 0.0283, df = 1, p-value = 0.8664



                                                                         50
                  MA(2)
Fore<-predict(Rslt, n.ahead=5)
U = Fore$pred + 2*Fore$se
L = Fore$pred - 2*Fore$se
minx=min(Data,L)
maxx=max(Data,U)
ts.plot(Data,Fore$pred,col=1:2,
ylim=c(minx,maxx))




                                     ESGF 4IFM Q1 2012
lines(U, col="blue", lty="dashed")
lines(L, col="blue", lty="dashed")




                                     vinzjeannin@hotmail.com
                                     51
ARMA
      Main principle




                                                                                     ESGF 4IFM Q1 2012
 The series is a function of past values plus current and past values of the noise




                                                                                     vinzjeannin@hotmail.com
             ARMA(p,q)



                    Combines AR(p) & MA(q)




                                                                                     52
plot(Data, type="l")
hist(Data, breaks=20)




                        ESGF 4IFM Q1 2012
                        vinzjeannin@hotmail.com
                        53
ESGF 4IFM Q1 2012
                                                          vinzjeannin@hotmail.com
                                                          54
Both ACF and PACF decreases exponentially after order 1
> Rslt<-arima(Data, order = c(1, 0, 1),include.mean = FALSE)
> Rslt

Call:
arima(x = Data, order = c(1, 0, 1), include.mean = FALSE)




                                                                         ESGF 4IFM Q1 2012
Coefficients:
         ar1    ma1
      0.7214 0.7563
s.e. 0.0716 0.0721

sigma^2 estimated as 0.961:   log likelihood = -141.13,   aic = 288.27




                                                                         vinzjeannin@hotmail.com
> Box.test(Rslt$residuals)

        Box-Pierce test

data: Rslt$residuals
X-squared = 0.0098, df = 1, p-value = 0.9213




            ARMA(1,1) fits
                                                                         55
>   par(mfrow=c(1,1))
>   Fore<-predict(Rslt, n.ahead=5)
>   U = Fore$pred + 2*Fore$se
>   L = Fore$pred - 2*Fore$se
>   minx=min(Data,L)
>   maxx=max(Data,U)




                                     ESGF 4IFM Q1 2012
                                     vinzjeannin@hotmail.com
                                     56
Identification can get tricky at this stage




                                              ESGF 4IFM Q1 2012
                                              vinzjeannin@hotmail.com
                                              57
What do you think?




     vinzjeannin@hotmail.com   ESGF 4IFM Q1 2012
58
> Rslt<-arima(Data, order = c(4, 0, 3),include.mean = FALSE)
> Rslt

Call:
arima(x = Data, order = c(4, 0, 3), include.mean = FALSE)

Coefficients:




                                                                             ESGF 4IFM Q1 2012
         ar1     ar2       ar3       ar4      ma1       ma2        ma3
      0.2722 -0.5276    0.0202   -0.2663   0.8765   -0.4672    -0.5248
s.e. 0.2018   0.2308    0.1968    0.1546   0.1992    0.1690     0.1882

sigma^2 estimated as 1.140:    log likelihood = -151.19,      aic = 318.38
> Box.test(Rslt$residuals)




                                                                             vinzjeannin@hotmail.com
        Box-Pierce test

data: Rslt$residuals
X-squared = 0.2953, df = 1, p-value = 0.5869




        Was supposed to fit pretty wel….



         Data<-arima.sim(model=list(ar=c(0.5,-0.5,0.3,-
                                                                             59
         0.3),ma=c(0.75,-0.5,-0.5)),n=100)
Identification can be difficult




                                                ESGF 4IFM Q1 2012
Easiest model is AR



Imagine when the series is not stationary…




                                                vinzjeannin@hotmail.com
Step by step approach, exploration, tries,…



        Sometimes you find a satisfying model

                                                60
        Sometimes you don’t!
Conclusion



                               AR

                       MA

                ARMA
                                      Times series




     vinzjeannin@hotmail.com   ESGF 5IFM Q1 2012
61

More Related Content

Recently uploaded

05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptxFinTech Belgium
 
The Economic History of the U.S. Lecture 22.pdf
The Economic History of the U.S. Lecture 22.pdfThe Economic History of the U.S. Lecture 22.pdf
The Economic History of the U.S. Lecture 22.pdfGale Pooley
 
The Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdfThe Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdfGale Pooley
 
The Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdfThe Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdfGale Pooley
 
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
The Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdfThe Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdfGale Pooley
 
High Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
High Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsHigh Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
High Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual serviceanilsa9823
 
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...ssifa0344
 
Top Rated Pune Call Girls Viman Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Sex...
Top Rated  Pune Call Girls Viman Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Sex...Top Rated  Pune Call Girls Viman Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Sex...
Top Rated Pune Call Girls Viman Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Sex...Call Girls in Nagpur High Profile
 
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptxFinTech Belgium
 
Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )
Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )
Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )Pooja Nehwal
 
The Economic History of the U.S. Lecture 21.pdf
The Economic History of the U.S. Lecture 21.pdfThe Economic History of the U.S. Lecture 21.pdf
The Economic History of the U.S. Lecture 21.pdfGale Pooley
 
The Economic History of the U.S. Lecture 18.pdf
The Economic History of the U.S. Lecture 18.pdfThe Economic History of the U.S. Lecture 18.pdf
The Economic History of the U.S. Lecture 18.pdfGale Pooley
 

Recently uploaded (20)

05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
05_Annelore Lenoir_Docbyte_MeetupDora&Cybersecurity.pptx
 
(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7
(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7
(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7
 
The Economic History of the U.S. Lecture 22.pdf
The Economic History of the U.S. Lecture 22.pdfThe Economic History of the U.S. Lecture 22.pdf
The Economic History of the U.S. Lecture 22.pdf
 
VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...
VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...
VIP Independent Call Girls in Bandra West 🌹 9920725232 ( Call Me ) Mumbai Esc...
 
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
 
The Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdfThe Economic History of the U.S. Lecture 19.pdf
The Economic History of the U.S. Lecture 19.pdf
 
VIP Call Girl in Mira Road 💧 9920725232 ( Call Me ) Get A New Crush Everyday ...
VIP Call Girl in Mira Road 💧 9920725232 ( Call Me ) Get A New Crush Everyday ...VIP Call Girl in Mira Road 💧 9920725232 ( Call Me ) Get A New Crush Everyday ...
VIP Call Girl in Mira Road 💧 9920725232 ( Call Me ) Get A New Crush Everyday ...
 
VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...
VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...
VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...
 
The Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdfThe Economic History of the U.S. Lecture 30.pdf
The Economic History of the U.S. Lecture 30.pdf
 
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
 
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANIKA) Budhwar Peth Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
The Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdfThe Economic History of the U.S. Lecture 20.pdf
The Economic History of the U.S. Lecture 20.pdf
 
High Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
High Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsHigh Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
High Class Call Girls Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best sexual service
 
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
 
Top Rated Pune Call Girls Viman Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Sex...
Top Rated  Pune Call Girls Viman Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Sex...Top Rated  Pune Call Girls Viman Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Sex...
Top Rated Pune Call Girls Viman Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Sex...
 
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
02_Fabio Colombo_Accenture_MeetupDora&Cybersecurity.pptx
 
Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )
Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )
Vip Call US 📞 7738631006 ✅Call Girls In Sakinaka ( Mumbai )
 
The Economic History of the U.S. Lecture 21.pdf
The Economic History of the U.S. Lecture 21.pdfThe Economic History of the U.S. Lecture 21.pdf
The Economic History of the U.S. Lecture 21.pdf
 
The Economic History of the U.S. Lecture 18.pdf
The Economic History of the U.S. Lecture 18.pdfThe Economic History of the U.S. Lecture 18.pdf
The Economic History of the U.S. Lecture 18.pdf
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

ESGF Financial Econometric Models Q1 2012 Summary

  • 1. ESGF 5IFM Q1 2012 Financial Econometric Models Vincent JEANNIN – ESGF 5IFM Q1 2012 vinzjeannin@hotmail.com 1
  • 2. ESGF 5IFM Q1 2012 Summary of the session (Est. 3h) • Reminder of Last Session • Time Series Analysis Principles • Auto Regressive Process vinzjeannin@hotmail.com • Moving Average Process • ARMA • Conclusion 2
  • 3. Be logic! Reminder of Last Session vinzjeannin@hotmail.com ESGF 5IFM Q1 2012 3
  • 4. Differentiation possible ESGF 5IFM Q1 2012 vinzjeannin@hotmail.com ������������������������������ = ln⁡ ������) ( 4
  • 5. Time can be a factor of a regression vinzjeannin@hotmail.com ESGF 5IFM Q1 2012 5
  • 6. Differentiation can add value vinzjeannin@hotmail.com ESGF 5IFM Q1 2012 6
  • 7. Check ACF/PACF for autocorrelation vinzjeannin@hotmail.com ESGF 5IFM Q1 2012 7
  • 8. Time Series Analysis Principles ESGF 4IFM Q1 2012 Reminders of the 3 steps vinzjeannin@hotmail.com Identify Fit Forecast 8
  • 9. ESGF 4IFM Q1 2012 Reminders of the 3 components vinzjeannin@hotmail.com Trend Seasonality Residual 9
  • 10. Lag ������������������ = ������������−1 ESGF 4IFM Q1 2012 Difference vinzjeannin@hotmail.com ∆������������ = ������������ − ������������−1 Seasonality Difference ∆30 ������������ = ������������ − ������������−30 10
  • 11. ESGF 4IFM Q1 2012 Differentiate series to obtain stationary series Time series analysis and forecast simpler with stationary series vinzjeannin@hotmail.com Different models involved with stationary or heteroscedasticity 11
  • 12. Properties of stationary series Same distribution of the following ESGF 4IFM Q1 2012 (������1 , ������2 , ������3 , … , ������������ ) (������2 , ������3 , ������4 , … , ������������+1 ) Distribution not time dependent vinzjeannin@hotmail.com Rare occurrence Stationarity accepted if ������(������������ ) = ������ Constant in the time 12 ������������������(������������ , ������������−������ ) Depends only on n
  • 13. Acceptable Shortcut ESGF 4IFM Q1 2012 A series is stationary if the mean and the variance are stable Which one is more likely to be stationary? vinzjeannin@hotmail.com 13
  • 14. About the residuals… White noise! ESGF 4IFM Q1 2012 Normality test vinzjeannin@hotmail.com Have an idea with Skewness Kurtosis Proper tests: KS, Durbin Watson, Portmanteau,… 14
  • 15. Auto Regressive Process Main principle ESGF 4IFM Q1 2012 There is a correlation between current data and previous data ������������ = ������ + ������1 ������������−1 + ������2 ������������−2 + ⋯ + ������������ ������������−������ + ������������ vinzjeannin@hotmail.com ������������ Parameters of the model ������������ White noise AR(n) If the parameters are identified, the prediction will be easy 15
  • 16. Let’s upload some data DATA<-read.csv(file="C:/Users/vin/Desktop/Series1.csv",header=T) plot(DATA$Val, type="l") ESGF 4IFM Q1 2012 vinzjeannin@hotmail.com 16
  • 17. Is this a white noise? hist(DATA$Val, breaks=20) ESGF 4IFM Q1 2012 vinzjeannin@hotmail.com 17
  • 18. Probably not… Portmanteau test ESGF 4IFM Q1 2012 Test the autocorrelation of a series If there is autocorrelation, data aren’t independently distributed vinzjeannin@hotmail.com Let’s use Ljung–Box statistics H0: Data are independently distributed H1: Data aren’t independently distributed ������ ������2 ������ With α confidence interval rejection ������ = ������(������ + 2) following a Chi Square distribution ������ − ������ ������=1 18 ������������ Autocorrelation at the lag k ������ > Χ 21−������,ℎ
  • 19. > Box.test(DATA$Val) ESGF 4IFM Q1 2012 Box-Pierce test data: DATA$Val X-squared = 188.3263, df = 1, p-value < 2.2e-16 vinzjeannin@hotmail.com H0 is rejected, the data aren’t independently distributed 19
  • 20. Let’s try a regression and analyse residuals TReg<-lm(DATA$Val~DATA$t) plot(DATA$Val, type="l") ESGF 4IFM Q1 2012 abline(TReg, col="blue") vinzjeannin@hotmail.com 20
  • 22. Box-Pierce test ESGF 4IFM Q1 2012 data: eps X-squared = 187.6299, df = 1, p-value < 2.2e-16 Residuals aren’t a white noise vinzjeannin@hotmail.com Regression rejected Not a surprise, did the series look stationary? 22 What next then?
  • 23. lag.plot(DATA$Val, 9, do.lines=FALSE) ESGF 4IFM Q1 2012 vinzjeannin@hotmail.com 23 Differentiation seems to be interesting
  • 24. Does the differentiation create a stationary series? plot(diff(DATA$Val), type="l") ESGF 4IFM Q1 2012 vinzjeannin@hotmail.com 24
  • 25. ACF & PACF par(mfrow=c(2,1)) acf(diff(DATA$Val),20) ESGF 4IFM Q1 2012 pacf(diff(DATA$Val),20) vinzjeannin@hotmail.com ACF decreasing PACF cancelling after order 1 25
  • 26. Decreasing ACF ESGF 4IFM Q1 2012 PACF cancel after order 1 vinzjeannin@hotmail.com Typically an Autoregressive Process AR(1) ? 26
  • 27. Let’s try to fit an AR(1) model Modl<-ar(diff(DATA$Val),order.max=20) plot(Modl$aic) ESGF 4IFM Q1 2012 vinzjeannin@hotmail.com 27 The likelihood for the order 1 is significant
  • 28. > ar(diff(DATA$Val),order.max=20) Call: ar(x = diff(DATA$Val), order.max = 20) Coefficients: 1 2 3 ESGF 4IFM Q1 2012 0.5925 -0.1669 0.1385 Order selected 3 sigma^2 estimated as 0.8514 vinzjeannin@hotmail.com We have our coefficient and standard deviation > ARDif<-diff(DATA$Val) > ARDif[1] [1] 0.3757723 We know the first term of our series ������������ = 0.3757723 + 0.5925. ������������−1 + ������������ 28 Here is our model
  • 29. Need to test the residuals ESGF 4IFM Q1 2012 Box.test(Modl$resid) Box-Pierce test vinzjeannin@hotmail.com data: Modl$resid X-squared = 7e-04, df = 1, p-value = 0.9789 H0 accepted, residuals are independently distributed (white noise) The differentiated series is a AR(1) 29
  • 30. > predict(arima(diff(DATA$Val), order = c(1,0,0)), n.ahead = 7) $pred Time Series: Start = 193 End = 199 Frequency = 1 [1] -0.81359048 -0.43300609 -0.22850452 -0.11861853 -0.05957287 - ESGF 4IFM Q1 2012 0.02784553 -0.01079729 $se Time Series: Start = 193 End = 199 Frequency = 1 vinzjeannin@hotmail.com [1] 0.923352 1.048210 1.081582 1.091027 1.093739 1.094521 1.094747 120 115 110 105 100 95 90 30 85 80 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96 101106111116121126131136141146151156161166171176181186191196
  • 31. ESGF 4IFM Q1 2012 Another typical example? vinzjeannin@hotmail.com You make the comments! 31
  • 33. > Box.test(DATA$Ser2) Box-Pierce test data: DATA$Ser2 X-squared = 149.9227, df = 1, p-value < 2.2e-16 ESGF 4IFM Q1 2012 vinzjeannin@hotmail.com TReg<-lm(DATA$Ser2~DATA$t) plot(DATA$Ser2, type="l") abline(TReg, col="blue") 33
  • 34. > eps<-resid(TReg) > Box.test(eps) Box-Pierce test data: eps X-squared = 148.5669, df = 1, p-value < 2.2e-16 ESGF 4IFM Q1 2012 > layout(matrix(1:4,2,2)) > plot(TReg) vinzjeannin@hotmail.com 34
  • 35. > lag.plot(DATA$Ser2, 9, do.lines=FALSE) ESGF 4IFM Q1 2012 vinzjeannin@hotmail.com 35 Much less obvious but clues of autoregression
  • 36. par(mfrow=c(2,1)) plot(diff(DATA$Ser2), type="l") plot(diff(DATA$Ser2, lag=2), type="l") ESGF 4IFM Q1 2012 vinzjeannin@hotmail.com 36
  • 37. par(mfrow=c(2,1)) plot(diff(DATA$Ser2), type="l") plot(diff(DATA$Ser2, lag=2), type="l") ESGF 4IFM Q1 2012 ACF decreases 2 by 2 vinzjeannin@hotmail.com PACF cancelling after order 2 37
  • 38. First order differentiation, strong AR(2) clues par(mfrow=c(1,1)) ESGF 4IFM Q1 2012 Modl<-ar(diff(DATA$Ser2),order.max=20) plot(Modl$aic) vinzjeannin@hotmail.com 38
  • 39. Parameters estimation > ar(diff(DATA$Ser2),order.max=20) ESGF 4IFM Q1 2012 Call: ar(x = diff(DATA$Ser2), order.max = 20) Coefficients: 1 2 3 vinzjeannin@hotmail.com 0.5919 -0.8326 0.1086 Order selected 3 sigma^2 estimated as 0.877 > ARDif<-diff(DATA$Ser2) > ARDif[1] [1] 0.3757723 39
  • 40. > predict(arima(diff(DATA$Ser2), order = c(2,0,0)), n.ahead = 7) $pred Time Series: Start = 193 End = 199 Frequency = 1 [1] 0.4505213 2.0075741 0.6639701 -1.2321156 -1.1409989 0.3866745 1.0879588 ESGF 4IFM Q1 2012 $se Time Series: Start = 193 End = 199 Frequency = 1 [1] 0.9220713 1.0332515 1.1413067 1.2938326 1.2957576 1.3932158 1.4080266 vinzjeannin@hotmail.com 115 110 105 100 95 90 40 85 80 101 106 111 116 121 126 131 136 141 146 151 156 161 166 171 176 181 186 191 196 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96
  • 41. > Box.test(Modl$resid) Box-Pierce test ESGF 4IFM Q1 2012 data: Modl$resid X-squared = 0.0023, df = 1, p-value = 0.9619 vinzjeannin@hotmail.com Model accepted The more factors the harder the prediction is The more factors there are the more stationary need to be the series for a good prediction 41
  • 42. Moving Average Process Main principle ESGF 4IFM Q1 2012 Stationary series with auto correlation of errors ������������ = ������ + ������������ + ������1 ������������−1 + ������2 ������������−2 + ⋯ + ������������ ������������−������ vinzjeannin@hotmail.com ������������ Parameters of the model ������������ White noise MA(n) More difficult to estimate than a AR(n) 42
  • 43. plot(Data, type="l") hist(Data, breaks=20) ESGF 4IFM Q1 2012 vinzjeannin@hotmail.com 43
  • 44. acf(Data,20) pacf(Data,20) ESGF 4IFM Q1 2012 ACF cancels after order 1 vinzjeannin@hotmail.com PACF decays to 0 44 ACF & PACF suggest MA(1)
  • 45. > arima(Data, order = c(0, 0, 1),include.mean = FALSE) Call: arima(x = Data, order = c(0, 0, 1), include.mean = FALSE) Coefficients: ma1 ESGF 4IFM Q1 2012 -0.4621 s.e. 0.0903 sigma^2 estimated as 0.937: log likelihood = -138.76, aic = 281.52 vinzjeannin@hotmail.com > Box.test(Rslt$residuals) Box-Pierce test data: Rslt$residuals X-squared = 0, df = 1, p-value = 0.9967 45 It works, MA(1), 0 mean, parameter -0.4621
  • 46. Fore<-predict(Rslt, n.ahead=5) U = Fore$pred + 2*Fore$se L = Fore$pred - 2*Fore$se minx=min(Data,L) maxx=max(Data,U) ts.plot(Data,Fore$pred,col=1:2, ylim=c(minx,maxx)) lines(U, col="blue", lty="dashed") ESGF 4IFM Q1 2012 lines(L, col="blue", lty="dashed") vinzjeannin@hotmail.com 46
  • 47. ESGF 4IFM Q1 2012 Another typical example? vinzjeannin@hotmail.com You make the comments! 47
  • 48. plot(Data, type="l") hist(Data, breaks=20) ESGF 4IFM Q1 2012 vinzjeannin@hotmail.com 48
  • 49. vinzjeannin@hotmail.com ESGF 4IFM Q1 2012 49
  • 50. > arima(Data, order = c(0, 0, 2),include.mean = FALSE) Call: ESGF 4IFM Q1 2012 arima(x = Data, order = c(0, 0, 2), include.mean = FALSE) Coefficients: ma1 ma2 -0.5365 0.6489 s.e. 0.0701 0.1044 vinzjeannin@hotmail.com sigma^2 estimated as 1.005: log likelihood = -142.74, aic = 291.48 > Box.test(Rslt$residuals) Box-Pierce test data: Rslt$residuals X-squared = 0.0283, df = 1, p-value = 0.8664 50 MA(2)
  • 51. Fore<-predict(Rslt, n.ahead=5) U = Fore$pred + 2*Fore$se L = Fore$pred - 2*Fore$se minx=min(Data,L) maxx=max(Data,U) ts.plot(Data,Fore$pred,col=1:2, ylim=c(minx,maxx)) ESGF 4IFM Q1 2012 lines(U, col="blue", lty="dashed") lines(L, col="blue", lty="dashed") vinzjeannin@hotmail.com 51
  • 52. ARMA Main principle ESGF 4IFM Q1 2012 The series is a function of past values plus current and past values of the noise vinzjeannin@hotmail.com ARMA(p,q) Combines AR(p) & MA(q) 52
  • 53. plot(Data, type="l") hist(Data, breaks=20) ESGF 4IFM Q1 2012 vinzjeannin@hotmail.com 53
  • 54. ESGF 4IFM Q1 2012 vinzjeannin@hotmail.com 54 Both ACF and PACF decreases exponentially after order 1
  • 55. > Rslt<-arima(Data, order = c(1, 0, 1),include.mean = FALSE) > Rslt Call: arima(x = Data, order = c(1, 0, 1), include.mean = FALSE) ESGF 4IFM Q1 2012 Coefficients: ar1 ma1 0.7214 0.7563 s.e. 0.0716 0.0721 sigma^2 estimated as 0.961: log likelihood = -141.13, aic = 288.27 vinzjeannin@hotmail.com > Box.test(Rslt$residuals) Box-Pierce test data: Rslt$residuals X-squared = 0.0098, df = 1, p-value = 0.9213 ARMA(1,1) fits 55
  • 56. > par(mfrow=c(1,1)) > Fore<-predict(Rslt, n.ahead=5) > U = Fore$pred + 2*Fore$se > L = Fore$pred - 2*Fore$se > minx=min(Data,L) > maxx=max(Data,U) ESGF 4IFM Q1 2012 vinzjeannin@hotmail.com 56
  • 57. Identification can get tricky at this stage ESGF 4IFM Q1 2012 vinzjeannin@hotmail.com 57
  • 58. What do you think? vinzjeannin@hotmail.com ESGF 4IFM Q1 2012 58
  • 59. > Rslt<-arima(Data, order = c(4, 0, 3),include.mean = FALSE) > Rslt Call: arima(x = Data, order = c(4, 0, 3), include.mean = FALSE) Coefficients: ESGF 4IFM Q1 2012 ar1 ar2 ar3 ar4 ma1 ma2 ma3 0.2722 -0.5276 0.0202 -0.2663 0.8765 -0.4672 -0.5248 s.e. 0.2018 0.2308 0.1968 0.1546 0.1992 0.1690 0.1882 sigma^2 estimated as 1.140: log likelihood = -151.19, aic = 318.38 > Box.test(Rslt$residuals) vinzjeannin@hotmail.com Box-Pierce test data: Rslt$residuals X-squared = 0.2953, df = 1, p-value = 0.5869 Was supposed to fit pretty wel…. Data<-arima.sim(model=list(ar=c(0.5,-0.5,0.3,- 59 0.3),ma=c(0.75,-0.5,-0.5)),n=100)
  • 60. Identification can be difficult ESGF 4IFM Q1 2012 Easiest model is AR Imagine when the series is not stationary… vinzjeannin@hotmail.com Step by step approach, exploration, tries,… Sometimes you find a satisfying model 60 Sometimes you don’t!
  • 61. Conclusion AR MA ARMA Times series vinzjeannin@hotmail.com ESGF 5IFM Q1 2012 61