필터 지우기
필터 지우기

Break a loop and get the step where the loop stopped

조회 수: 1 (최근 30일)
Lu
Lu 2012년 6월 24일
Dear everyone,
I have a function that calculates a test statistic and compares it to some critical values. If the test statistic is greater than the critical value, then the loop should break and it should give back the step k where the loop broke and it should calculate at "k-1" (one step before condition was met) maximum likelihood estimates. However, it is not working and it is not giving me back the step k where the loop breaks nor the quasi maximum likelihood estimates. I hope you could give me a hint on what am I doing wrong.
Thank you so much!
  댓글 수: 2
Jan
Jan 2012년 6월 24일
To understand the problem, the readers of your question have either to run your function or you have to explain, what the program does. Without knowing the inputs, we cannot run the program. You explain only, what the program doesn't do, but not, what it does.
Is the (b_T(k) > zk_values(k)) condition fulfilled for any k?!
Lu
Lu 2012년 6월 24일
Dear Jan,
Thank you for the suggestion, I explained a bit more what the script is supposed to do :) I hope you can give me a hint on what am I doing wrong.
Thank you

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

답변 (1개)

Image Analyst
Image Analyst 2012년 6월 24일
In the line:
theta_k_hat = WACD_11_Estimation(y(b_Intervals(k -1 +1 , 7) : b_Intervals(14, 8))) ;
what is the function "WACD_11_Estimation"? You don't seem to have used that before.
  댓글 수: 3
Image Analyst
Image Analyst 2012년 6월 24일
Do you know how to use the debugger? Set a breakpoint there. Is the value of k_hat correct? Then, if so, is the value theta_k_hat correct? Then if so, is the value hat_parameters correct? This is what you can learn if you know how to use the debugger. It's far more efficient than debugging via Answers postings and responses.
Lu
Lu 2012년 6월 24일
Hi Image Analyst,
Thank you for your suggestion, I was checking the values of k_hat and theta_k_hat but they were correct, the problem was that the program was not estimating the maximum likelihood estimates and I didnt know why. Sometimes you miss a little detail that others might find and that is why I posted it on Answers.
In the end I got it to work.
Thank you for your help :)

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

Community Treasure Hunt

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

Start Hunting!

Translated by