Skip to content

Instantly share code, notes, and snippets.

@dpbac
Created June 23, 2021 11:20
Show Gist options
  • Save dpbac/9d4adfed0a7c05a2f10a76ddb676a13e to your computer and use it in GitHub Desktop.
Save dpbac/9d4adfed0a7c05a2f10a76ddb676a13e to your computer and use it in GitHub Desktop.
# Create empty list to store search results
order_aic_bic=[]
# Loop over p values from 0-6
for p in range(7):
# Loop over q values from 0-6
for q in range(7):
# create and fit ARMA(p,q) model
model = SARIMAX(df_store_2_item_28_time, order=(p,1,q), freq="D") #because adf test showed that d=1
results = model.fit()
# Append order and results tuple
order_aic_bic.append((p,q,results.aic, results.bic))
# Construct DataFrame from order_aic_bic
order_df = pd.DataFrame(order_aic_bic,
columns=['p','q','AIC','BIC'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment