Perfect Foresight Model with Habits: The generalized Schur (QZ) decomposition failed

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

This looks like a numerical issue. Your steady state values have widely differing scales:

k_ast = 3174.9638312349803 ;
lambda1_ast = 3.243632264128509e-08 ;

That may cause numerical over- and underflow. Habits often make this issue worse.

Dear jpfeifer,

Thanks for your reply! In this deterministic model, K_ast is Capital whereas lambda1_ast is the lagrange multiplier.

Can you please recommend a way of fixing this over-/underflow issue?

Is there an example perfect foresight dynare code with habits?

Thanks,
Pawan

It may be caused by a parameter choice like

barh = 2496; 

I see! But since I am calibrating my model to annual data, barh is basically total labor endowment available to the agent available in one period. So I don’t know how to work around this.

Is there any other possible issue? The model works without habits, but crashes the moment I include habits (QZ decomposition error)

Regards,
Pawan

The straightforward way is usually to normalize the time endowment to 1.

Thank you so much!

Will try this and update

model.mod (5.7 KB)
Dear professor,I meet the similar error, I’m not sure if it’s the model itself (collinear) or something else. Please check it for me, thank you.

How can

Ph = 1/mph;
mph = epsilonh/(epsilonh-1);
log(Ph/Phss) = rhomp*log(Ph(-1)/Phss) - eps_mp; 

be correct? The first two equations define Ph to be constant.

I don’t see a material change in the issue. You still have the three inconsistent equations. I think there is something economically wrong with your setup. Why is the elasticity of substitution now a variable?