matlab代寫估計arma garch 條件均值和方差模型


原文鏈接:http://tecdat.cn/?p=3889

此示例顯示如何使用估計復合條件均值和方差模型estimate

加載數據並指定模型。

加載工具箱附帶的NASDAQ數據 。對於數值穩定性,將返回值轉換為收益率。指定AR(1)和GARCH(1,1)復合模型。

 

 

 

 

 

 一個獨立 相同分布的標准化高斯過程。

  1.  
    load Data_EquityIdx
  2.  
    nasdaq = DataTable.NASDAQ;
  3.  
    r = 100*price2ret(nasdaq);
  4.  
    T = length(r);
  5.  
     
  6.  
    Mdl = arima( 'ARLags',1,'Variance',garch(1,1))
  7.  
    Mdl =
  8.  
    arima with properties:
  9.  
     
  10.  
    Description: "ARIMA(1,0,0) Model (Gaussian Distribution)"
  11.  
    Distribution: Name = "Gaussian"
  12.  
    P: 1
  13.  
    D: 0
  14.  
    Q: 0
  15.  
    Constant: NaN
  16.  
    AR: {NaN} at lag [ 1]
  17.  
    SAR: {}
  18.  
    MA: {}
  19.  
    SMA: {}
  20.  
    Seasonality: 0
  21.  
    Beta: [ 0]
  22.  
    Variance: [GARCH( 1,1) Model]

不使用預采樣數據估計模型參數。

 使用estimate。使用estimate自動生成的預采樣觀察。

  1.  
    EstMdl = estimate(Mdl,r);
  2.  
     
  3.  
    ARIMA( 1,0,0) Model (Gaussian Distribution):
  4.  
     
  5.  
    Value StandardError TStatistic PValue
  6.  
    ________ _____________ __________ __________
  7.  
     
  8.  
    Constant 0.072632 0.018047 4.0245 5.7087e-05
  9.  
    AR{ 1} 0.13816 0.019893 6.945 3.7845e-12
  10.  
     
  11.  
     
  12.  
     
  13.  
    GARCH( 1,1) Conditional Variance Model (Gaussian Distribution):
  14.  
     
  15.  
    Value StandardError TStatistic PValue
  16.  
    ________ _____________ __________ __________
  17.  
     
  18.  
    Constant 0.022377 0.0033201 6.7399 1.5852e-11
  19.  
    GARCH{1} 0.87312 0.0091019 95.927 0
  20.  
    ARCH{ 1} 0.11865 0.008717 13.611 3.4339e-42

估計顯示顯示五個估計參數及其對應的標准誤差(AR(1)條件均值模型具有兩個參數,並且GARCH(1,1)條件方差模型具有三個參數)。

擬合模型(EstMdl)是

 

 

 

 

 

所有 統計量都大於2,表明所有參數都具有統計顯着性。

推斷條件差異和殘差。

推斷並繪制條件方差和標准化殘差。 輸出對數似然目標函數值。

  1.  
    [res,v,logL] = infer(EstMdl,r);
  2.  
     
  3.  
    figure
  4.  
    subplot(2,1,1)
  5.  
    plot(v)
  6.  
    xlim([0,T])
  7.  
    title('Conditional Variance')
  8.  
     
  9.  
    subplot(2,1,2)
  10.  
    plot(res./sqrt(v))
  11.  
    xlim([0,T])
  12.  
    title('Standardized Residuals')

在觀察2000之后,條件方差增加。這對應於 看到的增加的波動性。

標准化殘差在標准正態分布下具有比預期更大的值 。 

適應具有創新分布的模型。

修改模型,使其具有Student's t-innovation分布 ,指定方差模型常量項的初始值。

  1.  
    MdlT = Mdl;
  2.  
    MdlT.Distribution = 't';
  3.  
    EstMdlT = estimate(MdlT,r, 'Variance0',{'Constant0',0.001});
  4.  
     
  5.  
    ARIMA( 1,0,0) Model (t Distribution):
  6.  
     
  7.  
    Value StandardError TStatistic PValue
  8.  
    ________ _____________ __________ __________
  9.  
     
  10.  
    Constant 0.093488 0.016694 5.6002 2.1412e-08
  11.  
    AR{ 1} 0.13911 0.018857 7.3771 1.6175e-13
  12.  
    DoF 7.4775 0.88261 8.472 2.4125e-17
  13.  
     
  14.  
     
  15.  
     
  16.  
    GARCH( 1,1) Conditional Variance Model (t Distribution):
  17.  
     
  18.  
    Value StandardError TStatistic PValue
  19.  
    ________ _____________ __________ __________
  20.  
     
  21.  
    Constant 0.011246 0.0036305 3.0976 0.0019511
  22.  
    GARCH{1} 0.90766 0.010516 86.316 0
  23.  
    ARCH{ 1} 0.089897 0.010835 8.2966 1.0712e-16
  24.  
    DoF 7.4775 0.88261 8.472 2.4125e-17

當t分布 時,系數估計值會略有變化。第二個模型擬合(EstMdlT)有一個額外的參數估計,即t分布自由度。估計的自由度相對較小(約為8),表明明顯偏離正常。

比較模型擬合。

使用赤池信息准則(AIC)和貝葉斯信息准則(BIC)比較兩種模型擬合 。首先,獲得第二擬合的對數似然目標函數值。

  1.  
    [resT,vT,logLT] = infer(EstMdlT,r);
  2.  
    [aic,bic] = aicbic([logL,logLT],[ 5,6],T)
  3.  
    aic = 2
  4.  
    103 ×
  5.  
     
  6.  
    9.4929 9.3807
  7.  
     
  8.  
    bic = 2
  9.  
    103 ×
  10.  
     
  11.  
    9.5230 9.4168

第二個模型有六個參數,而第一個模型中有五個參數 。盡管如此,兩個信息標准都支持具有學生t分布的模型。 

 

如果您有任何疑問,請在下面發表評論。 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM