Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Aaron

Posts: 10
Registered: 3/23/11
fminsearch and mle
Posted: Apr 20, 2011 5:29 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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*(y-X*B)'*(y-X*B); %negative log-likelihood

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)*(y-X*B)'*(y-X*B)

Can fminsearch be used here, or should I be using a different feature?



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.