楼主: quarky
6318 4

fmincon 函数问题 [推广有奖]

  • 0关注
  • 11粉丝

VIP

已卖:770份资源

硕士生

88%

还不是VIP/贵宾

-

威望
0
论坛币
894 个
通用积分
378.4621
学术水平
6 点
热心指数
9 点
信用等级
5 点
经验
1968 点
帖子
114
精华
0
在线时间
278 小时
注册时间
2006-5-3
最后登录
2024-4-6

楼主
quarky 发表于 2009-10-5 10:54:01 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
再现我的过程要下的代码。
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,所以还不能很好的定位错误,不知哪位前辈能给我些指点。
在下不慎感谢。
二维码

扫码加我 拉你入群

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

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

关键词:fmincon FMI con Inc Min 函数 fmincon

沙发
quarky 发表于 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/ )压缩包中有,
只是下载后要指点自己的目录。

藤椅
quarky 发表于 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/ )压缩包中有,
只是下载后要指点自己的目录。

板凳
kandy63 发表于 2012-4-2 23:22:30
这个问题解决了没有啊

报纸
yikemi 发表于 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工具箱,在哪里可以找到么   

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

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