Hello! I am trying to solve a perfect foresight model with habits in the utility function. I have attached the mod file for your reference. The habit parameter in the code is “kahab”. So, if kahab = 0, there are no habits, but if kahab >0, there are habits.

My code works fine if kahab = 0, i.e., without habits. However, the moment i choose a non-zero value for habits, I get the following error:

The generalized Schur (QZ) decomposition failed. For more information, see the documentation for Lapack function

dgges: info=30, n=16. You can also run model_diagnostics to get more information on what may cause this problem.

Error in check (line 48)

print_info(info, 0, options_);

Error in twohh_manix.driver (line 776)

oo_.dr.eigval = check(M_,options_,oo_);

Error in dynare (line 310)

evalin(‘base’,[fname ‘.driver’]);

On doing the model diagnostics, I get the following:

MODEL_DIAGNOSTICS: The Jacobian of the static model is singular

MODEL_DIAGNOSTICS: there is 2 collinear relationships between the variables and the equations

Relation 1

Collinear variables:

k

hr

cp

cr

r

wr

wp

h

p

y

srate

rel_w

c

Relation 2

Collinear variables:

k

hr

cp

cr

r

wr

wp

h

p

y

srate

rel_w

c

Relation 1

Collinear equations

1 2 3 5 6 7 8 10 11 12 13 14 15 21

Relation 2

Collinear equations

2 3 8 11 12 13 14 15 21

MODEL_DIAGNOSTICS: The presence of a singularity problem typically indicates that there is one

MODEL_DIAGNOSTICS: redundant equation entered in the model block, while another non-redundant equation

MODEL_DIAGNOSTICS: is missing. The problem often derives from Walras Law.

I cannot understand why I get a Walras Law error for a non-zero habit parameter when the code works fine without habits. Can someone kindly suggest a way forward? Many thanks for considering my request.

My code is attached. We just need to comment out the steady state values without habits if choosing kahab = 0.1. And if kahab = 0, we comment out the steady state values corresponding to kahab = 0.1.

twohh_manix_dynare_forum.mod (7.4 KB)

Regards,

Pawan