# Two-sector DSGE, (One of the eigenvalues is close to 0/0)

**URL:** <https://forum.dynare.org/t/two-sector-dsge-one-of-the-eigenvalues-is-close-to-0-0/3801>\
**Category:** Dynare help (legacy posts)\
**Created:** [1 April 2014 05:24 UTC](https://forum.dynare.org/t/two-sector-dsge-one-of-the-eigenvalues-is-close-to-0-0/3801 "2014-04-01T05:24:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnwhb](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@johnwhb](https://forum.dynare.org/u/johnwhb)\
**Post date:** [1 April 2014 05:24 UTC](https://forum.dynare.org/t/two-sector-dsge-one-of-the-eigenvalues-is-close-to-0-0/3801/1 "2014-04-01T05:24:24Z")

</div>

Hi my friends, I wonder if anyone can help me see what is wrong with the code. This is a log-linearized two-sector DSGE, where firms use intermediate inputs. I wonder if the problem with the code is due to non-uniqueness of the solution? For theoretical reference, the code is based on [imf.org/external/pubs/ft/wp/2010/wp1082.pdf](http://www.imf.org/external/pubs/ft/wp/2010/wp1082.pdf).  
Thanks so much for your help! I have been stuck on this for so long…

---

<div class="post-metadata">

**Author:** ![johnwhb](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@johnwhb](https://forum.dynare.org/u/johnwhb)\
**Post date:** [1 April 2014 05:25 UTC](https://forum.dynare.org/t/two-sector-dsge-one-of-the-eigenvalues-is-close-to-0-0/3801/2 "2014-04-01T05:25:46Z")

</div>

[code]  
var c\_1 c\_2 c l\_1 l\_2 l p\_1 p\_2 p w m\_11 m\_12 m\_21 m\_22 y\_1 y\_2 a\_1 a\_2 nu;  
varexo eps\_a eps\_nu;  
parameters beta sigma varphi delta theta rho\_a rho\_nu eta\_1 eta\_2  
omega\_1 omega\_2 kappa\_1 kappa\_2;

beta = 0.996;  
sigma = 1;  
varphi = 2;  
delta = 0.3;  
theta = 6;  
rho\_a = 0.9;  
rho\_nu = 0.5;  
eta\_1 = 0.5;  
eta\_2 = 0.5;  
omega\_1 = 0.85;  
omega\_2 = 0.85;  
kappa\_1 = (1-omega\_1_beta)_(1-omega\_1)/omega\_1;  
kappa\_2 = (1-omega\_2_beta)_(1-omega\_2)/omega\_2;

model(linear);  
w - p = varphi_l + c;  
y\_1 = delta_(a\_1 + l\_1) + (1-delta)_(eta\_1_m\_11 + eta\_2_m\_12);  
y\_2 = delta_(a\_2 + l\_2) + (1-delta)_(eta\_1_m\_21 + eta\_2_m\_22);  
p\_1-p\_1(-1) = beta_(p\_1(+1)-p\_1) + kappa\_1\*(delta\*(w-a\_1)+(1-delta)_(eta\_1_p\_1  
+eta\_2_p\_2) - p\_1);  
p\_2-p\_2(-1) = beta_(p\_2(+1)-p\_2) + kappa\_2\*(delta\*(w-a\_2)+(1-delta)_(eta\_1_p\_1  
+eta\_2_p\_2) - p\_2);  
y\_1 = (1-0.583)c\_1 + (0.583)(m\_11 + m\_21);  
y\_2 = (1-0.583)c\_2 + (0.583)(m\_12 + m\_22);  
l = 0.5_l\_1 + 0.5_l\_2;  
p = 0.5_p\_1 + 0.5_p\_2;  
c\_1 = -(p\_1-p) + c;  
c\_2 = -(p\_2-p) + c;  
m\_11 = -(p\_1 - (eta\_1_p\_1+eta\_2_p\_2)) + (eta\_1_m\_11 + eta\_2_m\_12);  
m\_12 = -(p\_2 - (eta\_1_p\_1+eta\_2_p\_2)) + (eta\_1_m\_11 + eta\_2_m\_12);  
m\_21 = -(p\_1 - (eta\_1_p\_1+eta\_2_p\_2)) + (eta\_1_m\_21 + eta\_2_m\_22);  
m\_22 = -(p\_2 - (eta\_1_p\_1+eta\_2_p\_2)) + (eta\_1_m\_21 + eta\_2_m\_22);  
p + c = p(-1) + c(-1) + nu;  
a\_1 = rho\_a_a\_1(-1) + eps\_a;  
a\_2 = rho\_a_a\_2(-1) + eps\_a;  
nu = rho\_nu_nu(-1) + eps\_nu;  
end;

steady;  
check;

shocks;  
var eps\_a = 0.01;  
var eps\_nu = 0.004;

end;

stoch\_simul(order=1,irf=20);[/code]

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [1 April 2014 12:42 UTC](https://forum.dynare.org/t/two-sector-dsge-one-of-the-eigenvalues-is-close-to-0-0/3801/3 "2014-04-01T12:42:35Z")

</div>

Run model\_diagnostics:

[quote]MODEL\_DIAGNOSTICS: The Jacobian of the static model is singular  
MODEL\_DIAGNOSTICS: there is 3 colinear relationships between the variables and the equations  
Relation 1  
Colinear variables:  
c\_1  
c\_2  
c  
l\_1  
l\_2  
l  
p\_1  
p\_2  
p  
w  
m\_11  
m\_12  
m\_21  
m\_22  
y\_1  
y\_2  
Relation 2  
Colinear variables:  
c\_1  
c\_2  
c  
l\_1  
l\_2  
l  
p\_1  
p\_2  
p  
w  
m\_11  
m\_12  
m\_21  
m\_22  
y\_1  
y\_2  
Relation 3  
Colinear variables:  
c\_1  
c\_2  
c  
l\_1  
l\_2  
l  
p\_1  
p\_2  
p  
w  
m\_11  
m\_12  
m\_21  
m\_22  
y\_1  
y\_2  
Relation 1  
Colinear equations  
12 13 14 15

Relation 2  
Colinear equations  
12 13 14 15

Relation 3  
Colinear equations  
16 19

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.[/quote]

---

<div class="post-metadata">

**Author:** ![johnwhb](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@johnwhb](https://forum.dynare.org/u/johnwhb)\
**Post date:** [1 April 2014 14:37 UTC](https://forum.dynare.org/t/two-sector-dsge-one-of-the-eigenvalues-is-close-to-0-0/3801/4 "2014-04-01T14:37:32Z")

</div>

Thanks so much jpfeifer! I get to run the code now. May i ask how i can put several IRF together in one graph?

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [1 April 2014 14:54 UTC](https://forum.dynare.org/t/two-sector-dsge-one-of-the-eigenvalues-is-close-to-0-0/3801/5 "2014-04-01T14:54:22Z")

</div>

Search the forum. See e.g. [[Q: combining IRFs into subplotted figures & iterating?](https://forum.dynare.org/t/q-combining-irfs-into-subplotted-figures-iterating/3609/1))

---

<div class="post-metadata">

**Author:** ![johnwhb](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@johnwhb](https://forum.dynare.org/u/johnwhb)\
**Post date:** [1 April 2014 20:54 UTC](https://forum.dynare.org/t/two-sector-dsge-one-of-the-eigenvalues-is-close-to-0-0/3801/6 "2014-04-01T20:54:53Z")

</div>

Hi jpfeifer,

Sorry to bother you again, I made some changes to the code and run into the same problem again, could you help me see if it is an issue with collinearity again?Thanks very much[code]var c\_1 c\_2 c l\_1 l\_2 l p\_1 p\_2 p w m\_11 m\_12 m\_21 m\_22 y\_1 y\_2 a\_1 a\_2 nu;  
varexo eps\_a1 eps\_a2 eps\_nu;  
parameters beta sigma varphi delta theta rho\_a rho\_nu eta\_1 eta\_2  
omega\_1 omega\_2 kappa\_1 kappa\_2;

beta = 0.996;  
sigma = 1;  
varphi = 2;  
delta = 0.3;  
theta = 6;  
rho\_a = 0.9;  
rho\_nu = 0.5;  
eta\_1 = 0.5;  
eta\_2 = 0.5;  
omega\_1 = 0.85;  
omega\_2 = 0.85;  
kappa\_1 = (1-omega\_1_beta)_(1-omega\_1)/omega\_1;  
kappa\_2 = (1-omega\_2_beta)_(1-omega\_2)/omega\_2;

model(linear);  
w - p = varphi_l + c;  
y\_1 = delta_(a\_1 + l\_1) + (1-delta)_(eta\_1_m\_11 + eta\_2_m\_12);  
y\_2 = delta_(a\_2 + l\_2) + (1-delta)_(eta\_1_m\_21 + eta\_2_m\_22);  
p\_1-p\_1(-1) = beta_(p\_1(+1)-p\_1) + kappa\_1\*(delta\*(w-a\_1)+  
(1-delta)_((1/delta)_(y\_1-eta\_1_m\_11-eta\_2_m\_12)-w-2_a\_1) - p\_1);  
p\_2-p\_2(-1) = beta_(p\_2(+1)-p\_2) + kappa\_2\*(delta\*(w-a\_2)+  
(1-delta)_((1/delta)_(y\_2-eta\_1_m\_21-eta\_2_m\_22)-w-2_a\_2) - p\_2);  
y\_1 = (1 - (1-delta)_(theta-1)/theta)_c\_1 + ((1-delta)_(theta-1)/theta)_(m\_11 + m\_21);  
y\_2 = (1 - (1-delta)_(theta-1)/theta)_c\_2 + ((1-delta)_(theta-1)/theta)_(m\_12 + m\_22);  
l = 0.5_l\_1 + 0.5_l\_2;  
p = 0.5_p\_1 + 0.5_p\_2;  
c\_1 = -(p\_1-p) + c;  
c\_2 = -(p\_2-p) + c;  
m\_11 = -(p\_1 - ((1/delta)_(y\_1-eta\_1_m\_11-eta\_2_m\_12)-w-2_a\_1)) + (eta\_1_m\_11 + eta\_2_m\_12);  
m\_12 = -(p\_2 - ((1/delta)_(y\_2-eta\_1_m\_21-eta\_2_m\_22)-w-2_a\_2)) + (eta\_1_m\_11 + eta\_2_m\_12);  
m\_21 = -(p\_1 - ((1/delta)_(y\_1-eta\_1_m\_11-eta\_2_m\_12)-w-2_a\_1)) + (eta\_1_m\_21 + eta\_2_m\_22);  
m\_22 = -(p\_2 - ((1/delta)_(y\_2-eta\_1_m\_21-eta\_2_m\_22)-w-2_a\_2)) + (eta\_1_m\_21 + eta\_2_m\_22);  
p + c = p(-1) + c(-1) + nu;  
a\_1 = rho\_a_a\_1(-1) + eps\_a1;  
a\_2 = a\_2(-1) + eps\_a2;  
nu = rho\_nu\*nu(-1) + eps\_nu;  
end;

steady;  
check;

shocks;  
var eps\_a1 = 0;  
var eps\_a2 = 0;  
var eps\_nu = 0.004;

end;

stoch\_simul;[/code]

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [2 April 2014 08:09 UTC](https://forum.dynare.org/t/two-sector-dsge-one-of-the-eigenvalues-is-close-to-0-0/3801/7 "2014-04-02T08:09:06Z")

</div>

Just use Dynare 4.4.2 and type

```auto

```

after your model crashed.
