Path: news.mathworks.com!not-for-mail
From: "Lizzy " <lookforaroommate@126.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: use fminsearch and fmincon to find MLE
Date: Fri, 14 Dec 2012 15:40:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 50
Message-ID: <kafh8o$p3i$1@newscl01ah.mathworks.com>
References: <kadqg5$ehk$1@newscl01ah.mathworks.com> <kadrlf$i7v$1@newscl01ah.mathworks.com> <kadsoq$lg2$1@newscl01ah.mathworks.com> <kadtqg$ou4$1@newscl01ah.mathworks.com> <kadus9$rpo$1@newscl01ah.mathworks.com> <kae0s1$4os$1@newscl01ah.mathworks.com> <kae3m1$dlv$1@newscl01ah.mathworks.com> <kae5jt$jh0$1@newscl01ah.mathworks.com> <kae7us$pl4$1@newscl01ah.mathworks.com> <kae8p4$rks$1@newscl01ah.mathworks.com>
Reply-To: "Lizzy " <lookforaroommate@126.com>
NNTP-Posting-Host: www-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1355499608 25714 172.30.248.37 (14 Dec 2012 15:40:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 14 Dec 2012 15:40:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2946507
Xref: news.mathworks.com comp.soft-sys.matlab:784838

"Matt J" wrote in message <kae8p4$rks$1@newscl01ah.mathworks.com>...
> "Lizzy " <lizzy1230@gmail.com> wrote in message <kae7us$pl4$1@newscl01ah.mathworks.com>...
> > "Matt J" wrote in message <kae5jt$jh0$1@newscl01ah.mathworks.com>...
> > > "Lizzy " <lizzy1230@gmail.com> wrote in message <kae3m1$dlv$1@newscl01ah.mathworks.com>...
> > > >
> > > > 
> > > > Thanks, Well, to make my life easier----is it necessary to impose a constraint of sigma>0 in mle estimation, if my estimated results for sigma are always >0?
> > > =============
> > > 
> > > How will you ensure the estimated sigma are always >0 without constraints?
> > > 
> > > > If I only wanna use fminsearch (by using fmincon, the results always come to NAN, dunno why), how could I determine if it convergent to an optimal point? Just by plug my estimated results back in fminsearch again, and see if L still goes down?
> > > ===================
> > > 
> > > You should try FMINCON's sqp algorithm. If certain regions of your function are NaN or non-finite (as is your case), the sqp algorithm can avoid those regions.
> > > 
> > > To determine whether a point is an unconstrained minimizer, it is sufficient to check whether the gradient is zero or approximately so.
> > 
> > sigh, I have to admit the following:
> > 1)I don't know how to use FMINCON'S sqp algorithm. Could you please provide some details?
> 
> Show how you've been running FMINCON so far.
> 
> > 2)How to check whether the gradient is zero? Is there any code to do it?
> 
> You could calculate the formula for your gradient and check that way. Alternatively,
> FMINCON and FMINUNC have many output arguments. As you will see in the documentation, one of the outputs is the gradient at the final solution. If you run for zero iterations, it should return the gradient at the initial guess, which can be any vector you want.


When I'm using fmincon, the result shows
 Iter F-count        f(x)   constraint   steplength   derivative   optimality Procedure 
    0     18      41585.6           -9                                         
    1     40      41584.3       -9.111       0.0625        -7.04         19.6   
    2     63      41580.7       -8.925       0.0313        -6.53         16.8   
    3     81      41571.4       -9.006            1        -2.61         6.38   
    4    107      41520.5       -9.083      0.00391        -5.37          136  Hessian modified  
    5    142      41454.3       -9.099    7.63e-006        -56.4          541  Hessian modified  
    6    179      41339.6       -9.107    1.91e-006         -202    1.84e+003  Hessian modified  
    7    242      41207.4        -9.11    2.84e-014         -660    4.08e+003  Hessian modified twice  
    8    278      39010.3        6.692   -3.81e-006   -1.43e+003          441  Hessian modified twice  
    9    296          NaN  -2.804e-016            1         11.5          Inf  Hessian modified twice  
   10    314          NaN          NaN            1          NaN          Inf  Hessian not updated  
   11    332          NaN          NaN            1          NaN          Inf  Hessian not updated  
   12    350          NaN          NaN            1          NaN          Inf  Hessian not updated

and so on.
What do you think could be the problem?
And is there no way that I can find the gradient using fminsearch?

Thanks.