导航

  • 波动率的特征
  • 基本模型
  • ARCH
  • ARCH模型的性质
  • Demo: specify conditional variance model for exchange rates
  • 检测条件异方差
  • GARCH(1, 1)模型
  • Demo: Specify Conditional Mean and Variance Models
  • 设置条件均值和方差模型
  • 参考资料


波动率的特征

波动率无法直接观测,但是可以从资产收益率中观测到一些特征:

  • 波动率聚集(volatility cluster), 在某个特定时间段上波动率高,但是在其他时间段上波动率小
  • 波动率以连续时间方式变化,几乎不存在跳跃的现象
  • 波动率不会发散到无穷,在一个固定范围内变化
  • 波动率对价格大幅上升和大幅下降的反应是不同的,即存在杠杆效应(leverage effect),如EGARCHTGARCH模型就是为了刻画波动率正负资产收益率的不对称性而提出的

基本模型

GARCH模型python运行结果 garch模型对数据的要求_方差表示资产在时刻GARCH模型python运行结果 garch模型对数据的要求_GARCH模型python运行结果_02的对数收益率,研究结果表明,对数收益率序列是前后不相关的,但不是独立的,考虑在给定GARCH模型python运行结果 garch模型对数据的要求_方差_03(filteration)时的条件均值和条件方差
GARCH模型python运行结果 garch模型对数据的要求_GARCH模型python运行结果_04
设置GARCH模型python运行结果 garch模型对数据的要求_方差服从一个简单的ARMA(p, q)模型,GARCH模型python运行结果 garch模型对数据的要求_GARCH_06,其中GARCH模型python运行结果 garch模型对数据的要求_方差_07由以下方程给出
GARCH模型python运行结果 garch模型对数据的要求_时间段_08
可以得到条件异方差模型为
GARCH模型python运行结果 garch模型对数据的要求_时间段_09

条件异方差模型可以分为两类:第一类用确定的函数表示GARCH模型python运行结果 garch模型对数据的要求_GARCH_10,即GARCH模型;第二类用随机方程描述GARCH模型python运行结果 garch模型对数据的要求_GARCH_10,即SV模型

使用Ljung-Box检验序列是否存在异方差

da = read.table('data/m-intcsp7309.txt', header=T)
head(da)

intc = log(da$intc+1)
rtn = ts(intc, frequency = 12, start=c(1973, 1))
plot(rtn, type='l', xlab='year', ylab='ln-rtn') # 绘制时间序列

# 对序列均值进行t检验
t.test(intc)

# 进行Ljung-Box检验
Box.test(intc, lag=12, type='Ljung') # Ljung-Box检验

# plot
par(mfcol=c(2, 1))
acf(intc, lag=24)
acf(abs(intc), lag=24)
Box.test(abs(intc), lag=12, type='Ljung') # 更显著

ARCH

Engle(1982)提出了ARCH模型,模型的基本思想就是:

  1. 资产收益率的扰动序列GARCH模型python运行结果 garch模型对数据的要求_方差_12是前后不相关的,但不是独立的
  2. GARCH模型python运行结果 garch模型对数据的要求_方差_12的不独立性可以使用其滞后值得简单二次函数描述,即ARCH(m)模型设定
    GARCH模型python运行结果 garch模型对数据的要求_GARCH_14
    其中GARCH模型python运行结果 garch模型对数据的要求_时间序列_15是均值为0方差为1的独立同分布(i.i.d)的随机变量序列,其中GARCH模型python运行结果 garch模型对数据的要求_时间序列_16,系数GARCH模型python运行结果 garch模型对数据的要求_GARCH模型python运行结果_17必须满足标准正态分布或者学生GARCH模型python运行结果 garch模型对数据的要求_时间序列_18分布或者广义误差分布(GED),从模型结构上来看,较大的过去的平方扰动GARCH模型python运行结果 garch模型对数据的要求_GARCH_19会导致较大的条件方差GARCH模型python运行结果 garch模型对数据的要求_GARCH_10,从而使得GARCH模型python运行结果 garch模型对数据的要求_方差_12倾向于取绝对值较大的系数,这种结构与波动率聚集的现象一致.

ARCH模型的性质

ARCH(1)模型如下
GARCH模型python运行结果 garch模型对数据的要求_GARCH模型python运行结果_22
计算出GARCH模型python运行结果 garch模型对数据的要求_时间段_23的无条件均值为GARCH模型python运行结果 garch模型对数据的要求_时间序列_24.
计算无条件方差为
GARCH模型python运行结果 garch模型对数据的要求_方差_25
为了研究GARCH模型python运行结果 garch模型对数据的要求_时间段_23的尾部性质,要求GARCH模型python运行结果 garch模型对数据的要求_时间段_23的四阶矩是有限的,当GARCH模型python运行结果 garch模型对数据的要求_时间段_28服从正态分布的条件下可以得到
GARCH模型python运行结果 garch模型对数据的要求_时间序列_29
设置GARCH模型python运行结果 garch模型对数据的要求_时间段_23的四阶矩为平稳,可以计算出峰度(kurtosis)为
GARCH模型python运行结果 garch模型对数据的要求_时间序列_31
可以发现条件高斯ARCH(1)的模型扰动GARCH模型python运行结果 garch模型对数据的要求_时间段_23比高斯白噪声序列更容易出现异常值.
模型中GARCH模型python运行结果 garch模型对数据的要求_方差_33的假设可以放宽,该条件保证对于所有的GARCH模型python运行结果 garch模型对数据的要求_GARCH模型python运行结果_02,条件方差GARCH模型python运行结果 garch模型对数据的要求_GARCH模型python运行结果_35为正值,一种可行的取正值的方式为
GARCH模型python运行结果 garch模型对数据的要求_时间段_36
其中GARCH模型python运行结果 garch模型对数据的要求_时间序列_37是一个GARCH模型python运行结果 garch模型对数据的要求_GARCH_38的非负定矩阵

Demo: specify conditional variance model for exchange rates

读取汇率数据,图像如下

%% load data
load Data_MarkPound.mat
y=Data;
T=length(y);

figure
plot(y)
h=gca;
h.XTick = [1 659 1318 1975];
h.XTickLabel = {'Jan 1984','Jan 1986','Jan 1988','Jan 1992'};
ylabel 'Exchange Rate';
title 'Deutschmark/British Pound Foreign Exchange Rate';

GARCH模型python运行结果 garch模型对数据的要求_时间序列_39


计算回报率序列,图像显示如下

%%
r = price2ret(y); % 计算对数收益率
r2=tick2ret(y);

figure;
plot(2:T, r);
h=gca;
h.XTick = [1 659 1318 1975];
h.XTickLabel = {'Jan 1984','Jan 1986','Jan 1988','Jan 1992'};
ylabel 'Exchange Rate Returns';
title 'Deutschmark/British Pound Foreign Exchange Rate Returns';

GARCH模型python运行结果 garch模型对数据的要求_GARCH模型python运行结果_40


从图像中可以发现收益率序列存在波动性聚集的特征,即存在条件异方差性(conditional heteroscedasticity). 计算自相关函数和偏自相关函数图像如下

%% 在百分制数值状态下观测
r = 100 * r;
figure;
subplot(2, 1, 1);
autocorr(r); % 计算自相关函数
subplot(2, 1, 2);
parcorr(r); % 计算偏自相关函数

GARCH模型python运行结果 garch模型对数据的要求_方差_41


进行Ljung-Box Q-test结果如下

[h, p]=lbqtest(r, 'Lags', [5, 10, 15])

GARCH模型python运行结果 garch模型对数据的要求_时间序列_42


从p值可以得出,ACFPACF没有表现出显著的自相关性,因此序列不需要建立条件均值模型.

检测条件异方差

对收益率序列进行中心化处理后,对序列平方进行ACFPACF检测

%% conditional heteroscedasticity
subplot(2, 1, 1);
autocorr((r-mean(r)).^2);
subplot(2, 1, 2);
parcorr((r-mean(r)).^2);

GARCH模型python运行结果 garch模型对数据的要求_GARCH模型python运行结果_43

从图中发现存在GARCH模型python运行结果 garch模型对数据的要求_GARCH模型python运行结果_44阶截尾的特征,执行Engles’s ARCH检测,设置GARCH模型python运行结果 garch模型对数据的要求_GARCH模型python运行结果_45

[h, p]=archtest(r-mean(r), 'Lags', 2);

从检验结果可以发现,squared returns表现除了显著的自相关性,即GARCH model with lagged variances and lagged squared innovations会更加适合该序列. Engle’s ARCH检测结果拒绝了零假设(h=1),支持ARCH(2)模型等效于GARCH(1, 1)模型.

GARCH(1, 1)模型

基于自相关性和条件异方差,设置带均值偏移(mean offset)的GARCH(1, 1)模型
GARCH模型python运行结果 garch模型对数据的要求_GARCH模型python运行结果_46
其中GARCH模型python运行结果 garch模型对数据的要求_时间段_47
GARCH模型python运行结果 garch模型对数据的要求_方差_48

M = garch('Offset', NaN, 'GARCHLags', 1, 'ARCHLags', 1);

Demo: Specify Conditional Mean and Variance Models

读入NASDAQ数据

load Data_EquityIdx
nasdaq = DataTable.NASDAQ;
r = 100*price2ret(nasdaq);
T = length(r);

figure
plot(r)
xlim([0 T])
title('NASDAQ Daily Returns')

GARCH模型python运行结果 garch模型对数据的要求_GARCH模型python运行结果_49


检测自相关性

%%
figure
subplot(2, 1, 1)
autocorr(r)
subplot(2, 1, 2)
parcorr(r)

GARCH模型python运行结果 garch模型对数据的要求_GARCH_50


进行Ljung-Box检验

[h, p]=lbqtest(r, 'Lags', 5)

拒绝了null hypothesis,表示存在序列自相关
检测序列是否存在条件异方差

%%
figure
subplot(2, 1, 1);
autocorr((r-mean(r)).^2);
subplot(2, 1, 2);
parcorr((r-mean(r)).^2);

GARCH模型python运行结果 garch模型对数据的要求_时间段_51


Engle’s ARCH检测是否存在条件异方差

[h, p]=archtest(r-mean(r), 'lags', 2)

检验结果为接受备择假设,即存在条件异方差

设置条件均值和方差模型

设置AR(1)表示NASDAQ收益率序列的条件均值,GARCH(1, 1)表示条件方差
GARCH模型python运行结果 garch模型对数据的要求_GARCH_52
其中GARCH模型python运行结果 garch模型对数据的要求_时间段_47
GARCH模型python运行结果 garch模型对数据的要求_方差_48

M=arima('ARLags', 1, 'Variance', garch(1, 1))