Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Aaron
Posts:
10
Registered:
3/23/11


fminsearch and mle
Posted:
Apr 20, 2011 5:29 PM


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 allow a second input. Specifically, if I write the following function (the normal log likelihood function excluding sigma):
function L = likelihoodfunc(B) load myvars.mat L = (n/2)*log(2*pi)+0.5*(yX*B)'*(yX*B); %negative loglikelihood
Everything runs fine and my fminsearch returns estimates for B. However, I cannot figure out how to include sigma. The normal log likelihood function should read:
L = (n/2)*log(2*pi*sig^2)+0.5*(1/sig^2)*(yX*B)'*(yX*B)
Can fminsearch be used here, or should I be using a different feature?



