有没有fminsearch参数太多?

时间:2014-06-28 08:29:15

标签: matlab parameters estimation fminsearch

我在matlab中运行此代码,以使用fminsearch最小化我的函数real_egarchpartial的参数:

data = xlsread('return_cc_in.xlsx');
SPY = data(:,25);

    dailyrange = xlsread('DR_in.xlsx');
    drSPY= dailyrange(:,28);
    startingVals = [mean(SPY); 0.041246; 0.70121; 0.05; 0.04; 0.45068; -0.1799; 1.0375; 0.06781; 0.070518];
    T = size(SPY,1);

    options = optimset('fminsearch');
    options.Display = 'iter';

    estimates = fminsearch(@real_egarchpartial, startingVals, options, SPY, drSPY);

    [ll, lls, u]=real_egarchpartial(estimates, SPY, drSPY);

我收到了这条消息:

Exiting: Maximum number of function evaluations has been exceeded
         - increase MaxFunEvals option. 

我把原始的起始值。所以我认为他们是纠正的。我使用fminsearch而不是fmincon,因为我的函数没有约束,而使用fminunc我的函数会得到很多红色消息。 real_egarchpartial函数如下:

function [ll,lls,lh] = real_egarchpartial(parameters, data, x_rk)
mu = parameters(1);
omega = parameters(2);
beta = parameters(3);
tau1 = parameters(4);
tau2 = parameters(5);
gamma = parameters(6);
csi = parameters(7);
phi = parameters(8);
delta1 = parameters(9);
delta2 = parameters(10);

%Data and h are T by 1 vectors
T = size(data,1);
eps = data-mu;
lh = zeros(T,1);
h = zeros(T,1);
u = zeros(T,1);

%Must use a back Cast to start the algorithm
h(1)=var(data);
lh(1) = log(h(1));
z= eps/sqrt(h(1));
u(1) = rand(1);

lxRK = log(x_rk);
for t = 2:T;
   lh(t) = omega + beta*lh(t-1) + tau1*z(t-1) + tau2*((z(t-1).^2)-1)+ gamma*u(t-1);
   h(t)=exp(lh(t));
   z = eps/sqrt(h(t));
end
for t = 2:T
    u(t)= lxRK(t) - csi - phi*h(t) - delta1*z(t) - delta2*((z(t).^2)-1);
end 
lls = 0.5*(log(2*pi) + lh + eps.^2./h);
ll = sum(lls);

有人可以解释什么是错的吗?还有其他功能对我的估计更有效吗?任何帮助将不胜感激!谢谢。

0 个答案:

没有答案