全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 MATLAB等数学软件专版
6274 4
2009-10-05
再现我的过程要下的代码。
7. Copula toolbox for Matlab, version 1.07, 5apr08( http://econ.duke.edu/~ap172/
1. James LeSage's Econometrics Toolbox for Matlab
http://econ.duke.edu/~ap172/ )->( http://www.spatial-econometrics.com/html/jplv7.zip  )

我在尝试运行Andrew Patton's Matlab code 的 Copula toolbox for Matlab,出现fmincon的错误。
我是把“7. Copula toolbox for Matlab, version 1.07, 5apr08” 中的“copula_example_code.m”
的代码一段一段剪切出来尝试运行,但是出现了错,我剪切代码如下:
-------------------------------------------------------------------------------------------
% Example code for some copula functions
%
%  Andrew Patton
%
%  27 February 2006
load 'D:\MATLAB7\work\copulas\Patton_copula_toolbox\ibm_ccola_rets.txt' -ascii;
ibm = ibm_ccola_rets(:,1);
ccola = ibm_ccola_rets(:,2);
size(ibm)
size(ccola)
%xycdata = [ibm ccola];
% exceedence correlations
inc = 0.025;
qq = (0.1:inc:0.9)';
qq2 = [(0.1:inc:0.5)';(0.5:inc:0.9)'];
temp1 = ang_chen1(ibm,ccola,qq);
%figure(1),plot(qq2,temp1,'o-')

% quantile dependence
temp2 = quantiledep(ibm,ccola,qq);
%figure(2),plot(qq,temp2,'o-');

% obtaining Unif(0,1) data
% NOTE: for this example I will just use the empirical cdf to transform the
% data, but in practice this is the step where a model for the conditional
% (marginal) densities would be used: conditional means, variances and
% distributions.
u = empiricalcdf(ibm);
v = empiricalcdf(ccola);
size(u)
size(v)
T = length(u)
% dropping the first few so we have an even 2500 observations
u = u(end-2499:end);
v = v(end-2499:end);
T = length(u)
% estimating some copula models
options = optimset('Display','iter','TolCon',10^-12,'TolFun',10^-4,'TolX',10^-6);
% 1. Normal Copula
%kappa1 = corrcoef12(norminv(u),norminv(v))
%LL1 = NormalCopula_CL(kappa1,[u,v])   
% 3. Rotated Clayton copula (with tail dep in upper tail instead of lower)
lower = 0.0001;
theta0 = 1;
[ kappa3 LL3] = fmincon('claytonCL',theta0,[],[],[],[],lower,[],[],options,1-[u,v]);
-------------------------------------------------------------------------------------
错误如下:
Warning: Large-scale (trust region) method does not currently solve this type of problem,
switching to medium-scale (line search).
> In fmincon at 260
  In xyc at 56
                               max                   Directional   First-order
Iter F-count        f(x)   constraint    Step-size   derivative   optimality Procedure
    0      2      289.506      -0.9999                                         
    1      5   -0.0421611   1.102e-017            1          421    1.15e+003   
    2      8     -17.9441      -0.3667            1         73.1          199   
    3     11     -33.6105      -0.2489            1        -7.44         63.2   
    4     14     -35.1281      -0.1943            1        0.484         8.86   
    5     17     -35.1563       -0.201            1      0.00289         0.43   
    6     20     -35.1564      -0.2007            1   -9.43e-007      0.00303   
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
--------------------------------------------------------------------------------------
个人感觉应该是:options = optimset('Display','iter','TolCon',10^-12,'TolFun',10^-4,'TolX',10^-6);
和[ kappa3 LL3] = fmincon('claytonCL',theta0,[],[],[],[],lower,[],[],options,1-[u,v]);
出错了。
由于刚开始学习MATLAB,所以还不能很好的定位错误,不知哪位前辈能给我些指点。
在下不慎感谢。
二维码

扫码加我 拉你入群

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

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

全部回复
2009-10-5 10:56:37
load 'D:\MATLAB7\work\copulas\Patton_copula_toolbox\ibm_ccola_rets.txt' -ascii;
在 7. Copula toolbox for Matlab, version 1.07, 5apr08( http://econ.duke.edu/~ap172/ )压缩包中有,
只是下载后要指点自己的目录。
二维码

扫码加我 拉你入群

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

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

2009-10-5 10:56:54
load 'D:\MATLAB7\work\copulas\Patton_copula_toolbox\ibm_ccola_rets.txt' -ascii;
在 7. Copula toolbox for Matlab, version 1.07, 5apr08( http://econ.duke.edu/~ap172/ )压缩包中有,
只是下载后要指点自己的目录。
二维码

扫码加我 拉你入群

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

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

2012-4-2 23:22:30
这个问题解决了没有啊
二维码

扫码加我 拉你入群

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

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

2017-5-21 20:29:02
quarky 发表于 2009-10-5 10:56
load 'D:\MATLAB7\work\copulas\Patton_copula_toolbox\ibm_ccola_rets.txt' -ascii;
在 7. Copula toolbo ...
老师您好~~我想请问一下Patton-copula-toolbox的解释说明有么~介绍如何使用copula工具箱,在哪里可以找到么   

二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群