简体   繁体   English

使用 python 估计 ARIMA 模型时出错(对于 d>2)

[英]Getting error while estimating ARIMA models using python (for d>2)

I am trying to fit an ARIMA model using Python.我正在尝试使用 Python 安装 ARIMA model。 It has two columns.它有两列。 First- date and second- confirmed orders.第一个日期和第二个确认的订单。 Here are first few rows from the data file (daily data of confirmed orders from March 14, 2020 to April 14, 2020):以下是数据文件中的前几行(2020 年 3 月 14 日至 2020 年 4 月 14 日已确认订单的每日数据):

数据

My codes are working well as long as number of differences (d) is 2 or less.只要差异数 (d) 为 2 或更少,我的代码就运行良好。 When d>2, then I get an error " raise ValueError("d > 2 is not supported").当 d>2 时,我得到一个错误“raise ValueError("d > 2 is not supported")。

Here is the code that I am using:这是我正在使用的代码:

import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from statsmodels.tsa.stattools import adfuller
from statsmodels.tsa.seasonal import seasonal_decompose
from statsmodels.tsa.arima_model import ARIMA
from pandas.plotting import register_matplotlib_converters
from pandas import read_csv
from pandas import DatetimeIndex
from datetime import datetime
register_matplotlib_converters()

df = pd.read_csv('order.csv',parse_dates = ['date'], index_col = ['date'])
df.info()

#Declare that data are collected on daily basis
df.index.freq = 'd'

#ARIMA
model = ARIMA(df,order=[1,4,1], freq='D')
model_fit = model.fit(disp=0)
print(model_fit.summary())

The screenshot of the error is also attached for details.还附上了错误的屏幕截图以获取详细信息。 Any help on solving this will much appreciated.任何有关解决此问题的帮助将不胜感激。 Thanks in advance.提前致谢。

截屏

Maybe d>2 is not allowed means our best bet is to start simple, check if integrating once grants stationarity.也许 d>2 是不允许的,这意味着我们最好的选择是从简单的开始,检查一次积分是否具有平稳性。 If so, we can fit a simple ARIMA model and examine the ACF of the residual values to get a better feel about what orders of differencing to use.如果是这样,我们可以拟合一个简单的 ARIMA model 并检查残差值的 ACF,以更好地了解要使用的差分顺序。 Also a drawback, if we integrate more than two times (d>2), we lose n observations, one for each integration.还有一个缺点,如果我们积分超过两次(d>2),我们会丢失 n 个观察值,每次积分一个。 And one of the most common errors in ARIMA modeling is to "overdifference" the series and end up adding extra AR or MA terms to undo the forecast damage, so the author (I assume) decides to raise this exception. ARIMA 建模中最常见的错误之一是“过度差分”序列并最终添加额外的 AR 或 MA 项来撤销预测的损害,因此作者(我假设)决定提出这个例外。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM