0
$\begingroup$

here is my auto correlation plot. Generated by the following python code.

from pandas.plotting import autocorrelation_plot 
from statsmodels.tsa.arima_model import ARIMA

def display_corelation(series):
    autocorrelation_plot(series)
    plt.show()

I know i can pass 1 or 2 in p by looking into the plot for the ARIMA Model. My question is how i can generate the p value,

how to calculate the lag order from some series by pandas or any library instead of plotting currently at the moment ?

model = ARIMA(history, order=(1,1,0))

enter image description here

$\endgroup$

1 Answer 1

1
$\begingroup$

Got it by following code:

    import pandas as pd    
    k=0
    highestCorr = 0
    for i in range(1,10):
        cor = pd.Series.autocorr(series, lag=i)
        if(cor > highestCorr):
            highestCorr = cor
            k=i
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.