楼主: 110teddy
59327 94

[问答] 用winrats做dcc-mvgarch出的结果,求解释!   [推广有奖]

61
epoh 发表于 2013-1-13 14:53:24
Pia 发表于 2013-1-13 06:27
epoh老师,你好,我想在正在做的是关于流动性风险的传染问题,想找出s&p500,3M abcp和3M Treasury billde ...
方便的话,数据请用.xls or .csv

62
urmine5683 发表于 2013-1-13 18:17:51
epoh 发表于 2013-1-13 14:53
方便的话,数据请用.xls or .csv
大师  我老师让我做4个序列的  我还是过不去那个关卡。。。用Dynamic Toolbox 2。0 做DCC-Copula

Undefined function 'filtReturnsGARCH' for input arguments of type 'double'.


麻烦您帮我走一下这个数据吧  结果贴一下  真是麻烦您了。。。

如果可以能帮我讲解下得到的CopParams 是什么含义吗。。。 suanli.xls (84 KB)



您给我私信下地址吧  我真是心里面超级感激您 我给您送点我家自己种的正宗铁棍山药啊!!

63
epoh 发表于 2013-1-13 18:59:13
urmine5683 发表于 2013-1-13 18:17
大师  我老师让我做4个序列的  我还是过不去那个关卡。。。用Dynamic Toolbox 2。0 做DCC-Copula

Unde ...
第四个数据有问题,请检查一下数据
你的心意,我心领了.别在意.
%%%%%
data=xlsread('suanli.xls');
data=data*100;
[residuals, UnResiduals,GARCHspec,likelihoods]=filtReturnsGARCH(data,'Gaussian','GARCH', 'CML');

CopulaSpec=setCopulaLLinputs(4)

[CopParams, LogL, StrOutput]=fitCopula(UnResiduals, CopulaSpec)


Mean: ARMAX(0,0,0); Variance: GARCH(1,1)

  Conditional Probability Distribution: Gaussian
  Number of Model Parameters Estimated: 4

                               Standard          T     
  Parameter       Value          Error       Statistic
-----------   -----------   ------------   -----------
           C    -0.034553      0.03632         -0.9513
           K    0.069842       0.02367          2.9507
    GARCH(1)    0.86663        0.032881        26.3568
     ARCH(1)    0.075959       0.01989          3.8189

  Mean: ARMAX(0,0,0); Variance: GARCH(1,1)

  Conditional Probability Distribution: Gaussian
  Number of Model Parameters Estimated: 4

                               Standard          T     
  Parameter       Value          Error       Statistic
-----------   -----------   ------------   -----------
           C    0.058345       0.056334         1.0357
           K    0.21354        0.064157         3.3284
    GARCH(1)    0.81641        0.04019         20.3136
     ARCH(1)    0.11125        0.02779          4.0031

  Mean: ARMAX(0,0,0); Variance: GARCH(1,1)

  Conditional Probability Distribution: Gaussian
  Number of Model Parameters Estimated: 4

                               Standard          T     
  Parameter       Value          Error       Statistic
-----------   -----------   ------------   -----------
           C    0.00035568     0.046248         0.0077
           K    0.078873       0.030055         2.6243
    GARCH(1)    0.87508        0.03086         28.3560
     ARCH(1)    0.088385       0.02145          4.1205

  Mean: ARMAX(0,0,0); Variance: GARCH(1,1)

  Conditional Probability Distribution: Gaussian
  Number of Model Parameters Estimated: 4

                               Standard          T     
  Parameter       Value          Error       Statistic
-----------   -----------   ------------   -----------
           C    0.047395       0.059229         0.8002
           K    0.80247        7870.1           0.0001
    GARCH(1)    0.61741        3752.2           0.0002
     ARCH(1)    0              0.0097388        0.0000

CopulaSpec =

             ll: 'copula'
           type: 'Gaussian'
        depspec: 'DCC'
      optimizer: 'fmincon'
    derivatives: 'on'

the parameters vector is a 2x1 vector

                                Max     Line search  Directional  First-order
Iter F-count        f(x)   constraint   steplength   derivative   optimality Procedure
    0      3     -316.389      -0.0042                                         
    1      6     -323.865   1.102e-017            1         2.95    2.35e+003   
    2      9     -325.968            0            1          1.8         96.5   
    3     13     -327.873     -0.04021          0.5        -7.09         26.2   
    4     17     -329.962     -0.03994          0.5        -3.54         63.1  Hessian modified  
    5     22     -330.211     -0.03985         0.25        0.225          114   
    6     26     -330.863     -0.01992          0.5            2          112   
    7     29     -330.959     -0.02616            1        0.158         19.8   
    8     32     -330.978     -0.02703            1        0.091         32.3   
    9     35     -331.004     -0.02504            1      0.00794          4.4   
   10     38     -331.005     -0.02522            1    3.65e-006       0.0289   
Optimization terminated: magnitude of directional derivative in search
direction less than 2*options.TolFun and maximum constraint violation
  is less than options.TolCon.
No active inequalities.
succesfull optimization!

CopParams =

    0.0253
    0.8532


LogL =

  331.0049


StrOutput =

          Hessian: [2x2 double]
         Gradient: [2x1 double]
         exitflag: 5
    timeinseconds: 5.4645

64
urmine5683 发表于 2013-1-13 19:10:15
epoh 发表于 2013-1-13 18:59
第四个数据有问题,请检查一下数据
你的心意,我心领了.别在意.
%%%%%
啊 那换一组吧。。
真心麻烦了。。。

大师有空帮忙解释下。。。 suanli.xls (84 KB)

65
Pia 发表于 2013-1-13 19:22:35
epoh 发表于 2013-1-13 14:53
方便的话,数据请用.xls or .csv
老师,这是重新上传的数据和代码,我我后面一步还需要对这个做这个dcc-garch系数的检验,因为研究的是金融危机期间,所以后面需要修改模型,加入dummy,来考虑结构性断裂的情况,但是这一块我不懂要怎么做,老师给指点一下?

code1.txt
下载链接: https://bbs.pinggu.org/a-1251222.html

733 Bytes

data1.xls

34.5 KB

66
epoh 发表于 2013-1-13 19:44:48
urmine5683 发表于 2013-1-13 19:10
啊 那换一组吧。。
真心麻烦了。。。
Mean: ARMAX(0,0,0); Variance: GARCH(1,1)

  Conditional Probability Distribution: Gaussian
  Number of Model Parameters Estimated: 4

                               Standard          T     
  Parameter       Value          Error       Statistic
-----------   -----------   ------------   -----------
           C    -0.034553      0.03632         -0.9513
           K    0.069842       0.02367          2.9507
    GARCH(1)    0.86663        0.032881        26.3568
     ARCH(1)    0.075959       0.01989          3.8189

  Mean: ARMAX(0,0,0); Variance: GARCH(1,1)

  Conditional Probability Distribution: Gaussian
  Number of Model Parameters Estimated: 4

                               Standard          T     
  Parameter       Value          Error       Statistic
-----------   -----------   ------------   -----------
           C    0.058345       0.056334         1.0357
           K    0.21354        0.064157         3.3284
    GARCH(1)    0.81641        0.04019         20.3136
     ARCH(1)    0.11125        0.02779          4.0031

  Mean: ARMAX(0,0,0); Variance: GARCH(1,1)

  Conditional Probability Distribution: Gaussian
  Number of Model Parameters Estimated: 4

                               Standard          T     
  Parameter       Value          Error       Statistic
-----------   -----------   ------------   -----------
           C    0.00035568     0.046248         0.0077
           K    0.078873       0.030055         2.6243
    GARCH(1)    0.87508        0.03086         28.3560
     ARCH(1)    0.088385       0.02145          4.1205

  Mean: ARMAX(0,0,0); Variance: GARCH(1,1)

  Conditional Probability Distribution: Gaussian
  Number of Model Parameters Estimated: 4

                               Standard          T     
  Parameter       Value          Error       Statistic
-----------   -----------   ------------   -----------
           C    -0.016353      0.042634        -0.3836
           K    0.064209       0.023029         2.7882
    GARCH(1)    0.89282        0.027858        32.0491
     ARCH(1)    0.067094       0.017131         3.9165

CopulaSpec =

             ll: 'copula'
           type: 'Gaussian'
        depspec: 'DCC'
      optimizer: 'fmincon'
    derivatives: 'on'

the parameters vector is a 2x1 vector

                                Max     Line search  Directional  First-order
Iter F-count        f(x)   constraint   steplength   derivative   optimality Procedure
    0      3     -319.653      -0.0042                                         
    1     10     -320.624     -0.01622       0.0625         72.5    1.71e+003   
    2     18     -322.522     -0.03319       0.0313         33.7          223   
    3     21     -323.583     -0.02758            1       -0.973         57.4   
    4     25     -324.026     -0.02217          0.5        0.866          208   
    5     29       -324.2     -0.01882          0.5         0.25         43.2   
    6     32     -324.203      -0.0205            1       0.0329          7.1   
    7     35     -324.214     -0.01977            1      0.00252         8.37   
    8     38     -324.214     -0.01971            1     0.000252         1.99   
    9     41     -324.214     -0.01973            1   -2.97e-007        0.011   
Optimization terminated: magnitude of directional derivative in search
direction less than 2*options.TolFun and maximum constraint violation
  is less than options.TolCon.
No active inequalities.
succesfull optimization!

CopParams =

    0.0198
    0.9566


LogL =

  324.2140


StrOutput =

          Hessian: [2x2 double]
         Gradient: [2x1 double]
         exitflag: 5
    timeinseconds: 4.9712
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
urmine5683 + 1 + 1 + 1 太感谢大师了!

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

67
xina2 发表于 2013-2-23 18:52:37
epoh 发表于 2013-1-13 14:53
方便的话,数据请用.xls or .csv
亲爱的epoh老师:
       我现在做HS300股指期货与现货市场之间的波动溢出效应基于DCC-mvgarch,现在用rats跑出的程序得不到他们之间的时相关系数图,请您看看错在哪,谢谢。
code:

calendar
open data "D:\123\1.xls"
all 677
data(format=xls,org=columns)
set rs =log(S/S{1})
set rf =log(F/F{1})
system(model=var2)
variables rf rs
lags 2
det constant
end(system)
estimate
garch(p=1,q=1,model=var2,variances=varma,mv=dcc,method=bfgs,iters=200,pmethod=simplex,piters=20,hmatrices=hh,rvectors=rd,distrib=t)

SET rho12=hh(t)(1,2)/sqrt(hh(t)(1,1)*hh(t)(2,2))
graph(header="Correlation of rs with rf")
# rho12



结果:
MV_GARCH, DCC - Estimation by BFGS
Convergence in   116 Iterations. Final criterion was  0.0000000 <=  0.0000100
Usable Observations    673
Log Likelihood                    4687.56091043

   Variable                     Coeff       Std Error      T-Stat     Signif
*******************************************************************************
1.  RF{2}                     0.101051369  0.096904607      1.04279  0.29704454
2.  RS{2}                    -0.095903294  0.093981322     -1.02045  0.30751482
3.  Constant                 -0.000511704  0.000421193     -1.21489  0.22440750
4.  RF{2}                     0.060138106  0.103521146      0.58093  0.56129046
5.  RS{2}                    -0.071200321  0.100519812     -0.70832  0.47874577
6.  Constant                 -0.000398511  0.000445113     -0.89530  0.37062573
7.  C(1)                     -0.000004406  0.000015938     -0.27643  0.78221593
8.  C(2)                      0.000117704  0.000031127      3.78146  0.00015591
9.  A(1,1)                    0.205945288  0.072011458      2.85990  0.00423780
10. A(1,2)                   -0.140697216  0.068794302     -2.04519  0.04083642
11. A(2,1)                    0.200367584  0.070861246      2.82760  0.00468977
12. A(2,2)                   -0.156076700  0.060007148     -2.60097  0.00929610
13. B(1,1)                    0.162188924  0.311615107      0.52048  0.60273020
14. B(1,2)                    0.812198458  0.389425290      2.08563  0.03701183
15. B(2,1)                    2.251965599  0.317996740      7.08173  0.00000000
16. B(2,2)                   -1.699805811  0.225693563     -7.53148  0.00000000
17. DCC(1)                    0.087020104  0.035390105      2.45888  0.01393703
18. DCC(2)                    0.188500415  0.197527635      0.95430  0.33993234
19. Shape                     5.110394618  0.680558790      7.50912  0.00000000

## SX22. Expected Type SERIES, Got REAL Instead
>>>>,1))*(hh(t)(2,2)))<<<<



1.xls (54.5 KB)

问题:## SX22. Expected Type SERIES, Got REAL Instead>>>>,1))*(hh(t)(2,2)))<<<<

这是什么意思啊。。。。

http://www.ccmedu.com/blog/UploadFile/9689/2008-4/2008451715617142.jpg

68
epoh 发表于 2013-2-23 19:51:06
xina2 发表于 2013-2-23 18:52
亲爱的epoh老师:
       我现在做HS300股指期货与现货市场之间的波动溢出效应基于DCC-mvgarch,现在用r ...
open data 1.xls
data(format=xls,org=columns) 1 676 S F
set rs =100*log(S/S{1})
set rf =100*log(F/F{1})
system(model=var2)
variables rf rs
lags 2
det constant
end(system)
estimate
garch(p=1,q=1,model=var2,variances=varma,mv=dcc,method=bfgs,iters=200,pmethod=simplex,piters=20,hmatrices=hh,rvectors=rd,distrib=t) / rf rs

set rho  = hh(t)(1,2)/sqrt(hh(t)(1,1)*hh(t)(2,2))
graph(header="Correlation of rs with rf") 1
# rho
xina_dccr.jpg

69
xina2 发表于 2013-2-23 19:57:34
epoh 发表于 2013-2-23 19:51
open data 1.xls
data(format=xls,org=columns) 1 676 S F
set rs =100*log(S/S{1})
老师,您好:、
非常谢谢您,为什么我复制您的程序结果出现:## MAT15. Subscripts Too Large or Non-Positive

这是什么意思啊,还有,我该怎么取得残差和取平方的Ljung-Box检验结果。
下面这个程式对吗:

calendar
open data "D:\123\1.xls"
all 677
data(format=xls,org=columns)
set rs =log(S/S{1})
set rf =log(F/F{1})
system(model=var2)
variables rf rs
lags 2
det constant
end(system)
estimate
garch

(p=1,q=1,model=var2,variances=varma,mv=dcc,method=bfgs,iters=200,pmethod=simplex,piters

=20,hmatrices=hh,rvectors=rd,distrib=t)

set z1 = rd(t)(1)/sqrt(hd(t)(1,1))
set z2 = rd(t)(2)/sqrt(hd(t)(2,2))

@bdindtests(number=40) z1
@bdindtests(number=40) z2

set rho12=hh(t)(1,2)/sqrt(hh(t)(1,1)*hh(t)(2,2))
graph(header="Correlation of rs with rf")
# rho12






http://www.ccmedu.com/blog/UploadFile/9689/2008-4/2008451715617142.jpg

70
keqf 发表于 2013-3-6 21:46:34
求epoh老师解答楼上问题啊

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-31 21:03