jlperla / continuous_time_methods

MIT License
23 stars 15 forks source link

Create a test suite for the simple_optimal_stopping_diffusion.m #14

Closed jlperla closed 7 years ago

jlperla commented 7 years ago

Following the basic pattern of #13, we want to create a set of regression tests for the simple optimal stopping problem. You will see simple_optimal_stopping_diffusion_test.m which already has a test of the code against the old HACT setup.

Some of the tests to add are:

As always, the first part of the test is to make sure the results make sense, then the second part is to ensure it can automatically test that nothing changed.

stevenzhangdx commented 7 years ago

Hi Jesse,

I encountered a problem in matlab. When I was writing tests in simple_optimal_stopping_diffusion_test, matlab automatically breaks (matlab shuts off without any notification) if I run the code with setting mu>0. I tried a couple of computers and it happened every time.

I also tried to change mu_bar in LCP_example.m from -0.01 to 0.01. Unfortunately, the same problem occurred as well. I failed to figure out the reason. Do you know why it happened?

jlperla commented 7 years ago

I have replicated the issue. Looks like the LCP.m file (i.e, the yuval one) is blowing up at some point. I don't think it is worth debugging the LCP.m here since we would want to use a commercial LCP solver.

So, why don't you hold off on this test and instead move onto #8 You can complete the test suite with tomlab.

jlperla commented 7 years ago

At this point, all of the existing test cases are turned on.

Note: removed the function positive_mu_and_zero_sigma_test I don't think this is valid unless we set the stopping rule to be strange and rapidly increasing, or have the payoff decreasing in z. The issue is that a positive mu with sigma = 0 leads to an absorbing state?

Note the code that can be used to plot out the results and compare to the stopping value. It will help with the ones below.

Finally, what is left to do is:

stevenzhangdx commented 7 years ago

All tests are added. Please take a look at it. #14 is completed

jlperla commented 7 years ago

I tried things out, but the problem is that the I is too low: 3 and 6 are not enough points, and it broke when I tried to add in more. It is also possible I was unclear what I meant by the "two stopping points"... Perhaps what I should have written was "stopping regions". Typically we have been solving setups where there is only a single threshold, below which you stop. The idea is to setup the $S(x)$ payoff such that there are two regions you are better off stopping in.

I added plotting code so you can take a look at the results to the value vs. the stopping value to identify the stopping regions.

stevenzhangdx commented 7 years ago

Just want to make sure that graphically the plot should have exact two segments where both curves overlap. Is this the case?

jlperla commented 7 years ago

I think that is correct for the "two stopping points". The basic idea is that we want two disconnected regions where the firm optimally chooses the stop, and to make sure that this method delivers it

stevenzhangdx commented 7 years ago

I changed last two tests. Please take a look at it to see if it is correct. Also, I notice that "converged = false" in the two stopping regions case. Maybe I am still doing wrong in this case. Please let me know.

jlperla commented 7 years ago

Thanks. I am taking control of the issue to finish it off and check the results. When I close it, you will get an email. Please take a look at what I did (and the picture that comes out of it) to see the results.

The next issue to work on is #9 on writing things up for a non-uniform grid. I will post up a few comments in that issue after I put some placeholders in the document.

On Wed, Oct 18, 2017 at 10:54 AM stevenzhangdx notifications@github.com wrote:

I changed last two tests. Please take a look at it to see if it is correct. Also, I notice that "converged = false" in the two stopping regions case. Maybe I am still doing wrong in this case. Please let me know.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/econtoolkit/continuous_time_methods/issues/14#issuecomment-337674651, or mute the thread https://github.com/notifications/unsubscribe-auth/AMf-IVIEhbm3UalbxO-LEpWs55CEdykzks5stjtpgaJpZM4PYQIR .