Skip to content

SDSC6012

References

CityU library 可以下载PDF版本 点击直达

  • Course SDSC6012 slides
  • ChatGPT 4o
  • My Thinking …

Lecture1

时间序列分析的目标:描述、预测、控制和假设检验

时序中的随机变量

  • 随机变量: 随机变量 X 是一个函数,它将一个样本空间中的事件映射到实数(或其他数值)。其值是随机的,即它的取值受某个概率分布的控制
  • 在时间序列分析中,随机变量 Xt 是指时间序列的每一个观察值,它在每个时间点上是随机的,并且其值遵循某个概率分布

Stochastic process 随机过程

  • Xt 按照时间索引的过程就是随机过程
  • 是一种建模方法,研究不同时间点的关系
  • The observed values of a stochastic process are referred to as a realization of the stochastic process. 也就是说,我们在某个时间序列中看到的数据只是随机过程的一个实现realization
  • An observed time series is considered to be one realization of a stochastic process. 观测到的时间序列是随机过程的一种实现

什么叫“随机过程”?这个随机和random有关系吗?

GPT:

“随机过程”中的“随机”确实与“random”(随机)有关。它指的是一个随时间演变的系统或现象,其中的结果不是确定的,而是随机的。每个时刻的数据点(或状态)是由一组随机变量表示的。

具体来说,“随机过程”是指一个按时间顺序排列的随机变量集合,表示某个系统或现象在时间上的变化。由于这些随机变量的结果是不可预知的,所以我们说它是“随机”的。这与“random”一词的含义一致,指的是结果或状态是通过某种概率分布产生的,而不是确定的。

例如,股票价格、天气变化、人口增长等都可以用随机过程来描述。它们在不同时间点的值是由多个因素影响的,并且这些值无法完全预测,因此被视为“随机”的。

总结来说,随机过程是描述系统或现象如何在时间上以随机方式变化的数学模型,其中的“随机”与“random”密切相关,表示不确定性和概率性。

随机过程 vs. 随机变量:

在时间序列分析中,我们通常处理的是随机过程{Xt} (注意有大括号,是多个变量)它是随时间变化的随机变量序列Xt (注意这是一个变量,没有大括号)

换言之: 多个会变化的随机变量Xt,并且变化是以时间为维度的,就变成了随机过程{Xt}

假设有一个随机过程{Xt} ,每个时间点t上我们都观察到一个随机变量Xt

相关符号

  • {Xt} 随机过程
  • Xt 在随机过程t中的一个随机变量
  • xt 是一个随机过程t中的一个观测值

White noise 白噪声

白噪声是一种随机信号,其中各个时间点上的值都是彼此不相关的,也就是这些随机变量之间没有相关性。

它的自相关函数是零,表示在不同时间点的信号是完全独立的。

wtwn(0,σw2)

Gaussian white noise 高斯白噪声

一种特殊的白噪声,保证噪声的分布满足正态分布

wtN(0,σw2)

相关符号

  • wt 白噪声
  • σw2 方差
  • wn 白噪声
  • N(0,σw2) 正态分布

Time series modeling 时间序列模型

时间序列模型的基本结构可以表示为:

xt=mt+st+et

其中:

  • xt 表示时间序列的观测值

注意是观测值, 这就是为什么是小x而不是大X

  • mt趋势成分(trend component),表示时间序列的长期变化趋势;
  • st季节性成分(seasonal component),表示时间序列的周期性波动(如季节、月度变化等);
  • et残差(residual),表示无法通过趋势或季节性成分解释的随机噪声或误差, 例如wt

这个模型将时间序列分解为三个部分,以便更好地理解和预测时间序列的行为。

噪声属于什么部分?

GPT:

在时间序列模型中,噪声属于公式中的残差部分(residual),即 et 。残差代表的是时间序列中无法通过趋势(mt)和季节性成分(st)解释的部分。

具体来说:

  • 噪声(noise) 是指时间序列中由于随机因素产生的波动或误差,通常被视为不可预测的随机变化。
  • 残差(residual) 是实际观测值与模型预测值之间的差异,包括噪声成分。

因此,在时间序列模型 xt=mt+st+et 中,噪声就是 et,它通常表示为服从某种概率分布的随机变量(如白噪声、高斯白噪声等),是建模过程中用来描述不规则波动的重要部分。

均值性质

  • 均值具有线性性(线性性)

E(aX+bY)=aE(X)+bE(Y)

  • 常数的期望即本身(常数性)

E(c)=c

  • 独立随机变量和均值 == 独立随机变量均值 (独立性)

E(1ni=1nXi)=1ni=1nE(Xi)

  • 独立随机变量积均值 == 独立随机变量均值 (独立性)

E(X1X2Xn)=E(X1)E(X2)E(Xn)

均值与随机过程

Moving Average Series

vt=13(wt1+wt+wt+1)

E(vt)?

根据均值的线性性,可得:

E(vt)=13E(wt1+wt+wt+1)=13E(wt1)+13E(wt)+13E(wt+1)=0

性质:⽆论多少个⽆关噪声求和,期望都是0

Random Walk with Drift

xt=δt+j=1twj

E(xt)?

注意这里t是一个固定的时间索引,需要看成常数!

根据均值的线性性与常数型,可得

E(xt)=E(δt+j=1twj)=δt+j=1tE(wj)=δt

性质:在具有线性趋势的时间序列模型中,期望值反映的是时间序列的趋势部分,而不受随机噪声的影响

Signal Plus Noise

xt=Acos(2πωt+ϕ)+wt

E(xt)?

与上个Example一样,同样t也是看成常数

E(xt)=E(Acos(2πωt+ϕ)+wt)=Acos(2πωt+ϕ)+E(wt)=Acos(2πωt+ϕ)

噪声不会影响时间序列的期望值

协方差

协方差的定义

协方差 Cov(X,Y) 是一种用来衡量两个随机变量之间线性关系的统计量。它反映了两个变量如何一起变化。

Cov(X,Y)=E[(XE[X])(YE[Y])]

  • E[X]E[Y] 分别是随机变量 XY 的期望值
  • (XE[X]) 表示随机变量 X 偏离其期望值的程度
  • (YE[Y]) 表示随机变量 Y 偏离其期望值的程度
  • 协方差实际上是对 (XE[X])(YE[Y]) 这两个偏差的乘积的期望

均值的平方转换为方差/协方差

在  E[X]=0  时,可以将  E[X2]  转换为  Var(X)

尤其在:

E[wt2]=σw2

协方差的意义

  • 如果协方差为正,意味着这两个变量趋向于同方向变化
  • 如果协方差为负,意味着它们趋向于相反方向变化
  • 如果协方差接近 0,意味着两个变量之间没有线性关系

协方差的性质

  1. 对称性

Cov(X,Y)=Cov(Y,X)

  1. 退化方差

方差是协方差的特例。当 X=Y 时,协方差就是随机变量的方差:

Cov(X,X)=Var(X)

  1. 缩放不变性

假设 ab 是常数,则:

Cov(aX+b,Y)=aCov(X,Y)

这意味着,如果对一个随机变量进行线性变换,它的协方差会按比例缩放

同样的,常数不会影响协方差和的值

  1. 分配性质

对于三个随机变量 XYZ

Cov(X+Y,Z)=Cov(X,Z)+Cov(Y,Z)

Cov(X,Y+Z)=Cov(X,Y)+Cov(X,Z)

Autocovariance function 自协方差函数 γ(s,t)

用于衡量相关性

γ(s,t)=Cov(Xs,Xt)=E[(Xsμs)(Xtμt)]

是用来衡量同一随机过程中不同时间点对应的随机变量之间的线性相关性

为什么时间点之间可以衡量协方差?衡量协方差不应该是利用随机变量,代表的是多个值吗?

虽然 st 表示的是时间点, 但是对于随机过程{Xt}来说, st 代表的是 XsXt 随机变量, 但是实际上我们关心的是XsXt 随机变量之间的协方差

  • γ(s,t)=0 代表无相关性
  • s=t ,协方差退化为方差

为什么当 s=t ,协方差退化为方差?

从公式理解:

μs=E[Xs]

Var(Xs)=E[(XsE[Xs])2]=E[(Xsμs)(Xsμs)=Cov(Xs,Xs)

从意义理解:

协方差衡量的是两个不同随机变量之间的关系。当我们讨论同一个随机变量的协方差(即 s=t),这个度量变成了它自身随机变量的波动性,即方差

协方差与随机过程

Example1 - white noise

white noise {wt}

γ(s,t)?

  • s=t 时, 方差退化成协方差

γ(s,s)=Cov(ws,ws)=Var(ws)=σ2

  • st 时, 由于白噪声在不同时间点中是互相独立的

γ(s,r)=Cov(ws,wr)=0

或者我们利用公式推导:

Cov(ws,wr)=E[(wsμs)(wrμr)]

由于ws=μs, wr=μr

Cov(ws,wr)=0

Example2

vt=13(wt1+wt+wt+1)

γ(s,t)?

γ(s,t)=cov(vs,vt)=cov{13(ws1+s+ws+1),13(wt1+wt+wt+1)}

根据缩放不变形,各提取13

γ(s,t)=cov{13(ws1+s+ws+1),13(wt1+wt+wt+1)}=19cov{(ws1+ws+ws+1),(wt1+wt+wt+1)}

根据协方差的分配性质

γ(s,t)=19(Cov(ws1,wt1)+Cov(ws1,wt)+Cov(ws1,wt+1)+)

这是一个对所有组合 (ws1,wt1)(ws,wt) 等的协方差求和的过程

Example1 我们知道, 对于白噪声, 任意不同时刻的协方差都为0, 换言之, 在所有组合中, 只有时间相等的协方差为非0, 且为σ2

  • s=t
γ(t,t)=19(cov(wt1,wt1)+cov(wt,wt)+cov(wt+1,wt+1))=39σw2
  • s=t+1/s=t1
γ(t+1,t)=19[cov(wt,wt)+cov(wt+1,wt+1)]=29σw2
  • s=t+2/s=t2
γ(t+2,t)=19cov(wt+1,wt+1)=19σw2

综上:

γ(s,t)={39σw2s=t,29σw2|st|=1,19σw2|st|=2,0|st|>2

Example3 - random walk

random walk vt=j=1twj

γ(s,t)?

vt 是多个白噪声的求和, s,t 代表求和的时间长度

Example2 我们知道, 要求多个白噪声对应随机变量的协方差, 只需要看在数轴上重合了多少个点

γ(s,t)=cov(xs,xt)=cov(j=1swj,k=1twk)=min{s,t}σw2

直观理解 随机游走 random walk

某个变量(如价格、位置等)从一个初始点开始,每一步都根据一个随机增量进行更新。这个增量可能是正的也可能是负的,因此随机游走的轨迹看起来像是一条无规则的曲线。

Random Walk

随机游走的方差随着时间增加而增大。因此,随机游走的统计特性不是恒定的

Lecture2

Strict stationarity 严格平稳性

定义:当满足h,k(任意h、k):

(xt1,,xtk)and(xt1+h,,xtk+h)

有相同的联合分布的时候,时间序列 Xt 被称为严格平稳(或强平稳)

通常利用公式:

P{xt1c1,,xtkck}=P{xt1+hc1,,xtk+hck}

来表示。

这种时间平移不影响联合分布的性质,这也意味着时间序列的所有统计特性(如均值、方差、协方差等)不会随着时间的变化而改变

为什么 P 中仅仅要求“小于某个值 c”?

GPT:

这是因为在概率论中,事件通常是用不等式表示的。比如说,表示随机变量xt,落在某个范围之内的概率,我们通常用 xt1c1 这样的不等式来描述。它表示“时间点 t1 处的随机变量 Xt1,小于等于 c1 的概率“。类似地,公式中表达的是多个随机变量同时满足某些不等式的概率。

对于严格平稳性来说,关心的是这些随机变量在不同时间点是否有相同的联合分布。通过不等式 P{xt1c1,,xtkck},我们可以测量在多个时间点上这些变量同时满足条件的概率。如果这些概率在任何时间偏移h下都相等,那么我们就说这个时间序列是严格平稳的。

为什么严格平稳性是要求联合分布的概率相同,⽽不是⽅差和均值?

GPT:

严格平稳性要求联合分布的概率相同,而不仅仅是均值和方差相同,是因为它关注随机过程的完整统计特性。均值和方差只是部分特征,无法完全描述过程的行为,而联合分布包含了所有可能的统计信息,确保了过程在时间上的一致性。严格平稳性因此为分析和预测随机过程提供了一个更强大和全面的框架。

严格平稳性和相关性的关系:

推导过程:从多维联合分布到二维联合分布(k=2

P{xt1c1,,xtkck}=P{xt1+hc1,,xtk+hck}(k=2,t1=s,t2=t)P{xsc1,xtc2}=P{xs+hc1,xt+hc2}γ(s,t)=γ(s+h,t+h)

Weak stationarity 弱平稳性

与严格平稳性相比,弱平稳性对时间序列的约束条件较少,而不需要每个时间点的联合分布都保持不变。

定义:时间序列 {Xt} 被称为弱平稳的,如果满足以下条件:

  1. 均值独立于时间
E[Xt]=μ , t
  1. 协方差只依赖于时间间隔
γ(s,t)=γ(s+h,t+h)

自协方差函数 γ(h)

假设时间序列是平稳的

公式定义:

γ(h)=γ(t,t+h)=Cov(Xt,Xt+h)=E[(Xtμ)(Xt+hμ)]

其中:

  • h 是时间差(lag),表示两个时刻之间的时间间隔
  • μ 是时间序列的均值,假设时间序列是弱平稳的(均值不随时间变化)

γ(h) 的性质

  1. γ(0)0
  2. |γ(h)|r(0) 协方差永远不可能与自己的协方差(方差)更大, 换言之自己与自己的相关性永远更大
  3. γ(h)=γ(h) 由于协方差性质Cov(X,Y)=Cov(Y,X),可得自协方差具有对称性

时间序列乘积转换为γ(h)

时间序列 xt 满足弱平稳性条件时,E(xtxt+h)=γ(h)

在PACF的时候会利用这个公式

Autocorrelation Function 自相关函数 ACF

定义:

随机过程{Xt}的自相关函数 ACF ρ(h) 衡量的是平稳时间序列在滞后h个时间单位时的相关性。其定义如下:

ρ(h)=γ(t+h,t)γ(t+h,t+h)γ(t,t)=γ(h)γ(0)

为什么不是ρ(h)=γ(t+h)γ(t)

从公式上看,γ(h)=Cov(Xt,Xt+h) 后面的 Cov 已经带了 t

从定义上看,由于我们假定了随机过程满足平稳性,自协方差函数只依赖于时间滞后 h,而不是具体的时刻 t

性质 |γ(h)|r(0)可得:

1ρ(h)1

平稳性、ACF与随机过程

white noise

white noise{wt}, Stationary?

Step1: 考察方差是否独立于t?

E(wt)=0(independent of t)

Step2: 考察协方差是否只依赖于时间间隔 h

随机噪声协方差 的性质我们知道:

γ(s,t)=Cov(ws,wt)={σw2s=t(st=0)0st(st0)(depends only on |st|)

故白噪声 white noise{wt} 满足弱平稳性

γ(h)={σw2h=00h0

我们可以得到ACF图像

random walk

random walk xt=j=1twj, Stationary?

Step1: 考察方差是否独立于t?

E(wt)=E(j=1twt)=j=1tE(wt)=0(independent of t)

Step2: 考察协方差是否只依赖于时间间隔 h

random walk 的协方差性质

γ(s,t)==min{s,t}σw2(depends on both s and t)

由于随机游走的协方差依赖与st故随机游走 random walk xt=j=1twj 不满足弱平稳性

MA(1) process

MA(1) process (moving average)

xt=wt+θwt1{wt}wn(0,σ2)

Stationary?

Step1: 考察方差是否独立于t?

E(xt)=E(wt+θwt1)=E(wt)+θ E(wt1)=0(independent of t)

Step2: 考察协方差是否只依赖于时间间隔 h

γ(s,t)=Cov(xs,xt)=Cov(ws+θws1,wt+θwt1)=Cov(ws,wt)+θ Cov(ws,wt1)+θ Cov(ws1,wt)+θ2 Cov(ws1,wt1)

白噪声的协方差性质 可得:当时间相同时,协方差为 σ2 ,否则为0

  • s=t 时:

γ(t,t)=Cov(wt,wt)+θ2 Cov(wt1,wt1)=(1+θ2)σ2

  • s=t1t=s1 时:

γ(t1,t)=θ Cov(wt1,wt1)=θσ2

γ(s,s1)=θ Cov(ws1,ws1)=θσ2

  • |st|2

γ(s,t)=0

综上

γ(s,t)={(1+θ2)σ2,s=tθσ2,|st|=10,|st|2(depends only on |st|)

故 MA(1) process 是弱平稳的

γ(h)={(1+θ2)σ2,h=0θσ2,|h|=10,|h|2

知识补充:无穷级数

无穷级数 (shuxuele.com)

对于无穷级数S=a+ar+ar2+ar3+ , 求 S ?

|r|<1 时,几何级数的和可以求得有限值,即这个级数收敛。如果 |r|1 ,则该级数不收敛

 |r|<1 几何级数的推导

  1. 假设级数的和为 S

S=a+ar+ar2+ar3+

  1. 将该表达式乘以 r

rS=ar+ar2+ar3+ar4+

  1. 将 S 和 rS 相减,并提取公因子

S(1r)=a

  1. 解得 S

S=a1rwhen |r|<1

知识补充:几何级数

Sn=a+ar+ar2++arn1

Sn=a(1rn)1r,if r1

AR(1) process

AR(1) process (autoregressive)

xt=ϕxt1+wt,0<|ϕ|<1,{wt}wn(0,σ2)

wt is uncorrelated with xs for s<t

Stationary?

先展开递归公式:

xt=ϕxt1+wt=ϕ(ϕxt2+wt1)+wt=ϕ2xt2+ϕwt1+wt==j=0ϕjwtj

Step1: 考察方差是否独立于t?

易得:E(xt)=0(independent of t)

Step2: 考察协方差是否只依赖于时间间隔 h

γ(s,t)=Cov(j=0ϕjwsj,j=0ϕjwtj)

  • s=t 时:
r(t,t)=cov(j=0ϕjwtj,i=0ϕiwti)=j=0ϕ2jcov(wtj,wtj)=σ21ϕ2

在连续求和中,由于协方差的分配性质,前一个求和项都会后一个求和项形成组合,只有下标相等的为非0项,得到j=0ϕ2jcov(wtj,wtj)

利用无穷级数:

S=a1ra=cov(wtj,wtj)r=ϕ2

S=σ21ϕ2

  • st 时,s=t+h

st 多递归了 h 项,得:

xt+h=j=0h1ϕjwt+hj+j=hϕjwt+hj

对于 xt的求和项 是从0开始的,我们对从 h 开始的 (上式的第二项)进行符号替换

j=hϕjwt+hj== j=>k+h k+h=hϕk+hwt+h(k+h)==k=0ϕk+hwtk==ϕhk=0ϕkwtk== k=>j ϕhj=0ϕjwtj==ϕhxt

xt+h=j=0h1ϕjwt+hj+ϕhxt

可得

r(t+h,t)=cov(xt+h,xt)=cov(j=0h1ϕjwt+hj+ϕhxt,xt)

由于白噪声在时间 tt+h0t 没有相等的下标,即j=0h1ϕjwt+hjxt 之间组合的所有项都为0,可得

r(t+h,t)=cov(j=0h1ϕjwt+hj+ϕhxt,xt)=cov(ϕhxt,xt)=ϕhcov(xt,xt)=ϕhσ21ϕ2(h>0)

故 AR(1) process 是弱平稳的

γ(h)={σ21ϕ2,h=0ϕhσ21ϕ2,|h|1

相关性估计

对于观测值 x1,...,xn 来说,我们利用ACF对其相关性进行估计

方法:

  1. 计算均值
x¯=1nt=1nxt
  1. 利用滑动窗口思想,将窗口中的 tt+h 为一组送入公式求出协方差
γ^(h)=1nt=1n|h|(xt+|h|x¯)(xtx¯),n<h<n
  1. 计算ACF
ρ^(h)=γ^(h)γ^(0),n<h<n

由于 γ(h)=γ(h) ,所以对于确定满足弱平稳性的随机过程来说在 h>0h<0 上是对称的

对于观测值来说,均值为E(x¯)=μ ,方差为 :

Var(x¯)=1nh=nn(1|h|n)γ(h)

结论:当 n 增大时,方差会减小;进一步意味着,当观察越来越多的样本的时候,均值会越来越准确

Why这个公式?详细请GPT……

利用ACF判断白噪声

白噪声ρ(h) 有如下性质:

(ρ^(1)ρ^(2)ρ^(K))AN(0,1nI)

这说明当样本量较大时,自相关系数估计量会趋于类正态分布(AN)

意味着可以利用正态分布的性质来推断这些估计值是否为白噪声

样本ACF可以帮助我们识别许多非白噪声(甚至非平稳)时间序列

image-2024100760307465 PM

样本ACF可以帮助我们识别许多非白噪声(甚至非平稳)时间序列

image-2024100760348051 PM

Backshift and forward-shift operator

Backshift operator:

Bxt=xt1Bkxt=xtk

Forward-shift operator:

xt=B1xt1

First difference operator:

xt=xtxt1xt=(1B)xt

Differences with order d:

d=(1B)d

差分

对于时间序列模型的基本结构 xt=mt+st+et 来说,我们想要去除趋势项 mt 的方法就是差分

The first difference eliminates a linear trend 一阶差分消除了线性(一次)趋势:

eg:

xt=β0+β1t+ytxt=xtxt1=β0+β1t+yt(β0+β1(t1)+yt1)=β1+ytyt1

The second order difference eliminates a quadratic trend 二阶差分消除了二次趋势:

eg:

xt=β0+β1t+β2t2+ytxt=xtxt1=β1β2+2β2t+ytyt12xt=(xt)=2β2+yt2yt1+yt2

求二阶差分的方法是先求出一阶差分,对于一阶差分的表达式再求一次差分

如果我们想要去除季节项 et 我们也可以使用差分

xt=st+yt(where st=stp for all t)

季节的时间差为 p

pxt=xtxtp=(1Bp)xtpxt=(st+yt)(stp+ytp)=ytytp=pyt

Lecture3 / Lecture4

Linear process

Linear process(线性过程) 是时间序列分析中的一个基本概念,用于描述当前时间序列值与过去白噪声项的线性组合

xt=μ+j=ψjwtj,where {wt}wn(0,σw2)and μ,ψj are parameters satisfying j=|ψj|<

Linear process 的分布为:

E[xt]=μ+j=ψjE[wtj]=μ+0=μγ(h)=Cov(j=ψjwtj,k=ψkwt+hk)=σ2j=ψj+hψj

我们知道random walk xt=j=1twj 是不平稳的,为了平稳我们需要保证j=|ψj|<

平稳的时间序列在进行线性变化后也是平稳的,同样的将一个平稳的随机过程作用于线性过程中,整个线性过程也会保持平稳

AR(p)

假设当前值和过去值之间存在关系,当前时间 xt 可以被解释为一个包含为 xt1,xt2,...,xtp 的线性关系,允许根据观测数据(当前和过去的值)预测未来的值,记为 AR(p)

用数学表示为:

xt=ϕ1xt1+ϕ2xt2++ϕpxtp+wtwtwn(0,σw2)ϕ1,ϕ2,,ϕp are constants (ϕp0)

同时:Wt uncorrelated with Xs (t>s)

也可以形式表示为:Pt^=E(xt|xt1,...,xxp)

利用Backshift operator表示为:

xt=ϕ1xt1+ϕ2xt2++ϕpxtp+wt(1ϕ1Bϕ2B2ϕpBp)xt=wtϕ(B)xt=wt

Mean and autocovariance function:

μ=0, γ(h)=ϕ1γ(h1)+ϕ2γ(h2)++ϕPγ(hP)

详情请搜索Yule-Walker方程及矩阵

(γ(0)γ(1)γ(2)γ(P1))=(1ϕ1ϕ2ϕPϕ11ϕ2ϕP1ϕ2ϕ11ϕP2ϕP1ϕP2ϕ11)(γ(0)γ(1)γ(P1))+(σw200)

AR(1) model

当 Autoregressive models p=1 , 模型变为 AR(1) model :

xt=ϕ1xt1+wt , 0<|ϕ|<1

根据 AR1 平稳性推理的结论,我们知道:

x 递归展开

xt=j=0ϕjwtj

感受递归推导的复杂性, 这也是为什么我们要引入Backshift op来简化计算

Mean and autocovariance function:

μ=0;γ(h)=σw2ϕh1ϕ2

In terms of the backshift operator:

xt=ϕ1xt1+wt(1ϕ1B)xt=wtϕ(B)xt=wtϕ(B)=1ϕB

Linear process 表示:

xt=j=0ϕjwtjxt=ψ(B)wtψ(B)=j=0ϕjBj=1(1ϕB)

注意 Bj 是对于 wt 的偏移,由于递推公式展开时会展开 wtwtj 项,所以可以看成 j=0Bjwt

Explosive AR Models and Causality

As AR(1) process with |ϕ| > 1, such processes are called explosive because the values of the time series quickly become large in magnitude.

We can, however, modify that argument to obtain a stationary model as follows. Write xt+1=ϕxt+wt+1 , in which case,

xt=j=0ϕjwt+j

which means the process is stationary, but it is also future dependent.

When a process does not depend on the future, such as the AR(1) when |ϕ|<1, we will say the process is causal.

判断 AR(n) Causality 的方法

AR(p):

yt=ϕ1yt1+ϕ2yt2++ϕnytn+ϵtytϕ1yt1ϕ2yt2ϕnytn=ϵt

写成Autoregressive operator:

ϕ(B)=1ϕ1Bϕ2B2ϕpBp,

写出特征方程:

1ϕ1zϕ2z2ϕnzp=0

我们解出所有的解析解,如果所有的解都满足|z|>1,即AR(p)是Causality的,否则不是

怎么理解解析解都必须大于1?

不知道,还在想....

Every Explosion Has a Cause

必须理顺各种表达形式:

  • autoregressive operator: ϕ(B)xt=wt
  • MA() Representation: xt=ψ(B)wt

结论:

ψ(B)=ϕ1(B)

Why?观察公式:

ϕ(B)xt=wtxt=ψ(B)wt

易证 ψ(B)ϕ(B)=1

推导的核心就是将 B 看成多项式即可,这也是为什么需要引入 B 的原因

ϕ(B) to ψ(B) by matching

ψ(B)ϕ(B)=1

(ψ0+ψ1B+ψ2B2+)(1ϕ1BϕpBp)=1

Coefficient of:

  • B0: ψ0=1
  • B1: ψ1ϕ1ψ0=0
  • B2: ψ2ϕ1ψ1ϕ2ψ0=0
  • B3: ψ3ϕ1ψ2ϕ2ψ1ϕ3ψ0=0

简单来说,依次找B0...Bn项, 与右边的系数进行匹配, 后续的MA, ARMA模型的转换也是同样的思想

MA(q)

MA(q) model 定义为:

xt=wt+θ1wt1+θ2wt2++θqwtqwtwn(0,σw2)θ1,θ2,,θq(θq0) are parameters

Moving average operator:

xt=wt+θ1wt1+θ2wt2++θqwtqxt=(1+θ1B+θ2B2++θqBq)wtxt=θ(B)wt

Mean and autocovariance function:

μ=0,γ(h)={σw2j=0q|h|θjθj+|h|,|h|q0,|h|>q

MA(1)

q=1变为MA(1) model:

xt=wt+θwt1

易得: Mean, autocovariance, and autocorrelation function:

μ=0;γ(h)={(1+θ2)σw2,h=0θσw2,h=10,h>1ρ(h)={θ1+θ2,h=10,h>1

先移项,然后按照类似于AR(1)的方法

wt=θwt1+xt

递归展开,得到

wt=j=0(θ)jxtj=j=0πjxtj=π(B)xt

易证:

π(B)θ(B)=1

Non-uniqueness of MA Models and Invertibility

对于MA模型来说, 可能会出现这种情况:

We note that for an MA(1) model, ρ(h) is the same for θ and 1θ; try 5 and 15, for example. In addition, the pair σw2=1 and θ=5 yield the same autocovariance function as the pair σw2=25 and θ=15:

γ(h)={26h=0,5h=1,0h>1.

对于拥有观测值并尝试预测模型来说,这是一种灾难,因为同样的数据有可能会出现两个模型都匹配; 因此我们需要挑选出一个模型: We will choose the model with an infinite AR representation. Such a process is called an invertible(可逆) process.

换言之, 我们挑选出的MA模型必须可以转换为AR模型

从公式角度上看, 例如MA(1), wt=θwt1+xt; 我们都知道AR模型是只有一个wt的, 当需要从 wt=θwt1+xt 变成类似 wt=j=0(θ)jxtj 需要利用递归展开wwj, 若需要保证递归和展开后的式子是收敛的, 我们必须保证 |θ|<1; 换言之, 只有|θ|<1才能顺利计算 π(B)=θ1(B) 得到 wt=π(B)xt 这种"AR形式".

判断 MA(q) Invertibility 的方法

对于一个 MA(q) 模型:

xt=wt+θ1wt1+θ2wt2++θqwtq

其中 wt 是独立同分布的白噪声序列,我们可以通过其特征方程的根来判断是否可逆。

得到 θ(B)

θ(B)=1+θ1B+θ2B2++θqBq

根据特征方程的根来判断:

1+θ1+θ2z2++θqzq=0
  • 如果特征方程的根模都大于1,则该 MA 模型是可逆的 (Invertible)
  • 如果某些根模小于或等于 1,则该 MA 模型是不可逆的 (Non-invertible)

θ(B) to π(B) by matching

ϕ(B) to ψ(B) by matching 的方法一致, 利用matching

Lecture5

ARMA(p,q)

xtϕ1xt1ϕpxtp=wt+θ1wt1++θqwtqϕ(B)xt=θ(B)xt=ψ(B)wt=θ(B)ϕ(B)wt=wt

Avoid parameter redundancy

为了确保 ARMA 模型是最佳的表达形式,并避免使用不必要的参数,AR 部分和 MA 部分的多项式必须是互质的(没有共同因子)

example:

假设:

xt=1.5xt10.5xt2+wtwt1

对应的 AR 多项式和 MA 多项式分别是:

  • ϕ(z)=11.5z+0.5z2=(1z)(10.5z)
  • θ(z)=1z

我们可以通过除去这个公因子来简化模型。原本的 ARMA(2,1) 模型实际上可以简化为一个 ARMA(1,0) 模型(即一个 AR(1) 模型)

xt=0.5xt1+wt

Stationarity

If ϕ and θ have no common factors, a stationary solution to ϕ(B)xt=θ(B)wt exists if and only if all the roots of ϕ(z) satisfy |z|1

Causality

The ARMA(p,q) process is causal if and only if all the roots of ϕ(z) satisfy |z|>1

Invertibility

The ARMA(p,q) process is invertible if and only if all the roots of θ(z) satisfy |z|>1

Example of Stationarity, Causality, Invertibility

xt=56xt116xt2+wt0.25wt2

Step1: 移项AR的ϕ(B) 和MA的θ(B)

ϕ(B)=156B+16B2

θ(B)=114B2

注意移项的时候不要弄错符号!

Step2: 写出求根公式,进行因式分解

156z+16z2=0z1=2;z2=316(x2)(x3)=0

114z2=0z1=2;z2=214(x2)(x+2)=0

得: 16(x2)(x3)xt=14(x2)(x+2)wt

注意: 由于我们需要Avoid parameter redundancy, 对于相同的因式需要消除

16(x3)xt=14(x+2)wtARMA(1,1)

Step3: 进行Causal 和 Invertible 的判断

The roots of ϕ(B): z1=3, all roots |z| greater than 1, so ARMA is Causal

The roots of θ(B): z1=2, all roots |z| greater than 1, so ARMA is Invertible

Convert to MA process

For a causal ARMA(p,q) model, we may write:

xt=j=0ψjwtj=ψ(B)wt

can use matching coefficients to find ψ(B)

ψ(B)=θ(B)ϕ(B)ϕ(B)ψ(B)=θ(B)

Example: convert ARMA to MA:

xt=0.9xt1+0.5wt1+wt(10.9B)xt=(1+0.5B)wt(10.9B)(ψ0+ψ1B+ψ2B2+ψ3B3+)=1+0.5B

Coefficient of:

  • B0: ψ0=1
  • B1: ψ10.9ψ0=0.5ψ1=1.4
  • B2: ψ20.9ψ1=0ψ2=1.26
  • B3: ψ30.9ψ2=0ψ3=1.134

ARMA 的自相关函数

方法1: convert ARMA to MA

γ(h)=σw2(ψ0ψh+ψ1ψh+1+ψ2ψh+2+)

方法2: 利用 γ(h) 递推表达式

PACF

引入 PACF 的核心动机是为了克服 ACF 在分析 AR 或 ARMA 模型时的局限性:

  • For MA(q) models, the ACF will be zero for lags greater than q, and will not be zero at lag q.
  • For ARMA(q) models, the diagram of ACF will appear Tails off, a gradual decay in the autocorrelation values over time lags.

For example, xt is dependent on xt2 xt1 , we have to build COV(xtϕxt1,xt2ϕxt1)=0, by removing (or partial out) the effect xt1, which break this chain of dependence.

为什么对于xt2也要减去xt1, xt2是发生在xt1之前的,理论上应该是无关的!? 虽然  xt2  在时间上发生在  xt1  之前,但由于 xt1  作为 xt  的一个线性预测变量存在,xt2  和  xt  的相关性并非独立的,而是通过  xt1  这个中介变量传递。为了消除这种中介效应,我们通过去除  xt1  对  xt  和  xt2  的影响来部分掉这个线性关系,这就是“将  xtϕxt1xt2ϕxt1  进行协方差分析”的原因。这一步骤的目的是破除依赖链,从而仅考察与白噪声  w_t  的直接相关性。

Definition:

对于xt+hxt来说,需要“解除依赖项”是{xt+h1,xt+h2,,xt+1},我们可以得到regression项:

  • x^t+h=β1xt+h1+β2xt+h2++βh1xt+1
  • x^t=β1xt+1+β2xt+2++βh1xt+h1

β1βt1x^t+hx^t 是相同的;对于依赖项的排列: x^t+h 是从后往前; x^t+h 是从前往后

“解除依赖项”是xt+hxt中间的元素!

The partial autocorrelation function (PACF) of a stationary process, xt, denoted ϕhh, for h=1,2,, is

ϕ11=corr(xt+1,xt)=ρ(1),ϕhh=corr(xt+hx^t+h,xtx^t),h2

注意这里是 ρ(1) 而不是 γ(1) , 这里是 corr 而不是 cov !

参考 ρ 的公式: ρ(h)=γ(t+h,t)γ(t+h,t+h)γ(t,t)

我们可以得到

ϕhh=corr(xt+hx^t+h,xtx^t)=cov(xt+hx^t+h,xtx^t)var(xt+hx^t+h)var(xtx^t),h2
PACF of an AR(1)

Consider the PACF of the AR(1) process given by xt=ϕxt1+wt, with |ϕ|<1.
By definition, ϕ11=ρ(1)=ϕ. To calculate ϕ22, consider the regression of xt+2 on xt+1, say, x^t+2=βxt+1. We choose β to minimize

minimize E(xt+2x^t+2)2=E(xt+2βxt+1)2=γ(0)2βγ(1)+β2γ(0).

利用 E(xtxt+h),μ=0E(xtxt+h)=γ(h) 这个性质

二次方程的最优化问题利用求导找零点即可解决

为什么要进行minimize? 以AR(1)举例: 我们的目的是 将 xt+2去除 xt+1 的影响, 从而实现更高的独立性 而 xt+2 是由 xt+1 通过某种“变化”而来,用公式表示为xt+2=ϕxt+1+wt+2, 我们β 本质上就是在逼近这个 ϕ , 尽可能去除 ϕxt+1 而保留wt+2, 从公式来看就是minimize E(xt+2x^t+2)2 所以我们可以看到,在AR(1)最小化问题中, β 最终是等于 ϕ  的,但是在更加复杂的AR模型中,我们就需要利用minimize来求解!

Hence,

ϕ22=corr(xt+2x^t+2,xtx^t)=corr(xt+2ϕxt+1,xtϕxt+1)=corr(wt+2,xtϕxt+1)=0

Thus, ϕ22=0. 我们可以推广到 AR(p) 模型中:

ϕhh=0for all h>p

PACF of an Invertible MA(q)

For an invertible MA(q), we can write xt=j=1πjxtj+wt. Moreover, no finite representation exists. From this result, it should be apparent that the PACF will never cut off (and always Tails off). 换言之,我们没法用过某个 x^ 破除拥有无数依赖的依赖链.

For an MA(1), xt=wt+θwt1, with |θ|<1, calculations similar to Example The PACF of an AR(1) will yield ϕ22=θ2/(1+θ2+θ4). For the MA(1) in general, we can show that

ϕhh=(θ)h(1θ2)1θ2(h+1),h1.

ACF & PACF for models

AR(p)MA(q)ARMA(p,q)
ACFTails offCuts off after lag qTails off
PACFCuts off after lag pTails offTails off

Lecture 6 / 7 /8

Forecasting

目标 Objective:

Predict future values of a time series, xn+m, m=1,2,, based on the data collected to present, x1:n={x1,x2,,xn}.

Mean square error (MSE):

E(xn+mg(x1:n))2

其中 g(x1:n) 是一个根据观察值 x1:n 的函数

Minimum mean square error (MSE) predictor:

xn+mn=E(xn+mx1:n)

换言之,对于MSE误差来说来说,条件期望(是一个函数)是最优的函数,可以达到“minimum MSE”

基于 infinite past 的预测,通常不会写成 xn+1n,而是直接用条件期望的表示形式来表达预测值  x^t+1

Minimum mean square error (MSE)

E(xn+mxn+mn)2

证明待补充,还没看懂

Linear predictor

Predictors of the form:

Given data {x1,x2,,xn}

xn+mn=α0+k=1nαkxk

xn+mn 的意义:

  • if n=m=1, then x21 is the one-step-ahead linear forecast of x2 given x1
    • x21=α0+α1x1
  • if n=2, x32 is the one-step-ahead linear forecast of x3 given x1 and x2.
    • x32=α0+α1x1+α2x2
  • In general, the αs in x21 and x32 will be different.

Best linear predictors (BLPs) for Stationary Processes

对于MSE的minimize,我们只需要对变量求导并求出零点即可

对于BLPs,我们需要调整 αk 的值使得整个MSE最小,故得:

Minimize E(xn+mxn+mn)2

E(xn+mxn+mn)2αk=E[(xn+mxn+mn)xk]=0,k=1,2,,n

Assume x0=1, for a0,a1,...,an:

E(xn+mxn+mn)2αk=E[(xn+mxn+mn)xk]=0,k=0,1,,n

We generally consider E(xt)=μ=0 and a0=0, there is the prove:

when k=0, E(xn+mxn+mm)=0, E(xn+mm)=E(xn+m)=μ, bringing in xn+mn=α0+k=1nαkxk yield μ=α0+k=1nαkμ.

Hence, the form of the BLP is

xn+mn=μ+k=1nαk(xkμ)=k=1nαkxk=k=0nαkxk(when a0=0)

One-step ahead prediction

The BLP of xn+1:

xn+1n=ϕn1xn+ϕn2xn1++ϕnnx1

Using BLPs' s minimize property:

E[(xn+1xn+1n)xn+1k]=0,k=1,2,,nE((xn+1j=1nϕnjxn+1j)xn+1k)=0,k=1,2,,nj=1nϕnjγ(kj)=γ(k),k=1,2,,n

注意写成 E[(xn+1xn+1n)xn+1k] 而不是 E[(xn+1xn+1n)xk] 主要是展开后可以很方便写成γ(k) 形式: E[(xn+1xn+1n)xn+1k]E[xn+1xn+1kxn+1nxn+1k]γ(k)E(xn+1nxn+1k)

matrix form:

[γ(0)γ(1)γ(n1)γ(1)γ(0)γ(n2)γ(n1)γ(n2)γ(0)][ϕn1ϕn2ϕnn]=[γ(1)γ(2)γ(n)]

notation as:

(3.64)Γnϕn=γnϕn=Γn1γn

where Γn

  • is a positive definite matrix 是正定矩阵
  • is a non-singular matrix 是非奇异矩阵(只有一个解) where ϕn γn
  • ϕn is an n×1 vector is an 1×n vector (ϕn1,...,ϕnn)
  • γn is an n×1 vector is an 1×n vector (γ(1),...,γ(n))

正定矩阵作用:

  1. 有唯一的最小值,其导数也是正定的,可以通过求导进行优化
  2. 可以进行内积,<x,y>:=xtAy

正定矩阵A的判别:

  1. 利用二次型 xtAx 恒大于0
  2. 特征值都大于0
  3. 各阶顺序主子式都大于0

It is sometimes convenient to write the one-step-ahead forecast in vector notation

xn+1n=ϕnx

where:

  • x=(xn,xn1,...,x1)
  • ϕn is an 1×n vector (ϕn1,...,ϕnn)

不加 的都是列向量,反之是行向量

The mean square one-step-ahead prediction error is:

Pn+1n=E(xn+1xn+1n)2=γ(0)γnΓn1γn

Prediction for an AR(2)

AR2: xt=ϕ1xt1+ϕ2xt2+wt,

The one-step-ahead prediction of x2 base on x1, using equation 3.64:

x21=ϕ11x1=γ(1)γ(0)x1=ρ(1)x1

x3 based on two observations x1 and x2: x32=ϕ21x2+ϕ22x1, to solve ϕ21 and ϕ22:

ϕ21γ(0)+ϕ22γ(1)=γ(1)ϕ21γ(1)+ϕ22γ(0)=γ(2)

or:

(ϕ21ϕ22)=(γ(0)γ(1)γ(1)γ(0))1(γ(1)γ(2)),

As for AR(2), it should be apparent from the model that x32=ϕ1x2+ϕ2x1, that is, ϕn1=ϕ1, ϕn2=ϕ2 because

E{[x3(ϕ1x2+ϕ2x1)]x1}=E(w3x1)=0E{[x3(ϕ1x2+ϕ2x1)]x2}=E(w3x2)=0

If the time series is a causal AR(p) process, then, for np, $$x_{n+1}^n = \phi_1 x_n + \phi_2 x_{n-1} + \cdots + \phi_p x_{n-p+1}. \tag{3.67}$$

Durbin–Levinson Algorithm

Computes xn+1n and Pn+1n recursively as

ϕ00=0,P10=γ(0)

For n1:

ϕnn=ρ(n)k=1n1ϕn1,kρ(nk)1k=1n1ϕn1,kρ(k),Pn+1n=Pnn1(1ϕnn2)

For n2:

ϕnk=ϕn1,kϕnnϕn1,nk,k=1,2,,n1

example - Using the Durbin–Levinson Algorithm

To use the algorithm, start with ϕ00=0, P10=γ(0). Then, for n=1,

ϕ11=ρ(1),P21=γ(0)[1ϕ112].

For n=2,

ϕ22=ρ(2)ϕ11ρ(1)1ϕ11ρ(1),ϕ21=ϕ11ϕ22ϕ11,P32=P21[1ϕ222]=γ(0)[1ϕ112][1ϕ222].

For n=3,

ϕ33=ρ(3)ϕ21ρ(2)ϕ22ρ(1)1ϕ21ρ(1)ϕ22ρ(2),ϕ32=ϕ22ϕ33ϕ21,ϕ31=ϕ21ϕ33ϕ22,P43=P32[1ϕ332]=γ(0)[1ϕ112][1ϕ222][1ϕ332],

and so on. Note that, in general, the standard error of the one-step-ahead forecast is the square root of

Pn+1n=γ(0)j=1n[1ϕjj2].

example - The PACF of an AR(2)

AR2: xt=ϕ1xt1+ϕ2xt2+wt,

ϕ11=ρ(1)=ϕ11ϕ2ϕ22=ρ(2)ρ(1)21ρ(1)2=[ϕ1(ϕ11ϕ2)+ϕ2](ϕ11ϕ2)21(ϕ11ϕ2)2=ϕ2ϕ21=ρ(1)[1ϕ2]=ϕ1ϕ33=ρ(3)ϕ1ρ(2)ϕ2ρ(1)1ϕ1ρ(1)ϕ2ρ(2)=0.

In fact, in AR(p) model, because of the property of Prediction for an AR(2),

xp+1p=ϕp1xp+ϕp2xp1++ϕppx1=ϕ1xp+ϕ2xp1++ϕpx1.

This result shows that for an AR(p) model, the partial autocorrelation coefficient at lag p, ϕpp, is also the last coefficient in the model, ϕp.

可以说 AR模型的Linear predictor 就是AR模型本身

The Innovations Algorithm

The one-step-ahead predictors, xt+1t, and their mean-squared errors, Pt+1t, can be calculated iteratively as

x10=0,P10=γ(0)xt+1t=j=1tθtj(xt+1jxt+1jtj),t=1,2,Pt+1t=γ(0)j=0t1θt,tj2Pj+1j,t=1,2,

where, for j=0,1,,t1,

θt,tj=(γ(tj)k=0j1θj,jkθt,tkPk+1k)/Pj+1j.

Given data x1,,xn, the innovations algorithm can be calculated successively for t=1, then t=2 and so on, in which case the calculation of xn+1n and Pn+1n is made at the final step t=n. The m-step-ahead predictor and its mean-square error based on the innovations algorithm are given by

xn+mn=j=mn+m1θn+m1,j(xn+mjxn+mj1n+mj),Pn+mn=γ(0)j=mn+m1θn+m1,j2Pn+mj1n+mj,

where the θn+m1,j are obtained by continued iteration of θt,tj.

example - Prediction for an MA(1)

The innovations algorithm lends itself well to prediction for moving average processes.

MA(1): xt=wt+θwt1 , γ(0)=(1+θ2)ϕw2 , γ(1)=θγw2 and γ(h)=0 for h>1

Using Innovations Algorithm:

θn1=θσw2/Pn1nθnj=0,j=2,,nP10=(1+θ2)σw2Pn+1n=(1+θ2θθn1)σw2

Finally, the one-step-ahead predictor is

xn+1n=θ(xnxnn1)σw2Pnn1

Forecasting ARMA models

Forecasting AR(p) and MA(q)

  • The Durbin-Levinson algorithm is convenient for AR(p) processes
  • The innovations algorithm is convenient for MA(q) processes.

Review causality and invertibility

  1. 因果性(Causality):指的是当前值  xt  仅依赖于当前及之前的随机扰动项(白噪声项)  wt,wt1, ,而不依赖未来的  wt+1,wt+2, 。这就意味着,对于未来的时刻  t>n ,我们对  wt  的条件期望  w~t=E(wt|xn,xn1,)=0  应该是零

  2. 可逆性(Invertibility):指的是可以将当前的白噪声项  wt  用过去的观测值  xt,xt1,  表示出来。这表明,对于任何过去的扰动项  wt (其中  tn ),我们可以通过过去的观测值来估计或重构  wt ,因此条件期望  w~t=E(wt|xn,xn1,)=wt

Thus:

(3.81)w~t=E(wt|xn,xn1,)={0,t>nwt,tn

Forecasting ARMA Processes

We assume xt is a causal and invertible ARMA(p, q) process, ϕ(B)xt=θ(B)wt, where wtiid N(0,σw2). In the non-zero mean case, E(xt)=μx, simply replace xt with xtμx in the model.

First, we consider two types of forecasts. We write xn+mn to mean the minimum mean square error predictor of xn+m based on the data {xn,,x1}, that is,

xn+mn=E(xn+m|xn,,x1).

For ARMA models, it is easier to calculate the predictor of xn+m, assuming we have the complete history of the process {xn,xn1,,x1,x0,x1,}. We will denote the predictor of xn+m based on the infinite past as

x~n+m=E(xn+m|xn,xn1,,x1,x0,x1,).

In general, xn+mn and x~n+m are not the same, but the idea here is that, for large samples, x~n+m will provide a good approximation to xn+mn.

Now, write xn+m in its causal and invertible forms:

(3.82)xn+m=j=0ψjwn+mj,ψ0=1(3.83)wn+m=j=0πjxn+mj,π0=1.

将公式(3.82)中 xn+m 的表示代入到条件期望中(taking conditional expectations):

x~n+m=E(j=0ψjwn+mj|xn,xn1,)

由于期望的线性性质,可以将求和符号和常数  ψj  移到期望外面:

x~n+m=j=0ψjE(wn+mj|xn,xn1,).

根据性质 (3.81) 对于 j<m 的项,条件期望为 0;而对于 jm 的项,条件期望就是 wn+mj 本身, 得到

(3.84)x~n+m=j=0ψjw~n+mj=j=mψjwn+mj.

Similarly, taking conditional expectations in (3.83), we have

(3.85)0=x~n+m+j=1πjx¯n+mj,

Using (3.82) (3.84), we can write

xn+mx~n+m=j=0m1ψjwn+mj,

so the mean-square prediction error can be written as

(3.86)Pn+mm=E(xn+mx~n+m)2=σw2j=0m1ψj2.

Long-Range Forecasts

Replacing xn+m with xn+mμx in (3.82)

(3.88)x~n+m=μx+j=mψjwn+mj.

Noting that the ψ-weights dampen to zero exponentially fast, it is clear that

(3.89)x~n+mμx

exponentially fast (in the mean square sense) as m.

Moreover, by (3.86), the mean square prediction error

(3.90)Pn+mnσw2j=0ψj2=γx(0)=σx2,

exponentially fast as m.

It should be clear from (3.89) and (3.90) that ARMA forecasts quickly settle to the mean with a constant prediction error as the forecast horizon, m, grows. 从 (3.89) 和 (3.90) 中可以清楚地看出,随着预测范围 m 的增长,ARMA 预测很快就会趋于均值预测误差保持不变

Truncated Prediction for ARMA

截断预测是一种用于时间序列分析的方法,指的是在模型预测未来值时,因为只能利用有限的历史数据而无法观测无限的过去数据,或者无法利用未来的观测值,因此对模型的计算进行简化和近似

ARMA模型:

xt=ϕ1xt1+ϕ2xt2++ϕpxtp+θ1wt1+θ2wt2++θqwtq+wt,
  • 我们仅有数据 x1,x2,,xn
  • AR 部分的回归结构(依赖于过去的 xt)天然支持递归预测
  • 对于 t>nt0,设 wt=0,因为这些噪声项不可观测 此时,截断预测通过以下假设简化计算:
  • 假设未知噪声项 wt=0 (对于 t>n or t0
  • 递归地使用过去的预测值代替未来的未知值。

The truncated prediction formula is given as:

(3.92)x~n+mn=ϕ1x~n+m1n++ϕpx~n+mpn+θ1w~n+m1n++θqw~n+mqn.

Where:

  • x~tn:    - x~tn=xt for 1tn (observed values).    - x~tn=0 for t0 (before the start of the series).
  • Truncated prediction errors w~tn:    - w~tn=0 for t0 or t>n (unobserved noise outside the series range).    - For 1tn, w~tn is calculated as:
w~tn=ϕ(B)x~tnθ1w~t1nθqw~tqn.

Example to drive MMSE predictor and its MSE

Example1

MA(1) xt=wt+θwt1. Derive the minimum mean-square error one-step forecast based on the infinite past, and determine the mean-square error of this forecast.

对于一般的MA模型,我们并不使用Durbin–Levinson Algorithm和The Innovations Algorithm,而使用定义求解

Minimum mean square error (MSE) predictor:

xn+mn=E(xn+mx1:n)

解:

x^t+1=E(xt+1|X:t)=E(wt+1+θwt|X:t)=E(θwt|X:t)=θwt

上面的过程是错误的,我们需要将预测公式写成已知观测值的形式,而 wt 是不可观测的噪声项! 正确的方法是通过递归公式将 wt 展开为 xt,xt1, 的函数,确保最终的预测公式只依赖于已知的观测值

根据 MA(1) 模型定义:

xt+1=wt+1+θwt.

wt 用展开公式表示为:

wt=j=0(θ)jxtj.

代入 xt+1 的表达式,得到:

xt+1=wt+1j=0(θ)j+1xtj

取条件期望:

x^t+1=E(xt+1|X:t)=E(wt+1j=0(θ)j+1xtj|X:t)=j=0(θ)j+1xtj

MSE:

E(xt+1x^t+1)2=E(wt2)=σw2

Example2

For an AR(1) model, determine the general form of the m-step-ahead forecast xt+mt and MSE

AR(1) Model: xt=ϕxt1+wt

xt+m=ϕmxt+j=0m1ϕjwt+mjxt+mt=E(xt+m|x1:t)=E(ϕmxt+j=0m1ϕjwt+mjx1:t)=ϕmxt

Mean Squared Error (MSE):

MSE=E[(xt+mxt+mt)2]=E(j=0m1ϕjwt+mj)2=σw2j=0m1ϕ2j=1ϕ2m1ϕ2σw2

Estimation

We assume

  • we have n observations, x1,,xn
  • from a causal and invertible Gaussian ARMA(p,q) process
  • The data has zero mean

Our goal is

  • estimate the parameters, ϕ1,,ϕp,θ1,,θq, and σw2
  • determining p and q later in this section.

Yule-Walker estimation

Yule-Walker 方程是自回归模型(AR 模型)参数估计的一种方法,基于样本自协方差和理论自协方差的一致性。

对于AR(p)

xt=ϕ1xt1+ϕ2xt2++ϕpxtp+wt,
  • ϕ1,,ϕp 是需要估计的参数;
  • wt 是零均值白噪声,具有方差 σw2

其矩阵Yule-Walker形式如下

Γpϕ=γp.[γ(0)γ(1)γ(2)γ(p1)γ(1)γ(0)γ(1)γ(p2)γ(2)γ(1)γ(0)γ(p3)γ(p1)γ(p2)γ(p3)γ(0)][ϕ1ϕ2ϕ3ϕp]=[γ(1)γ(2)γ(3)γ(p)].

具体展开形式 假设 p=3,则矩阵形式为:

[γ(0)γ(1)γ(2)γ(1)γ(0)γ(1)γ(2)γ(1)γ(0)][ϕ1ϕ2ϕ3]=[γ(1)γ(2)γ(3)].

For MA and ARMA models, the Yule–Walker estimators are not optimal

BLPs 中也使用了Yule–Walker estimators 的矩阵来估计Linear predictor 的参数,但是目标是不一样的。BLPs目标是通过观测值预测未来,而Yule–Walker estimators用于估计求参数

在计算 Yule-Walker 方程时,直接求解线性方程组 Γpϕ=γp 通常需要矩阵求逆,这在高阶 (p 很大) 的情况下计算复杂度较高,而Durbin-Levinson 算法,通过递归方式计算 Yule-Walker 方程的解,无需直接求逆协方差矩阵

Maximum likelihood estimator

Assume {xt} is Gaussian (wt is i.i.d. Gaussian forARMA process)

For the causal AR(1) model, the process is defined as:

(3.106)xt=μ+ϕ(xt1μ)+wt,$$where$|ϕ|<1$and$wtiid N(0,σw2)$.Givendata$x1,x2,,xn$,thelikelihoodis:$$L(μ,ϕ,σw2)=f(x1,x2,,xnμ,ϕ,σw2).$$LikelihoodDecompositionForanAR(1)process,thelikelihoodcanbewrittenas:$$L(μ,ϕ,σw2)=f(x1)f(x2x1)f(xnxn1),

Since xtxt1N(μ+ϕ(xt1μ),σw2), we have:

f(xtxt1)=fw((xtμ)ϕ(xt1μ))

where fw() is the density of wt, the normal density with mean zero and variance σw2

Final Likelihood The likelihood can be written as:

L(μ,ϕ,σw)=f(x1)t=2nfw((xtμ)ϕ(xt1μ)).$$Usingthecausalrepresentation:$$x1=μ+j=0ϕjw1j,

we see that x1 is normally distributed with mean μ and variance σw21ϕ2.

Full Likelihood Function The likelihood for the AR(1) process is:

(3.107)L(μ,ϕ,σw2)=(2πσw2)n/2(1ϕ2)1/2exp[S(μ,ϕ)2σw2],

where:

(3.108)S(μ,ϕ)=(1ϕ2)(x1μ)2+t=2n[(xtμ)ϕ(xt1μ)]2.

For a normal ARMA(p,q) model, the likelihood expression can be simplified in terms of the innovations

  • Model parameters:
β=(ϕ1,,ϕp,θ1,,θq)
  • Likelihood function:
L(β,σw2)=t=1nf(xtxt1,,x1)

The conditional distribution of xt given the past values is:

xtxt1,,x1N(xtt1,Ptt1)$$where:$Pt1=γ(0)j=1t1(1ϕjj2)$$γ(0)=σw2j=0ψj2$istheautocovarianceatlag0.FullLikelihoodFunction

L(\beta, \sigma_w^2) = (2\pi \sigma_w^2)^{-n/2} \left[ r_1(\beta) r_2(\beta) \cdots r_n(\beta) \right]^{-1/2} \exp \left[ -\frac{S(\beta)}{2 \sigma_w^2} \right]

S(\beta) = \sum_{t=1}^n \left[ \frac{\left( x_t - x_t^{-1}(\beta) \right)^2}{r_t(\beta)} \right]

LargesampledistributionForanARMA($p,q$)process,themaximumlikelihoodestimators(MLE)andunconditional/conditionalleastsquaresestimatorssatisfy:

\begin{pmatrix} \hat{\phi} \ \hat{\theta} \end{pmatrix} - \begin{pmatrix} \phi \ \theta \end{pmatrix} \sim AN \left( 0, \frac{\sigma_w^2}{n} \begin{pmatrix} \Gamma_{\phi\phi} & \Gamma_{\phi\theta} \ \Gamma_{\theta\phi} & \Gamma_{\theta\theta} \end{pmatrix}^{-1} \right),

where $AN$ represents "**asymptotically normal**." The covariance matrix is given as: $$ \begin{pmatrix} \Gamma_{\phi\phi} & \Gamma_{\phi\theta} \\ \Gamma_{\theta\phi} & \Gamma_{\theta\theta} \end{pmatrix} = \text{Cov}((x, y), (x, y)), $$ where: - $x = (x_1, \dots, x_p)'$, corresponding to the AR($p$) terms, - $y = (y_1, \dots, y_q)'$, corresponding to the MA($q$) terms. 结论: - 在样本量 $n \to \infty$ 时,估计量(如 MLE 或最小二乘估计量)服从正态分布 - 随着 $n$ 增加,估计量的精度提升 - 可以利用渐近分布,可以检验参数的显著性,判断模型是否合理 #### Overfitting Variance of the Estimator for an AR(1) Process with Large Sample Size **If we estimate an AR(1) model:** The variance of \(\hat{\phi}_1\) is approximately:

\text{Var}(\hat{\phi}_1) \approx \frac{1 - \phi_1^2}{n}.

IfweestimateanAR(2)model:Thevarianceof\(ϕ^1\)isapproximately:

\text{Var}(\hat{\phi}_1) \approx \frac{1 - \phi_2^2}{n} = \frac{1}{n}.

结论 - 过度拟合模型不会影响模型的正确性 - 例如,如果对 AR(1) 拟合 AR(2),当样本很大时,多余的参数 $\phi_2 = 0$,但拟合结果与真实模型不会冲突 - 过度拟合可能降低估计精度 - 如果对实际为 AR(1) 的过程拟合 AR(2) 模型,增加的参数(如 $\phi_2$)实际为零,但是会导致 $\phi_1$ 的方差会增大 ## Lecture 9 ### ARIMA models A process $x_t$ is said to be ARIMA($p, d, q$) if:

\nabla^d x_t = (1 - B)^d x_t

isARMA($p,q$).ThegeneralARIMA($p,d,q$)modeliswrittenas:

\phi(B)(1 - B)^d x_t = \theta(B)w_t, \tag{3.144}

### Building ARIMA Models #### Diagnostics 诊断,确定模型是否使用与数据,包含残差分析和模型比较 Standardized Residuals:

e_t = \frac{x_t - \hat{x}_t^{-1}}{\sqrt{\hat{P}_t^{-1}}}

where: - $\hat{x}_t^{-1}$: One-step-ahead prediction. - $\hat{P}_t^{-1}$: Estimated one-step-ahead prediction error variance. Model Evaluation Metrics: - **AIC**: $AIC = -2 \ln(L) + 2k$ - **BIC**: $BIC = -2 \ln(L) + k \ln(n)$, where: - $L$ is the likelihood of the model - $k$ is the number of parameters - $n$ is the sample size. #### General Steps to Build ARIMA Models 1. **Plot the data**: - Visualize the time series data to check for trends, seasonality, and any anomalies. - Determine whether transformations (e.g., log or differencing) are necessary. 2. **Transform the data (if needed)**: - Apply transformations to stabilize variance (e.g., Box-Cox transformations). - For instance, if variability increases over time, consider taking logarithms or differencing. **Example:** ![](SDSC6012.assets/file-20241210225954612.png) **需要对数化处理得到稳定的过程** ![](SDSC6012.assets/file-20241211012754732.png) 3. **Identify the dependence orders ($p, d, q$)**: - Use **Autocorrelation Function (ACF)** and **Partial Autocorrelation Function (PACF)** plots to identify: - $p$: Order of the autoregressive (AR) part. - $d$: Number of differences required to make the series stationary. - $q$: Order of the moving average (MA) part. **Example:** ![](SDSC6012.assets/file-20241210230053608.png) 我们可以该模型适合$ARIMA(0,1,2)$ 或 $ARIMA(1,1,0)$ 4. **Estimate parameters**: - Fit the model to estimate the parameters of ARIMA$(p, d, q)$. **Example:** 拟合 $ARIMA(0,1,2)$ 函数得到对应的参数 $$ \hat{x}_t = 0.008_{(0.001)} + 0.303_{(0.065)} \hat{w}_{t-1} + 0.204_{(0.064)} \hat{w}_{t-2} + \hat{w}_t,
  1. Perform diagnostics:

    • Check the residuals to ensure they resemble white noise.
    • Evaluate model fit and adjust as necessary.
  2. Model selection:

    • Compare different models using criteria such as Akaike Information Criterion (AIC) or Bayesian Information Criterion (BIC).