楼主: csfe
18386 36

[求助]关于Markov regime switching Garch [推广有奖]

  • 1关注
  • 0粉丝

讲师

8%

还不是VIP/贵宾

-

威望
0
论坛币
40 个
通用积分
0.0600
学术水平
2 点
热心指数
8 点
信用等级
3 点
经验
17248 点
帖子
442
精华
0
在线时间
346 小时
注册时间
2008-10-11
最后登录
2015-8-10

楼主
csfe 发表于 2009-5-20 15:53:00 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

各位,请问你们有没有运行过Marcucci写的一个关于Markov状态转换GARCH的程序,在运行的时候,总会出现数据类型不匹配的错误,如下所示:

??? Subscripted assignment dimension mismatch.
Error in ==> mrsgarchestfor_con_all at 302
        Parameters(:,index+1,2) = GRAD(:);

请问哪位高手知道这是怎么回事啊?谢谢大家了。

 附近中是该程序和我用的数据。

327495.zip (207.59 KB)
327496.txt (31.51 KB)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:switching Markov regime switch GARCH GARCH Markov regime switching

立志在金融业里发展

沙发
ttt413 发表于 2009-6-28 18:18:33
他的程序是错误 的,我调整后发现仍然不能运行,请不要再下载和发布这个程序误人子弟了。

藤椅
ttt413 发表于 2009-6-28 18:20:07
有的人还把这个程序发布出来,以为自己了不得,实际上是有错的,我已经检验过了,也向作者咨询了,作者承认出错了。

板凳
tulipsliu 在职认证  发表于 2011-5-16 15:37:43
3# ttt413 郁闷啊,既然是错的,作者为什么不更改啊。
昨晚我还跑了一遍。我去年在论坛遇到一个朋友,也是讨论这个程序的问题的。结果今天才看到2009年,你们都在说这个程序问题太严重。
昨晚我先用mex生成mex32函数后再跑的,速度是快了点,不过才跑了第一个循环,也出现如这个帖子说的,在那一行的赋值里出现问题,特别郁闷。
劳动经济学

报纸
epoh 发表于 2011-5-16 19:01:26
老兄你说的问题,作者听到了.
Updated MRS-GARCH Matlab code (January 2011)
http://sites.google.com/site/jur ... or-mrsgarch-program

地板
tulipsliu 在职认证  发表于 2011-5-16 19:28:59
5# epoh 哥们儿,你终于出现了。我遇到的问题不是他这个程序的问题。
其实是抽样计算的问题。帮朋友改代码,其实不是GARCH模型,要是可以透露,我都把朋友要求的全部写出。郁闷的是,我只能说遇到了MCMC算法的问题,却不能给出太多细节。
对了,好像我的进不去你们发的网址,可以将这个人更新的代码和数据的压缩包发到我的邮箱不,不胜感激。
email:   xudongliu.bird@163.com

好像是比较为难的要求,又想问MCMC算法问题,又不能贴出朋友那个模型的要求,看来是不实际的,今天朋友又发过来新的代码,是朋友的朋友给的。呵呵。
诶,有机会再问其他的问题吧。这个只有再看看了。
劳动经济学

7
epoh 发表于 2011-5-16 20:04:26
In the current updated versions I have fixed these and other minor problems.
I have tested both codes (for GARCH models and for MRS-GARCH models)
with different versions of Matlab (2008a, 2009a, 2010a) and
on different platforms (Windows, Linux/Max) and they work fine.
Be aware that, to reduce computing times, for the MRS-GARCH model
you might want to change max_st_v to have a lower number of
starting values and/or change the main loop (line 37)
   
for errortype = [1 2 4 5];
with for errortype = [k]; where k=(1,2,4,5) to estimate one model at a time.

Updated Matlab main programs:
mrsgarchestfor_con_all.m
mrsgarchestfor_con_all.rar (4.52 KB) 本附件包括:
  • mrsgarchestfor_con_all.m


garchestfor_con_all.m
garchestfor_con_all.rar (4.3 KB) 本附件包括:
  • garchestfor_con_all.m



%%%%%%%%%%%%
Old instructions to fix the typos in the MRS-GARCH Matlab code
%%%%%%%%%%%%
There are a couple of typos in the programs downloadable from the SNDE
website that should be fixed. For some unknown reasons a few lines came up
unnecessarily commented or didn't appear at all. Please, follow these
instructions and everything should work just fine:
Replace in the main program the following lines after the fmincon call
[...]
% ADDED THE FOLLOWING 2 LINES FOR STD ERR WITH HESSIAN FROM
% OPTIMIZATION. they were disappeared and I don't know why
stder_HESS = sqrt(diag((HESSIAN)^(-1)));
tstat_HESS = parameters./stder_HESS;

[...]

... after se_rob_hess
[...]
%%%%%%%%%%%%%%%%%%%%%%%%%
% ADDED THE FOLLOWING 3 LINES FOR SE_rob_HESS
A2=(1/T)*HESSIAN;
SE_rob_HESS=sqrt((1/T)*diag((A2^(-1))*B*(A2^(-1)))); % hessian from OPTIMIZATION
tstat_HESS_rob = parameters./SE_rob_HESS; % hessian from calculation

[...]
... after tstats

[...]

tstats = parameters./stderrors;
% Printing everything % COMMENTED THE NEXT 5 LINES. THEY WOULD
WRONGLY SET THE GRAD, STDER AND TSTAT TO [] BEFORE STORING THEM!
%GRAD=[];
%stder_HESS=[];
%SE_rob_HESS=[];
%tstat_HESS=[];
%tstat_HESS_rob=[];
If you don't do that, you can get an error because before storing the values,
GRAD and the other values are wrongly set to [].
With these corrections, everything should work. Also, you should change the matrix
called Parameters in such a way that it can store vectors with different lengths
otherwise you will get another error (the dimension mismatch error).
It's sufficient to set the number of columns of Parameters to the maximum number
of parameters. After fixing this everything should work.
已有 2 人评分学术水平 热心指数 信用等级 收起 理由
ywh19860616 + 1 + 1 + 1 非常精彩
Henryzhu + 1 + 1 + 1 精彩帖子

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

8
tulipsliu 在职认证  发表于 2011-5-16 20:23:20
7# epoh 多谢,我改改试试。
劳动经济学

9
linrt 发表于 2011-5-22 16:14:59
还是没有搞懂这个程序。

10
linrt 发表于 2011-5-22 17:30:05
这个m文件里面有个函数swgarchlik  我matlab里面没有 这个函数是什么

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

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