我正在尝试估计以下函数的参数:
u = log(x) - ω - φ*(log(h)) - δ1*z - δ2*(z^2-1)
我在 matlab 中使用 fminsearch 函数,代码如下:
data = xlsread('return_oc_out.xlsx');
a = data(:,25);
kernel = xlsread('RK_out.xlsx');
rkAA= kernel(:,25);
startingVals = [0.1 0.05 0.9 0.3];
T = size(a,1);
options = optimset('fminsearch');
options.Display = 'iter';
estimates = fminsearch(@residuiRK, startingVals, options, rkAA, h, a);
[ll, lls, u]=residuiRK(estimates, rkAA, h, a);
函数 residuiRK 具有以下代码:
function [ll, lls, u] = residuiRK(parameters, x_rk, h, data)
omega = parameters(1);
phi = parameters(2);
delta1 = parameters(3);
delta2 = parameters(4);
mu = mean(data);
T = size(data,1);
eps = data-mu;
z= eps./sqrt(exp(h));
lxRK=log(x_rk);
u = zeros(T,1);
for t = 1:T
u(t) = lxRK(t) - omega - phi*h(t) - delta1*z(t) - delta2*(z(t).^2-1);
end
lls = 0.5*(log(2*pi) + log(exp(h))+eps.^2./exp(h));
ll = sum(lls);
问题是: fminsearch 返回的估计参数等于我插入的起始值。为什么会出现这个问题?如果有人能解释一下,我将不胜感激。谢谢