# Why fminsearch does not find the global minimum?

32 views (last 30 days)
MRC on 27 Jan 2014
Edited: Matt J on 27 Jan 2014
Hi all, I want to minimize the function fun below and I know that it has a global minimum which is par=[1 2 2 3] but fminsearch is not able to find it. Can you help me?
clear all
rho=0.3;
T=100;
%%Build the expected log-likelihood function
mu=zeros(1,n); %vector 1 x n
sigma=[1 rho; rho 1]; %matrix n x n
%alpha_1=par(1)
%alpha_2=par(2)
%beta_1=par(3)
%beta_2=par(4)
fun=@(par) -sum((mvncdf(-(kron([par(1) par(2)],ones(T,1))+X.*kron([par(3) par(4)],ones(T,1))),mu,sigma)...
.* log(mvncdf(-(kron([par(1) par(2)],ones(T,1))+X.*kron([par(3) par(4)],ones(T,1))),mu,sigma)))...
+ ((1-mvncdf(-(kron([par(1) par(2)],ones(T,1))+X.*kron([par(3) par(4)],ones(T,1))),mu,sigma))...
.*log(1-mvncdf(-(kron([par(1) par(2)],ones(T,1))+X.*kron([par(3) par(4)],ones(T,1))),mu,sigma))));
par_guess = [1.3 2.4 2.5 3.6];
par_min = fminsearch(fun, par_guess);

José-Luis on 27 Jan 2014
There is no optimizer that can absolutely guarantee that it will find the global optimum. They are all more or less adapted to certain sorts of problems. You could try modifying your starting value.
Matt J on 27 Jan 2014
mvncdf(z,mu,sigma), and hence also your overall loglikelihood, has low gradient when abs(z-mu) is large compared to sigma. You need to make sure that the initial values of
z=kron([par(1) par(2)],ones(T,1))+X.*kron([par(3) par(4)],ones(T,1))
do not lie in this low gradient region for all/most z(i). Otherwise, it will be hard for the algorithm to make progress within the MaxIter that you've set.