此示例顯示如何使用估計復合條件均值和方差模型estimate
。
加載數據並指定模型。
加載工具箱附帶的NASDAQ數據 。對於數值穩定性,將返回值轉換為收益率。指定AR(1)和GARCH(1,1)復合模型。
一個獨立 相同分布的標准化高斯過程。
-
load Data_EquityIdx
-
nasdaq = DataTable.NASDAQ;
-
r = 100*price2ret(nasdaq);
-
T = length(r);
-
-
Mdl = arima( 'ARLags',1,'Variance',garch(1,1))
-
Mdl =
-
arima with properties:
-
-
Description: "ARIMA(1,0,0) Model (Gaussian Distribution)"
-
Distribution: Name = "Gaussian"
-
P: 1
-
D: 0
-
Q: 0
-
Constant: NaN
-
AR: {NaN} at lag [ 1]
-
SAR: {}
-
MA: {}
-
SMA: {}
-
Seasonality: 0
-
Beta: [ 1×0]
-
Variance: [GARCH( 1,1) Model]
不使用預采樣數據估計模型參數。
使用estimate
。使用estimate
自動生成的預采樣觀察。
-
EstMdl = estimate(Mdl,r);
-
-
ARIMA( 1,0,0) Model (Gaussian Distribution):
-
-
Value StandardError TStatistic PValue
-
________ _____________ __________ __________
-
-
Constant 0.072632 0.018047 4.0245 5.7087e-05
-
AR{ 1} 0.13816 0.019893 6.945 3.7845e-12
-
-
-
-
GARCH( 1,1) Conditional Variance Model (Gaussian Distribution):
-
-
Value StandardError TStatistic PValue
-
________ _____________ __________ __________
-
-
Constant 0.022377 0.0033201 6.7399 1.5852e-11
-
GARCH{1} 0.87312 0.0091019 95.927 0
-
ARCH{ 1} 0.11865 0.008717 13.611 3.4339e-42
估計顯示顯示五個估計參數及其對應的標准誤差(AR(1)條件均值模型具有兩個參數,並且GARCH(1,1)條件方差模型具有三個參數)。
擬合模型(EstMdl
)是
所有 統計量都大於2,表明所有參數都具有統計顯着性。
推斷條件差異和殘差。
推斷並繪制條件方差和標准化殘差。 輸出對數似然目標函數值。
-
[res,v,logL] = infer(EstMdl,r);
-
-
figure
-
subplot(2,1,1)
-
plot(v)
-
xlim([0,T])
-
title('Conditional Variance')
-
-
subplot(2,1,2)
-
plot(res./sqrt(v))
-
xlim([0,T])
-
title('Standardized Residuals')
在觀察2000之后,條件方差增加。這對應於 看到的增加的波動性。
標准化殘差在標准正態分布下具有比預期更大的值 。
適應具有創新分布的模型。
修改模型,使其具有Student's t-innovation分布 ,指定方差模型常量項的初始值。
-
MdlT = Mdl;
-
MdlT.Distribution = 't';
-
EstMdlT = estimate(MdlT,r, 'Variance0',{'Constant0',0.001});
-
-
ARIMA( 1,0,0) Model (t Distribution):
-
-
Value StandardError TStatistic PValue
-
________ _____________ __________ __________
-
-
Constant 0.093488 0.016694 5.6002 2.1412e-08
-
AR{ 1} 0.13911 0.018857 7.3771 1.6175e-13
-
DoF 7.4775 0.88261 8.472 2.4125e-17
-
-
-
-
GARCH( 1,1) Conditional Variance Model (t Distribution):
-
-
Value StandardError TStatistic PValue
-
________ _____________ __________ __________
-
-
Constant 0.011246 0.0036305 3.0976 0.0019511
-
GARCH{1} 0.90766 0.010516 86.316 0
-
ARCH{ 1} 0.089897 0.010835 8.2966 1.0712e-16
-
DoF 7.4775 0.88261 8.472 2.4125e-17
當t分布 時,系數估計值會略有變化。第二個模型擬合(EstMdlT
)有一個額外的參數估計,即t分布自由度。估計的自由度相對較小(約為8),表明明顯偏離正常。
比較模型擬合。
使用赤池信息准則(AIC)和貝葉斯信息准則(BIC)比較兩種模型擬合 。首先,獲得第二擬合的對數似然目標函數值。
-
[resT,vT,logLT] = infer(EstMdlT,r);
-
[aic,bic] = aicbic([logL,logLT],[ 5,6],T)
-
aic = 1×2
-
103 ×
-
-
9.4929 9.3807
-
-
bic = 1×2
-
103 ×
-
-
9.5230 9.4168
第二個模型有六個參數,而第一個模型中有五個參數 。盡管如此,兩個信息標准都支持具有學生t分布的模型。