Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: fminsearch and mle
Replies: 4   Last Post: May 3, 2013 9:03 AM

 Messages: [ Previous | Next ]
 Alan Weiss Posts: 1,430 Registered: 11/27/08
Re: fminsearch and mle
Posted: May 3, 2013 9:03 AM

On 5/3/2013 5:15 AM, rand olpha wrote:
> I am trying to create a simple mle example by writing a negative log
> likelihood function, assuming a normal distribution, and use
> fminsearch to find the estimates. However, I am struggling to get
> fminsearch to get correct estimated parameters. why I can't get
> correct result?
> load data.mat;% data is 30 x 3 matrix
> params =[2;2;2];
> likepdf=@(dd,p1,p2,p3)
> (1/(sqrt(2*pi)*p1).*exp(-((dd(:,1)-p2*dd(:,2)-p3*dd(:,3)).^2)/2/p1^2));
> myfun = @(par) -prod(likepdf(data,par(1),par(2),par(3)));
> [unparams,negmaxlike,exitflag,output] = fminsearch(myfun,params)
>
> unparams =
>
> 2
> 2
> 2
>
>
> negmaxlike =
>
> 0
>
>
> exitflag =
>
> 1
>
>
> output =
> iterations: 11
> funcCount: 54
> algorithm: 'Nelder-Mead simplex direct search'
> message: [1x194 char]

I suggest you take the log likelihood (you have taken the likelihood).
It is very likely (no pun intended) that the likelihood is about zero in
the region of the initial point, and small perturbations don't change
that. The log likelihood will be more sensitive to small changes in the
parameters.

Alan Weiss
MATLAB mathematical toolbox documentation

Date Subject Author
4/20/11 Aaron
4/21/11 Steve
4/21/11 Aaron
5/3/13 rand olpha
5/3/13 Alan Weiss