How can I use fmincon for maximum likelihood optimization?
조회 수: 6 (최근 30일)
이전 댓글 표시
I am trying to use fmincon to obtain mle's for my model. Using the 'mle' function it gives me a solution, but the solution is not unique. I have therefore applied constraints to some of the parameters and tried to use 'fmincon' instead. But every time I run 'fmincon', with different starting values, it keeps giving me
Max Line search Directional 1st-order
Iter F-count f(x) c'straint steplength derivative optimality Procedure
0 5 12059.9 0
1 10 NaN 9.095e-13 1 -1.34e+04 Inf
2 15 NaN NaN 1 NaN Inf Hessian not
I'm not sure what's going wrong. I've included my code for the objective function, log-likelihood in this case, and the command lines I am using to run the optimization problem.
function ln_like = Skellam_Log_likelihood(parameters)
D = importdata('E:\Matlab Data Files\Emprical Data\GoalDifference.dat','D');
mu = parameters(1);
h = parameters(2);
a1 = parameters(3);
a2 = parameters(4);
for i = 1:1:length(D)
pdf(i) = Skellam_pdf(D(i),mu,h,a1,a2);
end
pdf = log(pdf);
ln_like = -1*sum(pdf);
end
x0 = [1 1 .2 -.2];
opts = optimset('Display','iter','Algorithm','active-set');
[x fval] = fmincon(@Skellam_Log_likelihood,x0,[],[],[0 0 1 1],0,[],[],... [],opts)
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Nonlinear Optimization에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!