Using fminunc for probit estimation

조회 수: 6 (최근 30일)
Yevgeniya
Yevgeniya 2011년 8월 2일
댓글: Joshua Scott 2021년 8월 5일
I am estimating a simple probit model using fminunc as an optimization tool. The reason why I don't use other optimization strategies is because I want to change code later to estimate ordered probit. I get an error "Input to ROOTS must not contain NaN or Inf." while estimating. Could you please suggest what might be wrong with my code? (see below: w- vector of independent vars, yd-dependent dummy). Many thanks, Yevgeniya
w=M.data(:,3);
yd=M.data(:,5);
k=size(w,2);
[b,r,stats]=regress(yd,w);
start0=b;
data=[w yd];
f0=find(yd==0);
f1=find(yd==1);
opts = optimset ('Display','iter','TolX',1e-15,'TolFun',1e-15,'MaxIter',2000,'MaxFunEvals',1000000);
[param,fval] = fminunc(@(start)P_Lik(data,k,indiv,f0,f1,start),start0,opts);
function L = P_Lik(X,k,indiv,f0,f1,start);
bcoef=start(1:k);
y=X(:,end);
Xb=X(:,1:k)*bcoef;
w=zeros(size(X,1),1);
w(f0)=log(1-normcdf(Xb(f0)));
w(f1)=log(normcdf(Xb(f1)));
L=-sum(w);
  댓글 수: 1
Joshua Scott
Joshua Scott 2021년 8월 5일
Hello Yevgeniya,
I realize this post was made awhile back. I am curious, what edits did you make in order to make this ordered probit?
Thank you
Best,
Josh

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2011년 8월 2일
You should probably be using the FunValCheck option
  댓글 수: 1
Yevgeniya
Yevgeniya 2011년 8월 8일
Walter, thanks! This was helpful.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

J Ahmed
J Ahmed 2012년 1월 23일
Hi...
I am having same problem even when I turn 'FunValCheck' on. After few simulations it stops with the captioned message. Probably, Yevgeniya, you might help if you have already solved the problem.
Thanks!
  댓글 수: 1
Yevgeniya
Yevgeniya 2012년 1월 24일
Hi Ahmed,
I ended up switching to fmimcon and setting up the constraints to make sure that I don't get numbers out of the acceptable range.
Hope this helps.
Yevgeniya

댓글을 달려면 로그인하십시오.


J Ahmed
J Ahmed 2012년 1월 26일
Thanks Yvegeniya. I'll try that then.

카테고리

Help CenterFile Exchange에서 Nonlinear Least Squares (Curve Fitting)에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by