fminsearch mle parameters estimation
6 次查看(过去 30 天)
显示 更早的评论
Hi, i'm trying to estimate the parameters of log likelihood function by using fminsearch. i have three parameters; x(1),x(2),x(3) and the set of valid parameters for x(1)-->[0,20] , for x(2)---> [0,1000], for x(3)---> [0,5000]. i want to find the estimated parameters in this set. So i have to add some conditions to fminsearch. Namely, to discourage the algorithm from finding local minumum outside the set of valid parameters, i have to define the log likelihood to be negative infinity for values outside this set. Then i have to restart the algorithm until no improvement could be found in 20 consecutive runs. But i don't know how to do this. Is this possible?? for fminsearch, my starting point x0:[20*rand,1000*rand,5000*rand]. Can anyone please help me??
0 个评论
回答(4 个)
Matt J
2013-1-13
It sounds like it should look something like this,
for i=1:20
[Xall(:,i),fval(i)]=fminsearch(...);
end
[~,idx]=min(fval);
x=Xall(:,idx);
2 个评论
Matt J
2013-1-15
dert Commented:
thank you for your helping. but i didnt understand so well because i havent been using matlab for a long time. Can you explain little bit?? how can i discourage to find outside the set of valid parameter?
Matt J
2013-1-15
You already told us how you were going to do that in your original post. You're going to make the function minimized return Inf if it steps into that region.
Shashank Prasanna
2013-1-15
You are out of luck if you want to do this directly with FMINSEARCH since it does not allow for constraints. Your best options would be to reject all solutions where the constraints are violated (not in x(1)-->[0,20] , for x(2)---> [0,1000], for x(3)---> [0,5000]) and restart the optimization in a while loop.
If you do have the Optimization Toolbox this makes life much easier: I am assuming your objective function is smooth an continuous then you can say
fmincon(@loglikelihood_function,[20*rand,1000*rand,5000*rand],[],[],[],[],[0;0;0],[20;1000;5000],[],options)
From the fmincon doc http://www.mathworks.com/help/optim/ug/fmincon.html you can see that i specify the start point and constraints. The first argument is your likelihood function written out in MATLAB. the last option "options" is where you can specify when you want to stop the optimization, here is a list of all the options available: http://www.mathworks.com/help/optim/ug/optimization-options-reference.html
0 个评论
Matt J
2013-1-15
You could also try transforming the variables so that they are fundamentally bounded, e.g. making the substitution
x(1)=10*sin(y(1))+10;
will ensure that x(1) is bounded to [0,20] even though you will be minimizing over y(1). However, your original post made it sound like you were asked to pursue an approach of setting the function to Inf in the appropriate places.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!