ARMA:

#读入数据,并绘制时序图
d<-read.table("C:/Users/haha/Desktop/R/zuoye/1.txt")
x<-ts(log(d),start = 1)

 

1: x的时间序列图:

x<-ts(log(d),start = 1)
plot(x)

R语言GARCH模型预测函数 garch r语言_拟合

 

2:

R语言GARCH模型预测函数 garch r语言_时间序列_02

 

R语言GARCH模型预测函数 garch r语言_时序图_03

从上图可以看出x.dif序列值在0的附近波动,没有存在显著地波动起伏大的情况,基本为平稳特征.

 

3.对x.dif序列adf单位根检验:

R语言GARCH模型预测函数 garch r语言_拟合_04

 

从x.dif的adf单位根检验p=0.01小于显著水平a=0.05,故拒绝原假设,所有x.dif是平稳序列.

 

4.

 

R语言GARCH模型预测函数 garch r语言_拟合_05

 

R语言GARCH模型预测函数 garch r语言_读入数据_06

R语言GARCH模型预测函数 garch r语言_拟合_07

R语言GARCH模型预测函数 garch r语言_时间序列_08

从上图可以看出x.dif的ACF,PACF是均显示不截尾的性质(PACF:lag12,14; ACF:lag:4,12 在2倍标准差外),故认为可以尝试使用模型ARMA(1,1)

 

5: 系统自动定阶:

为避免错估模型采用,auto.arima自动定价模型

R语言GARCH模型预测函数 garch r语言_读入数据_09

 

R语言GARCH模型预测函数 garch r语言_时序图_10

(1,1,1),其中p=1,d=1,q=1

也就是d=1是需要一阶差分后,序列才平稳,然后对它进行自回归模型是ARMA(1,1).既最后得到模型为x.dif序列的ARMA(1,1)模型

 

6:

 

R语言GARCH模型预测函数 garch r语言_时间序列_11

 

7: 进行白噪声检验:

 

R语言GARCH模型预测函数 garch r语言_读入数据_12

 

8:

 

R语言GARCH模型预测函数 garch r语言_时序图_13

R语言GARCH模型预测函数 garch r语言_读入数据_14

 

 

GARCH:

ARCH效应检验的两种方法:

LM检验(拉格朗日检验)

R语言GARCH模型预测函数 garch r语言_拟合_15

 

拟合garch(1,1):

R语言GARCH模型预测函数 garch r语言_读入数据_16

R语言GARCH模型预测函数 garch r语言_拟合_17

R语言GARCH模型预测函数 garch r语言_拟合_18

 

R语言GARCH模型预测函数 garch r语言_时序图_19