Augmented Dickey Fuller Test (ADF Test) and KPSS Test

本文介绍了Augmented Dickey Fuller (ADF) Test和KPSS Test两种时序数据平稳性检验方法。ADF Test是单位根测试的一种,用于判断时序数据是否平稳;而KPSS Test则是在确定性趋势下检测时序稳定性。文章详细阐述了两者的基本原理、Python实现,并通过实例分析了它们的区别。
摘要由CSDN通过智能技术生成

ADF test

Augmented Dickey Fuller test (ADF Test)是用于判断一个时序数据是否平稳的常见的统计方法之一。对时序数据进行分析的时候,经常需要判断时序数据是否平稳,常见的方法有ADF test、KPSS test 等。

基本介绍

ADF test是一种统计显著性分析方法,针对一个零假设null hypothesis和替代性假设alternate hypothesis进行假设测试,然后测试统计值被计算得出,p value被得出。从测试统计值和p value判断给定时序的平稳性。

Unit Root Test

单位根测试被用来测试时序的稳定性,ADF测试是其中一种具体的测试方法。

单位根的存在使得时序数据不平稳,并且单位根的个数=要使得时序变成平稳所需的差分操作的次数。
Unit root is a characteristic of a time series that makes it non-stationary。Besides, the number of unit roots contained in the series corresponds to the number of differencing operations required to make the series stationary.
从技术上说,如果下式中alpha=1,那么单位根存在。
a unit root is said to exist in a time series of the value of alpha = 1 in the below equation。
在这里插入图片描述

Dickey-Fuller Test

Dickey-Fuller Test是一种单位根测试,零假设为下式中alpha=1。
在这里插入图片描述
综上,Dickey-Fuller Test和单位根测试一样有相似的零假设,也就是说,alpha=1意味着单位根的存在,如果不拒绝零假设,那么时序被认为是非平稳的

Augmented Dickey Fuller (ADF) Test

Augmented Dickey-Fuller test 在Dickey-Fuller Test的基础上作了改进,是an ‘augmented’ version of the Dickey Fuller test。
Augmented Dickey-Fuller test在原有Dickey-Fuller test的基础上增加了更高阶的差分的回归项:
在这里插入图片描述
Augmented Dickey-Fuller test 的零假设仍然是:alpha=1,也就是说存在单位根,时序不平稳。这一点和Dickey-Fuller Test是一样的。

一个需要注意的点是:零假设假设单位根存在,也就是说,alpha=1,为了拒绝这个零假设,p-value必须小于显著性水平(0.05)才能拒绝零假设,从而推断出时序是平稳的。

ADF Test in Python

statsmodels.tsa.stattools.adfuller()返回以下四个值:

  1. The p-value
  2. The value of the test statistic
  3. Number of lags considered for the test
  4. The critical value cutoffs.
    怎么看结果呢?
    p-value

当test statistic小于critical value时,我们可以拒绝原假设,认为时序是平稳的。

example

# Setup and Import data
from statsmodels.tsa.stattools import adfuller, kpss

import pandas as pd
import numpy as np
%matplotlib inline

url = 'https://raw.githubusercontent.com/selva86/datasets/master/a10.csv'
df = pd.read_csv(url, parse_dates=['date'], index_col='date')
series = df.loc[:, 'value'].values
df.plot(figsize=(14,8), legend=None, title='a10 - Drug Sales Series');
# ADF Test
result = adfuller(df.value.values, autolag='AIC')
print(f'ADF Statistic: {
     result
  • 25
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Kiki酱。

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值