Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Python statsmodels adfuller中为maxlag参数选择一个值?_Python_Testing_Time Series_Statsmodels_Arima - Fatal编程技术网

如何在Python statsmodels adfuller中为maxlag参数选择一个值?

如何在Python statsmodels adfuller中为maxlag参数选择一个值?,python,testing,time-series,statsmodels,arima,Python,Testing,Time Series,Statsmodels,Arima,我每月都有网站点击量的数据,我想建立一个SARIMA模型来预测下个月的预期点击量。因为SARIMA模型需要处理静态数据,所以我对数据进行了转换,并在Python中执行了增强的Dickey Fuller测试,以检测何时可以停止转换并开始向模型提供数据(p值的情况就是这样,您是否尝试使用默认值None?#来自Greene引用Schwert 1989 maxlag=int(np.ceil(12.*np.power(nobs/100,1/4))@Bargitta:是的,我尝试了默认值。在问题中看到的代码

我每月都有网站点击量的数据,我想建立一个SARIMA模型来预测下个月的预期点击量。因为SARIMA模型需要处理静态数据,所以我对数据进行了转换,并在Python中执行了增强的Dickey Fuller测试,以检测何时可以停止转换并开始向模型提供数据(p值的情况就是这样,您是否尝试使用默认值None?#来自Greene引用Schwert 1989 maxlag=int(np.ceil(12.*np.power(nobs/100,1/4))@Bargitta:是的,我尝试了默认值。在问题中看到的代码中,我每次调用函数adfuller(data)时都尝试了默认值不设置maxlag参数。使用默认值与使用maxlag=12时p的差异就是我的问题所在。
myTimeSeries.plot()
adfuller(myTimeSeries) # p=0.113872
adfuller(myTimeSeries, maxlag=12) # p=0.996884

myLog = numpy.log(myTimeSeries) #log-transfor
myLog.plot()
adfuller(myLog) # p=0.165395
adfuller(myLog, maxlag=12) # p=0.997394

myDiff = myLog.diff(1) #difference with lag 1
myDiff.plot()
myDiff = myDiff.dropna()
adfuller(myDiff) # p=0.003884
adfuller(myDiff, maxlag=12) # p=0.613816

mySeasonalDiff = myDiff.diff(12) #seasonal differencing with lag 12
mySeasonalDiff.plot()
mySeasonalDiff = mySeasonalDiff.dropna()
adfuller(mySeasonalDiff) # p=0.000000
adfuller(mySeasonalDiff, maxlag=12) # p=0.958532