MATLAB Answers

Find maximum of a function.

11 ビュー (過去 30 日間)
ektor 2015 年 8 月 17 日
コメント済み: JMP Phillips 2015 年 8 月 20 日
Dear all,
I have the following code that aims at maximixing LL_all with respect to "gidraw" which is scalar.
%the data
Xfi=[ -1.4+randn(n,1) 0.5+0.6*randn(n,1)];
beta=[3 2 ]';
yi=randn(n) ;
lam=Xfi*beta + gidraw;
%the function
LL_all = -(log(normpdf(gidraw,2,sqrt(0.5)))+int);
So, my question is what is the maximum of LL_all? That is, how can I find the maximum of this function? Also can I calculate the Hessian matrix(which is a scalar more precisely) of this function?
Thanks in advance
  4 件のコメント
ektor 2015 年 8 月 19 日
Hi Walter, I made a small modification in the above code to make things easier. n=10 now becomes n=1. Yes, this is what is desired. Basically I want to find the posterior mode of LL_all.



JMP Phillips
JMP Phillips 2015 年 8 月 19 日
If gidraw is a scalar, your problem doesn't make sense, as LL_all is just a number. If gidraw is vector, the maximum of -[log(normpdf) + int] is +Inf.
  2 件のコメント
JMP Phillips
JMP Phillips 2015 年 8 月 20 日
still confused sorry, your code just returns a number. Don't you need to specify a range of inputs for the distribution, so that you can find the maximum within the range? In your equation for LL_all, which is the vector input, is it Int?


その他の回答 (0 件)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by