EconForge / interpolation.py

BSD 2-Clause "Simplified" License
123 stars 35 forks source link

no eval_ms for linear interpolation and empty exo_grid #66

Closed TimMunday closed 4 years ago

TimMunday commented 4 years ago

Hi- is there a reason that the dispatch multimethods in decision_rule.py do not include some functions for Linear interpolation with an empty exo_grid. ? Apologies if this is a stupid question.

Under # Empty x Cartesian x Linear, there are some functions defined but not eval_ms or eval_is, which seem to be needed for impulse response analysis. (And indeed are defined beneath for Empty x Cartesian x Cubic).

As a result if one does try to find irfs for a model that has used time iteration and linear interpolation, the following error message occurs:

Could not find signature for eval_ms: <DecisionRule, EmptyGrid, UniformCartesianGrid, Linear, ndarray, ndarray>

albop commented 4 years ago

It's not a stupid question. Here is what is happening: decision rules are all defined on a a grid, which is the product of the exogenous and of the endogenous grid. A point in the endogenous one is always referred to by s. If the exogenous grid can be indexed by a discrete array points are indexed by i, or if they are indexed by a continuum of points it is m. Now you're decision rule can be indexed by eval_s (if there is no exogenous grid, or if it's empty), by eval_is or by eval_ms(m,s), when these expressions make sense. For cubic interpolation, we ignore the first index, if the first grid is empty (that is : eval_is(i,s)=eval_s(s) and eval_ms(m,s)=eval_s(s)). There is no reason, we wouldn't do the same for linear interpolation. I"ll fix that very soon.

albop commented 4 years ago

Done, you can try the master branch if you want. To install it using pip your need to install poetry first.

TimMunday commented 4 years ago

Thanks! Works perfectly now. Appreciate the speedy reply!

albop commented 4 years ago

You're welcome. Btw, this issue, contrary to the 5d one is actually a dolo issue...

On Thu, Jun 18, 2020, 5:07 PM TimMunday notifications@github.com wrote:

Closed #66 https://github.com/EconForge/interpolation.py/issues/66.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/EconForge/interpolation.py/issues/66#event-3458606556, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACDSKMLS74NCLH6SVU5AXTRXIUUNANCNFSM4OBTSQAQ .

TimMunday commented 4 years ago

Yep apologies - should have realised that it was an interpolation issue and then seen that the 5d issue had already been flagged!

TimMunday commented 4 years ago

Oh and now I see I've put this issue in the interpolation repo...

albop commented 4 years ago

no problem at all

On Fri, Jun 19, 2020 at 9:43 AM TimMunday notifications@github.com wrote:

Oh and now I see I've put this issue in the interpolation repo...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/EconForge/interpolation.py/issues/66#issuecomment-646491193, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACDSKNL6EGFLHTKEVVEQOLRXMJL5ANCNFSM4OBTSQAQ .