maximize log likelihood function

4 ビュー (過去 30 日間)
Jun Yoo
Jun Yoo 2020 年 8 月 28 日
コメント済み: Cris LaPierre 2020 年 8 月 28 日
Hi, Ive been stuggling with this code for maximizing log likelihoood.
I recently started to learn Matlab so Im confused with function in Matlab and how it works.
hope I can get some help from here
here is my code.
data = readtable('MROZ.csv');
data = data{:,[1, 20, 6, 19, 22, 5, 3, 4]};
y = data(:,1);
x = data(:,[2,3,4,5,6,7,8]);
int = ones(753, 1);
X = horzcat(int, x);
beta = X\y; % LPM coefficient;
[beta,fval,exitflag] = fminunc(@probitnll,beta,X,y);
function nll = probitnll(beta,X,y)
yhat = X * beta;
G = normcdf(yhat);
nll = sum(y .* log(G) + (1-y) .* log(1-G));
end
  1 件のコメント
Cris LaPierre
Cris LaPierre 2020 年 8 月 28 日
We don't have your data so can't run the code. What error message are you getting? What isn't working?

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeProblem-Based Optimization Setup についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by