Skip to main content
edited tags
Link
Ferdi
  • 5.3k
  • 10
  • 47
  • 64
deleted 322 characters in body
Source Link
RPT
  • 259
  • 5
  • 19

enter image description here

 ACF graph:

enter image description hereenter image description here

 ACF graph and PACF graph:

enter image description hereenter image description here

enter image description here enter image description here

enter image description here

count  23.000000
mean    0.007055
std     0.600536
min    -1.705167
25%    -0.203414
50%     0.000912
75%     0.139552
max     1.669920

enter image description hereenter image description here

enter image description here

 ACF graph:

enter image description here

 PACF graph:

enter image description here

enter image description here enter image description here

count  23.000000
mean    0.007055
std     0.600536
min    -1.705167
25%    -0.203414
50%     0.000912
75%     0.139552
max     1.669920

enter image description here

enter image description here

 ACF graph and PACF graph:

enter image description here

enter image description here

enter image description here

Source Link
RPT
  • 259
  • 5
  • 19

Applying ARIMA to time series data

I applied applied ARIMA to my time series data (24 hours of a day) which is this:

Sdate               Speed
2012-12-11 00:00:00 0.823237  
2012-12-11 01:00:00 0.633637  
2012-12-11 02:00:00 1.10858  
2012-12-11 03:00:00 1.30435  
2012-12-11 04:00:00 1.35649  
2012-12-11 05:00:00 0.998616  
2012-12-11 06:00:00 0.742183  
2012-12-11 07:00:00 -0.966582  
2012-12-11 08:00:00 -2.12219  
2012-12-11 09:00:00 -1.31213  
2012-12-11 10:00:00 -0.401101  
2012-12-11 11:00:00 -0.220982  
2012-12-11 12:00:00 -0.408211  
2012-12-11 13:00:00 -0.476941  
2012-12-11 14:00:00 -0.288764  
2012-12-11 15:00:00 -0.487369  
2012-12-11 16:00:00 -1.14101  
2012-12-11 17:00:00 -1.91742  
2012-12-11 18:00:00 -0.518653  
2012-12-11 19:00:00 0.450674  
2012-12-11 20:00:00 0.573439  
2012-12-11 21:00:00 0.654967  
2012-12-11 22:00:00 0.756403  
2012-12-11 23:00:00 0.858787 

So,

Plotting the data:

enter image description here

 ACF graph:

enter image description here

 PACF graph:

enter image description here

I took an AR(1) and MA(1) with differencing of 1.

Applying the ARIMA model, I get:

 ARIMA(1,1,1):

enter image description here enter image description here

count  23.000000
mean    0.007055
std     0.600536
min    -1.705167
25%    -0.203414
50%     0.000912
75%     0.139552
max     1.669920

The results for ARIMA model I get:

                             ARIMA Model Results                              
==============================================================================
Dep. Variable:                    D.y   No. Observations:                   23
Model:                 ARIMA(1, 1, 1)   Log Likelihood                 -20.539
Method:                       css-mle   S.D. of innovations              0.586
Date:                Mon, 06 Nov 2017   AIC                             49.079
Time:                        11:43:53   BIC                             53.621
Sample:                             1   HQIC                            50.221
                                                                              
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
const         -0.0082      0.182     -0.045      0.964      -0.365       0.348
ar.L1.D.y     -0.0659      0.311     -0.212      0.835      -0.676       0.544
ma.L1.D.y      0.6066      0.236      2.575      0.018       0.145       1.068
                                    Roots                                    
=============================================================================
                 Real           Imaginary           Modulus         Frequency
-----------------------------------------------------------------------------
AR.1          -15.1848           +0.0000j           15.1848            0.5000
MA.1           -1.6484           +0.0000j            1.6484            0.5000
-----------------------------------------------------------------------------

I then predict and I covert it back to the original scale. I do, hat(Y)t+1 = Yt + hat(z)t+1, where hat(z)t+1 is the difference value of t+1.

The following code does that:

forecast = model_fit.predict()
prediction = pd.Series(forecast, copy=True)
prediction.ix[0] = prediction.ix[0] + (prediction.ix[0] - mon_two_speed.ix[0].values)
print(prediction.ix[0])
for i in range(len(prediction) - 1):
    prediction.ix[i+1] = prediction.ix[i+1] + (prediction.ix[i + 1] - prediction.ix[i])

Plotting the prediction gives me bizarre values:

 The graph: 

enter image description here

I am fairly new to this, so I don't have much idea as of what to expect and infer from the results I get. I am not sure what I am doing wrong and any suggestions will be appreciated. Thanks.