econ-ark / REMARK

Replications and Explorations Made using the ARK
Apache License 2.0
19 stars 56 forks source link

Linear interpolation error in SolvingMicroDSOP #11

Open npalmer-professional opened 5 years ago

npalmer-professional commented 5 years ago

I've run across an error in the linear interpolator when I'm running the SolvingMicroDSOP replication.

I've uploaded a branch here that has a "clean demonstration" of the error: https://github.com/npalmer-professional/REMARK/

... and specifically see this "slice across the objective surface:" https://github.com/npalmer-professional/REMARK/blob/interpolation_error_example/REMARKs/SolvingMicroDSOPs/Figures/SMMslice_cubicbool-false.pdf

You an create this image by running the function "make_contour_slice()" in /REMARK/REMARKs/SolvingMicroDSOPs/Code/StructEstimation.py
(the default parameters will create the figure).

Experimenting on the command line I found that if I pull the parameters at one of those spikes and look at the consumption function using that parameter set, you see how a couple of the consumption functions got a little crazy. (Not included here because haven't cleaned up that code for demonstration).

Funny enough I remember something like this 2 or 3 years ago, I ran across this same error but reversed -- the cubic spline gave the error, while the linear spline didn't. Now it appears to be reversed; If I run the same "slice" for the cubic spline I don't get the problem (but I haven't explored cubic spline over the whole space to see if there are errors elsewhere). @mnwhite I think you worked on that back then and fixed the cubic spline issue, and both cubic and linear were working back then. I think this was all way before the 2.7 -> 3.x conversion for what that is worth in terms of very rough timeline.

Edit: Also potentially important, this only shows up when you allow agents to borrow.

llorracc commented 5 years ago

@npalmer-professional, is there any chance you could figure out and solve this one yourself? @mnwhite has a lot of other things on his plate (or on his floor or crib) right now ...

mnwhite commented 5 years ago

I'm not sure I actually did solve the cubic version of this problem; it was super weird. But this is even weirder.

I don't think it's necessarily an interpolation issue, but a numeric glitch with the solver more generally.

On Fri, Jul 19, 2019, 8:10 AM Christopher Llorracc Carroll < notifications@github.com> wrote:

@npalmer-professional https://github.com/npalmer-professional, is there any chance you could figure out and solve this one yourself? @mnwhite https://github.com/mnwhite has a lot of other things on his plate (or on his floor or crib) right now ...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/econ-ark/REMARK/issues/11?email_source=notifications&email_token=ADKRAFJLGVQRV3BNQL673W3QAGVNDA5CNFSM4IDADZV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2LOLKY#issuecomment-513205675, or mute the thread https://github.com/notifications/unsubscribe-auth/ADKRAFOOOC3JF2CYAXE5P53QAGVNDANCNFSM4IDADZVQ .

llorracc commented 5 years ago

@npalmer-professional @mnwhite, could you move this thread over to HARK, because that is where the "master" SolvingMicroDSOPs code lives now until the fine day when we have resolved all of the issues of moving the masters over to elsewhere

npalmer-professional commented 5 years ago

@Chris -- yes I can move this over to HARK. I'm looking into it slowly now, it is a strange one.

npalmer-professional commented 5 years ago

Moved to main HARK; closing here.

sbenthall commented 3 years ago

See #80