IRIS-Solutions-Team / IRIS-Toolbox

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

Model singularity #268

Open ripatti opened 4 years ago

ripatti commented 4 years ago

I am writing an extension to a simple macroeconomics-SIR model by Eichenbaum, Rebelo, Trabandt. My aim is to use nonlinear method to simulate it. This requires first order solution. I got the steady-state right, but for solve(m) command, Iris throws an error message.

*** Solution not available for some parameter variant(s)
    Singularity or linear dependency in some equations [Parameter Variant(s) #1]
> In solve/hereReportFailure at 157
  In solve at 142
  In run_basic at 61 

Is there a way to see where the problem is? For example, how could I get the matrix of the solved transition equation?

ripatti commented 4 years ago

Roots:

>> get(m,'UnitRoots')'

ans =

   1.000000000000000
   1.000000000000000
   1.000000000000000
   0.999999999999952

>> get(m,'StableRoots')'

ans =

                   0
   0.500100000000000

>> get(m,'UnstableRoots')'

ans =

                 Inf
                 Inf
                 Inf
                 Inf
                 Inf
                 Inf
                 Inf
                 Inf
                 Inf
                 Inf
                 Inf
                 Inf
                 Inf
   1.000568600096429
                 Inf
                 Inf
   1.521251259171598
                 Inf
                 Inf
   2.001137200192857
                 Inf
   2.000737052782301
                 Inf
   1.000568600096429
                 Inf
                 Inf

Iris version is the latest.

ripatti commented 4 years ago

One more issue. The model is intrinsically non-stationary, except at the steady-state point. This means that initial conditions (outside steady-state) matter for the "final state".

In addition, some (endogenous) variables are zero at the steady-state.

jaromir-benes commented 4 years ago

Hi Antti - could you possibly also upload the model itself?

On Wed, Aug 12, 2020 at 12:15 PM Antti Ripatti notifications@github.com wrote:

One more issue. The model is intrinsically non-stationary, except at the steady-state point. This means that initial conditions (outside steady-state) matter for the "final state".

In addition, some (endogenous) variables are zero at the steady-state.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/IRIS-Solutions-Team/IRIS-Toolbox/issues/268#issuecomment-672784923, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGCVKKSULX3GKWS7376XX2DSAJTVTANCNFSM4P4KWEXA .

ripatti commented 4 years ago

Hi Mirek,

Thanks - again - for prompt response. basic.model is the model file run_basic.m runs the model

Cheers, Antti

ke 12. elok. 2020 klo 13.19 Jaromír Beneš (notifications@github.com) kirjoitti:

Hi Antti - could you possibly also upload the model itself?

On Wed, Aug 12, 2020 at 12:15 PM Antti Ripatti notifications@github.com wrote:

One more issue. The model is intrinsically non-stationary, except at the steady-state point. This means that initial conditions (outside steady-state) matter for the "final state".

In addition, some (endogenous) variables are zero at the steady-state.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/IRIS-Solutions-Team/IRIS-Toolbox/issues/268#issuecomment-672784923 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AGCVKKSULX3GKWS7376XX2DSAJTVTANCNFSM4P4KWEXA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/IRIS-Solutions-Team/IRIS-Toolbox/issues/268#issuecomment-672786575, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADFU4567YIXLUJWY6GPZR3SAJUCHANCNFSM4P4KWEXA .

ripatti commented 4 years ago

Here they are!

ripatti commented 4 years ago

It seems that my github skills are bad modelfiles.zip

jaromir-benes commented 4 years ago

Hi Antti

Finally found some spare moments to look into the issues. I am, however, not even able to find a valid steady state solution (experimenting with various options...)

Can you pls send me the way you find the steady state as well? :)))

Jaromir

On Wed, Aug 12, 2020 at 12:58 PM Antti Ripatti notifications@github.com wrote:

It seems that my github skills are bad modelfiles.zip https://github.com/IRIS-Solutions-Team/IRIS-Toolbox/files/5062203/modelfiles.zip

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/IRIS-Solutions-Team/IRIS-Toolbox/issues/268#issuecomment-672802909, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGCVKKXVWENIWDPUMZWSF53SAJYUTANCNFSM4P4KWEXA .

ripatti commented 4 years ago

Hi Mirek,

I am working with a more complicated model that builds on the dynare code by Eichenbaum, Rebelo, and Trabandt (the first paper in this list: https://sites.google.com/site/mathiastrabandt/home/research). I use dynare's perfect foresight solution to solve (as does the original code). Since the (final, terminal) steady-state does depend on the initial values (this is a feature of epidemiological SIR model), the t+1 variables are transformed into gross growth rates. This results many unit roots.

I calculate the steady-state analytically. It is called the non-epidemic steady state, ie corresponds s=1, i=0, etc. The code runs ok and chksstate returns 1. Then it says Warning: IRIS Toolbox Warning @ model:solve. *** Solution not available for some parameter variant(s) No stable solution [Parameter Variant(s) #1] [Bkw variables, Unit roots, Stable roots]: Parameter Variant(s) #1[54 8 44]

In solve/throwErrWarn at 126 In solve at 109 In run_ertdetected at 179 and the nonlinear simulator throws an error message.

SIR model is very unconventional model (but highly topical). I have not tried to obtain the steady-state outside initial values s=1, i=0, r=0, e=0, d=0. I checked if dynare can solve the model. It, indeed, does. Standard BK conditions are met.

Can I email you the code to non-public email? I would not like to make it public yet.

Cheers,

Antti

pe 28. elok. 2020 klo 18.04 Jaromír Beneš (notifications@github.com) kirjoitti:

Hi Antti

Finally found some spare moments to look into the issues. I am, however, not even able to find a valid steady state solution (experimenting with various options...)

Can you pls send me the way you find the steady state as well? :)))

Jaromir

On Wed, Aug 12, 2020 at 12:58 PM Antti Ripatti notifications@github.com wrote:

It seems that my github skills are bad modelfiles.zip < https://github.com/IRIS-Solutions-Team/IRIS-Toolbox/files/5062203/modelfiles.zip

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/IRIS-Solutions-Team/IRIS-Toolbox/issues/268#issuecomment-672802909 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AGCVKKXVWENIWDPUMZWSF53SAJYUTANCNFSM4P4KWEXA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/IRIS-Solutions-Team/IRIS-Toolbox/issues/268#issuecomment-682675268, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADFU422UGHCM35JRZR7DO3SC7BQJANCNFSM4P4KWEXA .

jaromir-benes commented 4 years ago

Hi Antti - I sort of figured out what kind of model that is and its unusual properties :))

Send me the files to my ogresearch address, jaromir dot benes at ogresearch dot com.

Best Jaromir

On Fri, Aug 28, 2020 at 11:28 PM Antti Ripatti notifications@github.com wrote:

Hi Mirek,

I am working with a more complicated model that builds on the dynare code by Eichenbaum, Rebelo, and Trabandt (the first paper in this list: https://sites.google.com/site/mathiastrabandt/home/research). I use dynare's perfect foresight solution to solve (as does the original code). Since the (final, terminal) steady-state does depend on the initial values (this is a feature of epidemiological SIR model), the t+1 variables are transformed into gross growth rates. This results many unit roots.

I calculate the steady-state analytically. It is called the non-epidemic steady state, ie corresponds s=1, i=0, etc. The code runs ok and chksstate returns 1. Then it says Warning: IRIS Toolbox Warning @ model:solve. *** Solution not available for some parameter variant(s) No stable solution [Parameter Variant(s) #1] [Bkw variables, Unit roots, Stable roots]: Parameter Variant(s) #1[54 8 44]

In solve/throwErrWarn at 126 In solve at 109 In run_ertdetected at 179 and the nonlinear simulator throws an error message.

SIR model is very unconventional model (but highly topical). I have not tried to obtain the steady-state outside initial values s=1, i=0, r=0, e=0, d=0. I checked if dynare can solve the model. It, indeed, does. Standard BK conditions are met.

Can I email you the code to non-public email? I would not like to make it public yet.

Cheers,

Antti

pe 28. elok. 2020 klo 18.04 Jaromír Beneš (notifications@github.com) kirjoitti:

Hi Antti

Finally found some spare moments to look into the issues. I am, however, not even able to find a valid steady state solution (experimenting with various options...)

Can you pls send me the way you find the steady state as well? :)))

Jaromir

On Wed, Aug 12, 2020 at 12:58 PM Antti Ripatti <notifications@github.com

wrote:

It seems that my github skills are bad modelfiles.zip <

https://github.com/IRIS-Solutions-Team/IRIS-Toolbox/files/5062203/modelfiles.zip

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/IRIS-Solutions-Team/IRIS-Toolbox/issues/268#issuecomment-672802909

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AGCVKKXVWENIWDPUMZWSF53SAJYUTANCNFSM4P4KWEXA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/IRIS-Solutions-Team/IRIS-Toolbox/issues/268#issuecomment-682675268 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AADFU422UGHCM35JRZR7DO3SC7BQJANCNFSM4P4KWEXA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/IRIS-Solutions-Team/IRIS-Toolbox/issues/268#issuecomment-683154669, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGCVKKXHUANTXBK4IE7IXB3SDAORNANCNFSM4P4KWEXA .