python - ARMA modelling ARIMAResults.predict -


when tried implementing code suggested in correct wat use armaresults.predict() function. follows

import numpy np import scipy stats import pandas pd pandas import series,dataframe import statsmodels.api sm   dates=pd.date_range('2011-1-30','2011-04-30') dataseries=series([22,624,634,774,726,752,38,534,722,678,750,690,686,26,708,606,632,632,632,584,28,576,474 ,536,512,464,436,24,448,408,528,602,638,640,26,658,548,620,534,422,482,26,616,612,622,598,614,614,24,644,506,522,622,526,26,22,738 ,582,592,408,466,568,44,680,652,598,642,714,562,38,778,796,742,460,610,42,38,732,650,670,618,574,42,22,610,456,22,630,408,390,24 ],index=dates) df=pd.dataframe({'consumption':dataseries}) df  input_data_point = len(df) p = 1 q = 0  result = sm.tsa.arma(df[:input_data_point], (p, q))  start_pos = max(result.k_ar, result.k_ma)  fit = [] t in range(start_pos, len(df)):     value = 0     in range(1, result.k_ar + 1):         value += result.arparams[i - 1] * df[t - i]     in range(1, result.k_ma + 1):         value += result.maparams[i - 1] * df[t - i]     fit.append(value)   fit = result.predict(0, len(data)) # plot  plt.figure(facecolor='white') plt.plot(df, 'b-', label='data') plt.plot(range(input_data_point), result.fittedvalues, 'r+', label='fit') plt.plot(range(start_pos, len(df)), fit, 'r-', label='predict') plt.legend(loc=4) plt.show() 

i getting attribute error follows

  14     in range(1, result.k_ma + 1):      15         value += result.maparams[i - 1] * df[t - i]  attributeerror: 'arma' object has no attribute 'arparams' 

how can error overcome.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -