1. 时间序列模型
1.1 数学模型
随机变量序列{Yt:t=0,1,2,......}" role="presentation"
style="box-sizing: border-box; outline: 0px; display: inline;
line-height: normal; text-align: left; word-spacing: normal;
word-wrap: normal; white-space: nowrap; float: none; direction:
ltr; max-width: none; max-height: none; min-width: 0px; min-height:
0px; border: 0px; padding: 0px; margin: 0px; word-break: break-all;
position: relative;">{Yt:t=0,1,2,......}{Yt:t=0,1,2,......}称为一个时间序列模型。 t = 0, 1,2,3…. 均值函数:
=E(Yt)"
role="presentation" style="box-sizing: border-box; outline: 0px;
display: inline; line-height: normal; word-spacing: normal;
word-wrap: normal; white-space: nowrap; float: none; direction:
ltr; max-width: none; max-height: none; min-width: 0px; min-height:
0px; border: 0px; padding: 0px; margin: 0px; word-break: break-all;
position: relative;">μ=E(Yt)μ=E(Yt)
方差函数:
Var(Yt)=E[(Yt)2]" role="presentation" style="box-sizing:
border-box; outline: 0px; display: inline; line-height: normal;
word-spacing: normal; word-wrap: normal; white-space: nowrap;
float: none; direction: ltr; max-width: none; max-height: none;
min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin:
0px; word-break: break-all; position:
relative;">Var(Yt)=E[(Yt−μ)2]Var(Yt)=E[(Yt−μ)2]
自相关函数:
t,s=Cov(Yt,Ys)=E[(Yt)(Ys)]" role="presentation"
style="box-sizing: border-box; outline: 0px; display: inline;
line-height: normal; word-spacing: normal; word-wrap: normal;
white-space: nowrap; float: none; direction: ltr; max-width: none;
max-height: none; min-width: 0px; min-height: 0px; border: 0px;
padding: 0px; margin: 0px; word-break: break-all; position:
relative;">γt,s=Cov(Yt,Ys)=E[(Yt−μ)(Ys−μ)]γt,s=Cov(Yt,Ys)=E[(Yt−μ)(Ys−μ)]
k阶自相关函数:
k=Cov(Yt,Ytk)=E[(Yt)(Ytk)]" role="presentation"
style="box-sizing: border-box; outline: 0px; display: inline;
line-height: normal; word-spacing: normal; word-wrap: normal;
white-space: nowrap; float: none; direction: ltr; max-width: none;
max-height: none; min-width: 0px; min-height: 0px; border: 0px;
padding: 0px; margin: 0px; word-break: break-all; position:
relative;">γk=Cov(Yt,Yt−k)=E[(Yt−μ)(Yt−k−μ)]γk=Cov(Yt,Yt−k)=E[(Yt−μ)(Yt−k−μ)]
自相关系数:
k=kVar(Yt)"
role="presentation" style="box-sizing: border-box; outline: 0px;
display: inline; line-height: normal; word-spacing: normal;
word-wrap: normal; white-space: nowrap; float: none; direction:
ltr; max-width: none; max-height: none; min-width: 0px; min-height:
0px; border: 0px; padding: 0px; margin: 0px; word-break: break-all;
position: relative;">ρk=γkVar(Yt)ρk=γkVar(Yt)
自相关函数:Autocorrelation Function(ACF)
ACF是一个很重要的概念,在后面你会经常遇到ACF检验,就是通过这个概念去验证一个时间序列是否是平稳的。
1.2
均值,方差,协方差,相关系数
关于样本均值和方差的概念我就不解释了。 下面谈谈协方差和相关系数: 协方差 称E{(X - E(X))
(Y-E(Y))}为随机变量X与Y的协方差,记为Cov(X,Y),即
Cov(X,Y)=E{(XE(X))(YE(Y))}=E(XY)E(X)E(Y)" role="presentation"
style="box-sizing: border-box; outline: 0px; display: inline;
line-height: normal; word-spacing: normal; word-wrap: normal;
white-space: nowrap; float: none; direction: ltr; max-width: none;
max-height: none; min-width: 0px; min-height: 0px; border: 0px;
padding: 0px; margin: 0px; word-break: break-all; position:
relative;">Cov(X,Y)=E{(X−E(X))(Y−E(Y))}=E(XY)−E(X)E(Y)Cov(X,Y)=E{(X−E(X))(Y−E(Y))}=E(XY)−E(X)E(Y)
相关系数 随机变量X,Y的相关系数:
xy=Cov(X,Y)Var(X)Var(Y)" role="presentation"
style="box-sizing: border-box; outline: 0px; display: inline;
line-height: normal; word-spacing: normal; word-wrap: normal;
white-space: nowrap; float: none; direction: ltr; max-width: none;
max-height: none; min-width: 0px; min-height: 0px; border: 0px;
padding: 0px; margin: 0px; word-break: break-all; position:
relative;">ρxy=Cov(X,Y)Var(X)Var(Y)−−−−−−−−−−−−√ρxy=Cov(X,Y)Var(X)Var(Y)
|xy|<=1"
role="presentation" style="box-sizing: border-box; outline: 0px;
display: inline; line-height: normal; text-align: left;
word-spacing: normal; word-wrap: normal; white-space: nowrap;
float: none; direction: ltr; max-width: none; max-height: none;
min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin:
0px; word-break: break-all; position:
relative;">|ρxy|<
style="box-sizing: border-box; outline: 0px; transition: none;
position: static; border: 0px; padding: 0px; margin: 0px;
vertical-align: 0px; line-height: normal; word-break: break-all;
font-family: MathJax_Main;">=1|ρxy|<=1
相关系数是用来度量两个随机变量的相关程度指标 当xy=0" role="presentation" style="box-sizing: border-box;
outline: 0px; display: inline; line-height: normal; text-align:
left; word-spacing: normal; word-wrap: normal; white-space: nowrap;
float: none; direction: ltr; max-width: none; max-height: none;
min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin:
0px; word-break: break-all; position:
relative;">ρxy=0ρxy=0时称X,Y不相关; 当|xy|=1" role="presentation" style="box-sizing: border-box;
outline: 0px; display: inline; line-height: normal; text-align:
left; word-spacing: normal; word-wrap: normal; white-space: nowrap;
float: none; direction: ltr; max-width: none; max-height: none;
min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin:
0px; word-break: break-all; position:
relative;">|ρxy|=1|ρxy|=1称X,Y完全相关,此时,X,Y之间具有线性函数关系; 当 |xy|=1" role="presentation"
style="box-sizing: border-box; outline: 0px; display: inline;
line-height: normal; text-align: left; word-spacing: normal;
word-wrap: normal; white-space: nowrap; float: none; direction:
ltr; max-width: none; max-height: none; min-width: 0px; min-height:
0px; border: 0px; padding: 0px; margin: 0px; word-break: break-all;
position: relative;">|ρxy|=1|ρxy|=1时,X的变动引起Y的部分变动,|xy|"
role="presentation" style="box-sizing: border-box; outline: 0px;
display: inline; line-height: normal; text-align: left;
word-spacing: normal; word-wrap: normal; white-space: nowrap;
float: none; direction: ltr; max-width: none; max-height: none;
min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin:
0px; word-break: break-all; position:
relative;">|ρxy||ρxy|越大,X的变动引起Y的变动就越大
1.3
自相关函数,自相关系数
此时我们再来分析下自相关函数,自相关系数 自相关函数 t,s" role="presentation" style="box-sizing: border-box;
outline: 0px; display: inline; line-height: normal; text-align:
left; word-spacing: normal; word-wrap: normal; white-space: nowrap;
float: none; direction: ltr; max-width: none; max-height: none;
min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin:
0px; word-break: break-all; position:
relative;">ρt,sρt,s度量随机序列Y在t时刻和s时刻的相关程度,由于t和s分别为两个变量,所以t,s"
role="presentation" style="box-sizing: border-box; outline: 0px;
display: inline; line-height: normal; text-align: left;
word-spacing: normal; word-wrap: normal; white-space: nowrap;
float: none; direction: ltr; max-width: none; max-height: none;
min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin:
0px; word-break: break-all; position:
relative;">ρt,sρt,s是一个关于t,s的函数。
一般情况下不会研究两个随意的时刻t,s,通常都是研究固定间隔的时间,比如s = t - l
自相关系数 l" role="presentation" style="box-sizing: border-box;
outline: 0px; display: inline; line-height: normal; text-align:
left; word-spacing: normal; word-wrap: normal; white-space: nowrap;
float: none; direction: ltr; max-width: none; max-height: none;
min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin:
0px; word-break: break-all; position:
relative;">ρˆlρ^l是用于度量随机序列Y在时间间隔为l的相关性。
是由t,tl" role="presentation" style="box-sizing: border-box;
outline: 0px; display: inline; line-height: normal; text-align:
left; word-spacing: normal; word-wrap: normal; white-space: nowrap;
float: none; direction: ltr; max-width: none; max-height: none;
min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin:
0px; word-break: break-all; position:
relative;">ρt,t−lρt,t−l,
t = l, l+1, ….一组序列计算而来
2. 平稳性
包括严平稳和弱平稳两种,
一般的时间序列都是弱平稳的,所以我们说一个时间序列是平稳的都是指弱平稳。
2.1 定义
严平稳 定义:给定随机过程X(t),t属于T,其有限维分布组为F(x1,x2,…xn;t1,t2,…,tn),t1,t2,…,tn属于T,对任意n任意的t1,t2,…,tn属于T,任意满足t1+h,t2+h,…,tn+h属于T的h,总有 F(x1,x2,…xn;t1,t2,…,tn)=F(x1,x2,…xn;t1+h,t2+h,…,tn+h)称此过程严平稳.
严平稳是一种条件比较苛刻的平稳性定义,它认为只有当序列所有的统计性质都不会随着时间的推移而发生变化时,该序列才能被认为平稳.
一般的时间序列都不是严平稳的
弱平稳 弱平稳才是我们考察时间序列的平稳性。 其定义如下: 假定某个时间序列由某一随机过程(stochastic process)生成,即假定时间序列{Xt}(t=1, 2,
…)的每一个数值都是从一个概率分布中随机得到的。如果经由该随机过程所生成的时间序列满足下列条件:
均值E(Xt)=m是与时间t 无关的常数;
方差Var(Xt)=s^2是与时间t 无关的常数;
协方差Cov(Xt,Xt+k)=gk 是只与时期间隔k有关,与时间t 无关的常数;
2.2 意义
所谓平稳性通俗讲就是,时间序列的统计规律不会随着时间的推移而发生变化。 一个时间序列只有是平稳的,才能够进行预测分析,否则一切分析的结果都没有任何意义。
3.
弱平稳时间序列自相关性
这部分需要假设检验的知识,可以参考我之前的一篇文章: 假设检验 其基本原理是:在一个已知的假设下,如果一个特定事件发生的概率格外小,那么我们认为, 这个假设可能不对。
3.1 ACF检验
假设
H0:1=0vsHa:10" role="presentation" style="box-sizing:
border-box; outline: 0px; display: inline; line-height: normal;
word-spacing: normal; word-wrap: normal; white-space: nowrap;
float: none; direction: ltr; max-width: none; max-height: none;
min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin:
0px; word-break: break-all; position:
relative;">H0:ρ1=0vsHa:ρ1≠0H0:ρ1=0vsHa:ρ1≠0
检验统计量
判别条件: 如果 |t| > Zα/2 或者 p-value < α,则拒绝H0。
3.2 混成检验
Ljung-Box