Path: news.mathworks.com!not-for-mail
From: Alan_Weiss <aweiss@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: use fminsearch and fmincon to find MLE
Date: Fri, 14 Dec 2012 13:32:20 -0500
Organization: MathWorks
Lines: 18
Message-ID: <kafrbk$69$1@newscl01ah.mathworks.com>
References: <kadqg5$ehk$1@newscl01ah.mathworks.com> <kadrlf$i7v$1@newscl01ah.mathworks.com> <kadsoq$lg2$1@newscl01ah.mathworks.com> <kaffio$ja8$1@newscl01ah.mathworks.com> <kafhls$qip$1@newscl01ah.mathworks.com>
Reply-To: aweiss@mathworks.com
NNTP-Posting-Host: ah-aweiss.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: newscl01ah.mathworks.com 1355509940 201 172.28.17.56 (14 Dec 2012 18:32:20 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 14 Dec 2012 18:32:20 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0
In-Reply-To: <kafhls$qip$1@newscl01ah.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:784848

On 12/14/2012 10:47 AM, Lizzy wrote:
> And can anyone please tell me if this code is correct?
>
> coefInit = [1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;9];
> options_fminsearch = 
> optimset('Display','iter','TolFun',1e-4,'TolX',1e-4,'MaxIt',10000000,'MaxFunEvals',10000000000000);
> [coefEst,fval,exitflag,output] = fmincon(@(coef) 
> llk(coef,q,p,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12),coefInit,A,b,[],[],[],[],[],options_fminsearch);

I don't know why you reset the fmincon options TolFun and TolX, and I 
don't know why you call it options_fminsearch, and I don't know why you 
don't use the 'sqp' or 'interior-point' algorithms.

But the syntax looks correct. And with that many dimensions (17), you 
probably wouldn't get reliable fminsearch results.

Alan Weiss
MATLAB mathematical toolbox documentation