EconForge / dolo.py

Economic modelling in python
BSD 2-Clause "Simplified" License
98 stars 72 forks source link

Solution accuracy in rbc_model.ipynb #63

Closed yaniv256 closed 9 years ago

yaniv256 commented 9 years ago

Hi Pablo,

I was going over rbc_model.ipynb, working on some edits and there are two results there that seem strange:

albop commented 9 years ago

Thank you for these excellent reamarks. There is indeed a mistake in the notebook: in the sensitivity analysis part, there are a couple of model.set_calibration(delta=val) calls. These ones modify the calibration in place, so that after the last call, the model calibration doesn't much the one used for the global solution stored in dr_global. This can explain both the accuracy errors and the strange pattern in the stochastic simulations. I'll fix that soon. The behaviour of set_calibration seems to confuse a few users (including me). May be one good idea would be to add a new_calibration() command with the same syntax that would return a new model without shared references.

yaniv256 commented 9 years ago

Awesome! Now it looks much better. I did not know perturbation does this bad on labour. Are you sure this is a valid result?

albop commented 9 years ago

Well, here good or bad is a matter of personal appreciation. To me, it produces very similary dynamics. When looking at the Eueler equations, the errors from the first order perturbations, have a constant bias that disappear from the second-order perturbations, mostly due to correction in the constant term. If you do dr=approximate_controls(model, order=2) instead, the approximation should be fairly good. Btw, I see that you have fixed the former problem in the notebook. Can I incorporate your modifications ?

yaniv256 commented 9 years ago

Oh, thats right. I'll switch the notebook to second order perturbation. First order is not appropriate because it create a false impression of superiority for the global solution.