IRIS-Solutions-Team / IRIS-Toolbox

[IrisToolbox] for Macroeconomic Modeling
Other
90 stars 41 forks source link

Error in arwm #333

Open pfjulio opened 1 year ago

pfjulio commented 1 year ago

Hi Jeromir,

When estimating a backwards-looking model, the 'estimate' routine works fine, but when I call the 'arwm', I get the following error after a while. Any idea what might be causing this error and why it only comes out in the middle of the routine?

[IrisToolbox] @poster/arwm Progress [•••••••••• ] 26% Error using startsWith First argument must be text. Error in model/update (line 108) if startsWith(update.NoSolution, "error", "ignoreCase", true) Error in model/objfunc (line 51) [this, UpdateOk] = update(this, x, variantRequested); Error in poster/mylogpost (line 36) this.MinusLogPostFunc(P, this.MinusLogPostFuncArgs{:}); Error in poster/arwm (line 254) [newLogPost, ~, ~, ~, isWithinBounds] = mylogpost(this, newTheta); %#ok Error in estimate_model (line 291) [theta,logpost,ar,pos,SgmVec,cov] = arwm(outputest.mode.pos,input.estim.Ndraws/2, ... Error in interface (line 113) estimate_model;

jaromir-benes commented 1 year ago

Hi - this is indeed a little bug and I'll fix it right away. Let me explain...

When you're running the posterior simulator, there are random parameter values generated from the posterior distribution. Sometimes a particular combination of parameter values may result in the model being unstable (i.e. no stable solution) if this is not guaranteed by the lower/upper bounds. In that case, the draw is scheduled to be discarded - and that's the moment where there is a little typo in the code. It's a rather unusual situation (in most models, the lower and upper bounds imposed by the user are enough to guarantee stability) so that's why it's been not captured in our testing suite :)

To get it up and running on your current version - try to look into the lower/upper bounds you're imposing, and set them so to minimize the possibility of unstable solutions as much as possible (e.g. all autoregressive parameters smaller than 1 etc.).

Best Jaromir

On Mon, Aug 22, 2022 at 9:36 AM pfjulio @.***> wrote:

Hi Jeromir,

When estimating a backwards-looking model, the 'estimate' routine works fine, but when I call the 'arwm', I get the following error after a while. Any idea what might be causing this error and why it only comes out in the middle of the routine?

[IrisToolbox] @poster/arwm Progress [•••••••••• ] 26% Error using startsWith First argument must be text. Error in model/update (line 108) if startsWith(update.NoSolution, "error", "ignoreCase", true) Error in model/objfunc (line 51) [this, UpdateOk] = update(this, x, variantRequested); Error in poster/mylogpost (line 36) this.MinusLogPostFunc(P, this.MinusLogPostFuncArgs{:}); Error in poster/arwm (line 254) [newLogPost, ~, ~, ~, isWithinBounds] = mylogpost(this, newTheta); %#ok Error in estimate_model (line 291) [theta,logpost,ar,pos,SgmVec,cov] = arwm(outputest.mode.pos,input.estim.Ndraws/2, ... Error in interface (line 113) estimate_model;

— Reply to this email directly, view it on GitHub https://github.com/IRIS-Solutions-Team/IRIS-Toolbox/issues/333, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGCVKKSQBMQOGM57ACS7OR3V2MUWRANCNFSM57GSFJ2Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

pfjulio commented 1 year ago

Thanks for the prompt reply. Sometimes it is hard to find the upper/lower bounds that assure stability, mainly when estimating models with a lot of parameters.

I will update to the newer version once it comes out.

Best, Paulo

On Mon, Aug 22, 2022 at 9:34 AM Jaromír Beneš @.***> wrote:

Hi - this is indeed a little bug and I'll fix it right away. Let me explain...

When you're running the posterior simulator, there are random parameter values generated from the posterior distribution. Sometimes a particular combination of parameter values may result in the model being unstable (i.e. no stable solution) if this is not guaranteed by the lower/upper bounds. In that case, the draw is scheduled to be discarded - and that's the moment where there is a little typo in the code. It's a rather unusual situation (in most models, the lower and upper bounds imposed by the user are enough to guarantee stability) so that's why it's been not captured in our testing suite :)

To get it up and running on your current version - try to look into the lower/upper bounds you're imposing, and set them so to minimize the possibility of unstable solutions as much as possible (e.g. all autoregressive parameters smaller than 1 etc.).

Best Jaromir

On Mon, Aug 22, 2022 at 9:36 AM pfjulio @.***> wrote:

Hi Jeromir,

When estimating a backwards-looking model, the 'estimate' routine works fine, but when I call the 'arwm', I get the following error after a while. Any idea what might be causing this error and why it only comes out in the middle of the routine?

[IrisToolbox] @poster/arwm Progress [•••••••••• ] 26% Error using startsWith First argument must be text. Error in model/update (line 108) if startsWith(update.NoSolution, "error", "ignoreCase", true) Error in model/objfunc (line 51) [this, UpdateOk] = update(this, x, variantRequested); Error in poster/mylogpost (line 36) this.MinusLogPostFunc(P, this.MinusLogPostFuncArgs{:}); Error in poster/arwm (line 254) [newLogPost, ~, ~, ~, isWithinBounds] = mylogpost(this, newTheta); %#ok Error in estimate_model (line 291) [theta,logpost,ar,pos,SgmVec,cov] = arwm(outputest.mode.pos,input.estim.Ndraws/2, ... Error in interface (line 113) estimate_model;

— Reply to this email directly, view it on GitHub https://github.com/IRIS-Solutions-Team/IRIS-Toolbox/issues/333, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AGCVKKSQBMQOGM57ACS7OR3V2MUWRANCNFSM57GSFJ2Q

. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/IRIS-Solutions-Team/IRIS-Toolbox/issues/333#issuecomment-1222030501, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2OWEXTKMXU76J7TZIEHSTV2M3QBANCNFSM57GSFJ2Q . You are receiving this because you authored the thread.Message ID: @.***>

--

Paulo Júlio

pfjulio commented 1 year ago

Hi Jaromir,

Has this bug been fixed? I keep getting the same error.

Best, Paulo