Vin
Vin

Reputation: 11

Problem in time series data (ACF and PACF plots)

I was forecasting the China steel production using ARIMA model. I took a difference of this month and previous months production and took plotted the PACF and ACF plots. I am getting a plot like the image below.

PACF plot has only one vertical line. ACF plot is empty with just a horizontal line. Could any one explain what is wrong. The same is happening if I am taking the difference of 12 months.

enter image description here

Piece of code -

df2['diff'] = df2['China']-df2['China'].shift(1)

tsaplots.plot_acf(df2['diff'],lags =25)

tsaplots.plot_pacf(df2['diff'],lags =25)

Column China contains the monthly Chinese production.

    Date,World,China
    01-Jan-09,96700,40940
    01-Feb-09,96744,41113
    01-Mar-09,101978,44881
    01-Apr-09,99034,43618
    01-May-09,106906,46528
    01-Jun-09,112284,49309
    01-Jul-09,116715,50644
    01-Aug-09,118947,52231
    01-Sep-09,124753,50961
    01-Oct-09,129920,52302
    01-Nov-09,122745,47858
    01-Dec-09,119824,48492
    01-Jan-10,126513,51844
    01-Feb-10,120558,49518
    01-Mar-10,136577,54521
    01-Apr-10,136349,55141
    01-May-10,141239,55877
    01-Jun-10,133378,53569
    01-Jul-10,128202,51348
    01-Aug-10,125726,51639
    01-Sep-10,127033,48678
    01-Oct-10,132224,49856
    01-Nov-10,128816,49993
    01-Dec-10,127816,51826
    01-Jan-11,142534,59871
    01-Feb-11,132806,54307
    01-Mar-11,145959,59416
    01-Apr-11,142209,59032
    01-May-11,145934,60245
    01-Jun-11,142002,59932
    01-Jul-11,140903,59300
    01-Aug-11,135748,58752
    01-Sep-11,136325,56700
    01-Oct-11,137407,54673
    01-Nov-11,128281,49883
    01-Dec-11,128279,52164
    01-Jan-12,137926,56733
    01-Feb-12,135207,55883
    01-Mar-12,148364,61581
    01-Apr-12,144552,60575
    01-May-12,146804,61234
    01-Jun-12,142149,60213
    01-Jul-12,142881,61693
    01-Aug-12,135735,58703
    01-Sep-12,137950,57946
    01-Oct-12,139238,59096
    01-Nov-12,135585,57471
    01-Dec-12,133269,57656
    01-Jan-13,146956,66786
    01-Feb-13,137664,61830
    01-Mar-13,152213,68708
    01-Apr-13,148628,67419
    01-May-13,152913,68675
    01-Jun-13,147214,66302
    01-Jul-13,148120,67297
    01-Aug-13,145084,68201
    01-Sep-13,148877,67540
    01-Oct-13,151375,67734
    01-Nov-13,144779,63409
    01-Dec-13,146725,67083
    01-Jan-14,153039.21,69620
    01-Feb-14,141183.29,62890
    01-Mar-14,157771.98,70329
    01-Apr-14,152751.7,69372
    01-May-14,157991.21,71161.1
    01-Jun-14,153509.49,69512
    01-Jul-14,152523.55,68999
    01-Aug-14,148790.3,69345
    01-Sep-14,150181.93,68164
    01-Oct-14,152695.44,68240
    01-Nov-14,146451.79,64350
    01-Dec-14,146860.4,67900
    01-Jan-15,151339.843,67455
    01-Feb-15,138968.754,60925
    01-Mar-15,153954.638,68659
    01-Apr-15,150230.113,69074
    01-May-15,155018.699,69253
    01-Jun-15,150737.143,68309
    01-Jul-15,146032.497,65117
    01-Aug-15,144087.588,66573
    01-Sep-15,144175.125,65611
    01-Oct-15,146833.051,65875
    01-Nov-15,139727.062,63133
    01-Dec-15,138924.395,65136
    01-Jan-16,142054.857,63213.7
    01-Feb-16,134964.191,58468.8
    01-Mar-16,152644.955,70701.2
    01-Apr-16,148852.591,69392.9
    01-May-16,154945.992,70971.1
    01-Jun-16,150385.717,69298.9
    01-Jul-16,147922.946,67127.1
    01-Aug-16,147093.808,68618
    01-Sep-16,147363.792,68200.4
    01-Oct-16,151525.906,68228.3
    01-Nov-16,145057.528,64722.5
    01-Dec-16,147179.568,67219
    01-Jan-17,152779.494,67899.1
    01-Feb-17,140903.201,61328.3
    01-Mar-17,157767.599,70800.4
    01-Apr-17,156853.672,73194.7
    01-May-17,159965.395,74491.2
    01-Jun-17,157166.601,74624.2
    01-Jul-17,160051.485,75756.1
    01-Aug-17,160297.278,78207.1
    01-Sep-17,159365.211,75198.8
    01-Oct-17,162926.991,75670.2
    01-Nov-17,154540.861,70024.3
    01-Dec-17,154349.689,70349.9
    01-Jan-18,145523.413,71986.2
    01-Feb-18,132082.913,65019.7
    01-Mar-18,148228.865,73046.8
    01-Apr-18,147840.143,75453.4
    01-May-18,154954.944,81017.5
    01-Jun-18,151958.766,79584.7
    01-Jul-18,154061.042,81179.9
    01-Aug-18,150855.262,79833.5
    01-Sep-18,151898.295,80959.1
    01-Oct-18,155906.311,82013.8
    01-Nov-18,149355.885,77213.1
    01-Dec-18,146207.071,75489.4
    01-Jan-19,151681.268,78862.7
    01-Feb-19,139625.869,71230.9
    01-Mar-19,156454.643,80340.7
    01-Apr-19,157599.767,84879.2
    01-May-19,163014.413,88565.2
    01-Jun-19,159541.479,87670.7
    01-Jul-19,156399.267,85223.2
    01-Aug-19,155205.83,87250.8
    01-Sep-19,151272.382,82772.8
    01-Oct-19,151087.457,81520.6
    01-Nov-19,147574.836,80286.8
    01-Dec-19,151640.646,84265
    01-Jan-20,151349.148,79929.3
    01-Feb-20,144394.956,74772.6
    01-Mar-20,147377.504,78974.7
    01-Apr-20,136628.638,85033.3
    01-May-20,148727.027,92266.8
    01-Jun-20,148295.172,91578.8

Upvotes: 1

Views: 2489

Answers (1)

Ran Cohen
Ran Cohen

Reputation: 751

when you use shift it makes the first line null. so you can use dropna() or start from line two df.iloc[1:]. enter image description here

df2['diff'] = df2['China']-df2['China'].shift(1)
tsaplots.plot_acf(df2['diff'].dropna(),lags =25)
tsaplots.plot_pacf(df2['diff'].dropna(),lags =25)

enter image description here

enter image description here

Upvotes: 4

Related Questions