楼主: sarah89323
16929 72

[问答] 跪求CKLS GMM法参数估计T_T [推广有奖]

61
sarah89323 发表于 2011-9-30 05:56:03
epoh 发表于 2011-9-7 07:57
画图条件变更:  %%%%%
1.Rolling window VaR and ETL calculations. page 4/5    http://www.fea.com/reso ...
我的第一个分耶, thxs!

最近都在忙CFA, 没有怎么来论坛逛逛,你一切可好?

sarah

62
epoh 发表于 2011-9-30 10:42:07
Sarah,がんばれ、CFA试験合格するように!

63
hhftheone 在职认证  发表于 2011-11-24 23:16:17
学习一下
路过的风景就不再回头

64
hhftheone 在职认证  发表于 2011-11-24 23:16:27
学习一下
路过的风景就不再回头

65
小洁子wj 发表于 2012-3-21 17:55:46
epoh 发表于 2011-8-31 23:15
先改一个供你参考,结果跟ini_P息息相关.%%%%%%%%%%%
load ckls.dat
data=ckls;
为什么我的上面显示是:“Error: "CKLS_Calibration" is not the name of a function nor a variable,
but is used in an anonymous function either at the prompt or in the argument of EVAL.”???

66
epoh 发表于 2012-3-21 19:14:11
小洁子wj 发表于 2012-3-21 17:55
为什么我的上面显示是:“Error: "CKLS_Calibration" is not the name of a function nor a variable,
  ...
CKLS_Calibration.m
是楼主提供的,所以你没有

67
小洁子wj 发表于 2012-3-21 20:09:46
epoh 老师能否提示一下,不是很懂
我们以前只是用SAS处理些简单的时间序列问题,对matlab不是很懂,谢谢

68
Vea浅唱 发表于 2012-3-23 11:01:52
我按楼主的方法操作了一遍,为什么P没有定义??? Undefined function or variable 'P'.

69
Vea浅唱 发表于 2012-3-23 11:05:38
已经调用了6个子函数,谁能帮忙看看还有哪些错误,谢谢各位了
%Main program
function model()
load CKLS.txt
X=CKLS;
dt=1/242;
% option settings for optimization algorithm
opts=optimset( 'Display',             'notify', ...
                    'MaxIter',              1000,   ...
                    'MaxFunEvals',          10000,   ...
                    'LargeScale',           'off',  ...
                    'HessUpdate',           'bfgs', ...
                    'TolX',                 1e-8,   ...
                    'TolFun',               1e-11   ...
                       );   
ini_P=rand(4,1);%initial parameters [alpha,beta,sigma,gamma] as a vector.
low_P=-100*ones(4,1);%lower bounds of parameters
up_P=100*ones(4,1);%upper bounds of parameters
low_P2=[-400;0;-400;0];     % parameter restriction for Merton
up_P2=[400;0;400;0];
low_P3=[-400;-400;-400;0];  %parameter restriction for Vasicek
up_P3=[400;400;400;0];
low_P4=[-400;-400;-400;0.5];%parameter restriction for CIR
up_P4=[400;400;400;0.5];
low_P5=[0;-400;0;1];        %parameter restriction for Dothan
up_P5=[0;400;400;1];
low_P6=[-400;-400;-400;1];  %parameter restriction for Brennan and Schwartz
up_P6=[400;400;400;1];
% P is parameters estimation
% lnL is minus maximized likelihood value
[P1,lnL1]=fmincon(CKLS_Calibration(P,X,dt),ini_P,[],[],[],[],low_P,up_P,opts);
[P2,lnL2]=fmincon(Merton_Calibration(P,X,dt),ini_P,[],[],[],[],low_P,up_P,[],opts);
[P3,lnL3]=fmincon(Vasicek_Calibration(P,X,dt),ini_P,[],[],[],[],low_P,up_P,[],opts);
[P4,lnL4]=fmincon(CIR_Calibration(P,X,dt),ini_P,[],[],[],[],low_P,up_P,[],opts);
[P5,lnL5]=fmincon(Dothan_Calibration(P,X,dt),ini_P,[],[],[],[],low_P5,up_P5,[],opts)
[P6,lnL6]=fmincon(Brennan_Schwartz_Calibration(P,X,dt),ini_P,[],[],[],[],low_P,up_P,[],opts);

end
% end main program

70
jimjohn 发表于 2012-5-2 00:34:13
vasicek 压缩文件的密码可以悄悄告诉一下吗?万分谢谢!

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-3 04:43