Maximum Likelihood Estimation function

2 ビュー (過去 30 日間)
Jane Smith
Jane Smith 2022 年 5 月 12 日
編集済み: David Randolph 2022 年 5 月 13 日
syms a
logL=100.*log(a)+sum(log(exp(a.*c2))+sum(log((1+exp(a.*c2)).^-2)));
j = fplot(logL)
hold on
%%
m=100/a;
o=sum(c);
p=2*exp(a.*c);
q=exp(a.*c)+1;
dlog=m+o-p.*c.*(q.^-1);
k=fplot(dlog);
hline.Color = 'k';
c is a matrix of data
I am trying to find the maximum of the estimator is there another method except plotting the graphs of the log functions?

採用された回答

Torsten
Torsten 2022 年 5 月 12 日
x = your data vector
fun = @(a) n/a + sum(x) - 2*a*sum(exp(a*x)./(exp(a*x)+1);
a = fzero(fun,1)
  3 件のコメント
Torsten
Torsten 2022 年 5 月 12 日
編集済み: Torsten 2022 年 5 月 12 日
I think there is an error in your derivative of L with respect to a. In my opinion, the function must be
fun = @(a) n/a + sum(x) - 2*sum(x.*exp(a*x)./(exp(a*x)+1))
Jane Smith
Jane Smith 2022 年 5 月 13 日
編集済み: Jane Smith 2022 年 5 月 13 日
Yes you are correct.

サインインしてコメントする。

その他の回答 (1 件)

John D'Errico
John D'Errico 2022 年 5 月 12 日
Is there another way? Why not negate the function, and then use a tool like fminbnd? Or fminsearch. Or fmincon or fminunc, or ...
  2 件のコメント
Jane Smith
Jane Smith 2022 年 5 月 12 日
I am getting errors when trying with those functions.
Error using fcnchk
FUN must be a function, a valid character vector expression, or an inline function object.
I have been trying it on various softwares. The function f(x) is made up so i am getting confused were my mistake is in finding the estimate.
David Randolph
David Randolph 2022 年 5 月 13 日
編集済み: David Randolph 2022 年 5 月 13 日
@John D'Errico wrong again!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by