# Collinear equation

**URL:** https://forum.dynare.org/t/collinear-equation/18698
**Category:** Stochastic simulations
**Created:** [13 August 2021 19:30 UTC](https://forum.dynare.org/t/collinear-equation/18698 "2021-08-13T19:30:54Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Zak](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@Zak](https://forum.dynare.org/u/Zak)
#### Post date: [13 August 2021 19:30 UTC](https://forum.dynare.org/t/collinear-equation/18698/1 "2021-08-13T19:30:54Z")

</div>

A general question . Trying to understand how to solve the collinear eq issues in Dyn, after model\_diagnostics(M\_,options\_,oo\_)

Dynare says equations 1, 2, 4 and 5 are collinear. To my understanding this implies at least 2 equations are equivalent. Below are the equations I just replicated from a paper. How could these equations be collinear?

[name = ‘(1) consumption’]  
C = ((eta^(1/theta)) \* CO^((theta-1)/theta)+((1-eta)^(1/theta)) \*  
(CNO)^((theta-1)/theta))^(theta/(theta-1));

[name = ‘(2) aggregate price’]  
P = (eta\*(PO)^(1-theta)+(1-eta)\*(PNO)^(1-theta))^(1/(1-theta));

[name =’(3) international oil price’]  
PO = ER \* PO\_star \* O;

[name = ‘(4) Consumtion of oil goods’]  
CO = eta\*((PO/P)^(-theta))\*C;

[name = ‘(5) consumton non-oil goods’]  
CNO = (1-eta)\*((PNO/P)^(-theta))\*C;

---

<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: [14 August 2021 17:35 UTC](https://forum.dynare.org/t/collinear-equation/18698/2 "2021-08-14T17:35:56Z")

</div>

Is there a unit root? That would give rise to collinearity.

---

<div class="post-metadata">

### Author: ![Zak](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@Zak](https://forum.dynare.org/u/Zak)
#### Post date: [16 August 2021 20:41 UTC](https://forum.dynare.org/t/collinear-equation/18698/4 "2021-08-16T20:41:07Z")

</div>

[BaselineMo.mod](https://forum.dynare.org/uploads/short-url/ighLQJFptyogV18NxJoeaaxCbAZ.mod) (9.8 KB)  
[script\_v13WR\_steadystate\_helper.m](https://forum.dynare.org/uploads/short-url/kI4xj0UVgL5KG3YoTHNypwxqs27.m) (255 Bytes)  
[script\_v13CNR\_steadystate\_helper.m](https://forum.dynare.org/uploads/short-url/gaPitOnpDq9WmwFK9GtPB2Q1bks.m) (248 Bytes)

@jpfeifer thanks. Yes there are (but it is a NK so a unit root is a feature) . I ended up with a generalized Schur (QZ) decomposition failure. have been been trying to understand which equations and timing issues could be responsible (I run : model\_diagnostics(M\_,options\_,oo\_). ) but I am not sure yet.Please see the attached

---

<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: [17 August 2021 07:30 UTC](https://forum.dynare.org/t/collinear-equation/18698/5 "2021-08-17T07:30:56Z")

</div>

Simplify your model. One issue present is definitely

> [@Levels versus Growth Rates](https://forum.dynare.org/t/levels-versus-growth-rates/5652/8):
>
> You are confusing something. If collinearity arises after using the steady\_state operator, what you have done is exactly to remove the capability of the model to determine the steady state of that variable as a function of the parameters. Take again the example of the Fisher equation and steady state inflation. If you exogenously provide the steady state inflation pibar (which cannot be endogenously determined), you can endogenously compute the steady state nominal interest as the product of re…

---

<div class="post-metadata">

### Author: ![Zak](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@Zak](https://forum.dynare.org/u/Zak)
#### Post date: [17 August 2021 16:51 UTC](https://forum.dynare.org/t/collinear-equation/18698/6 "2021-08-17T16:51:45Z")

</div>

Thanks a lot I am taking a closer look.

---

<div class="post-metadata">

### Author: ![Zak](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@Zak](https://forum.dynare.org/u/Zak)
#### Post date: [18 August 2021 20:40 UTC](https://forum.dynare.org/t/collinear-equation/18698/7 "2021-08-18T20:40:09Z")

</div>

@jpfeifer I reduced the model to a much simpler version but still facing this error I cannot spot (_**One of the eigenvalues is close to 0/0 (the absolute value of numerator and denominator is**_  
_ **smaller than 0.0000!** _) I reviewed all equations for any possible timing error but still.  
[OilModel0.mod](https://forum.dynare.org/uploads/short-url/9Jn6Rxij6c4T1X8s03nkXIIREwb.mod) (5.5 KB)

---

<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: [19 August 2021 07:10 UTC](https://forum.dynare.org/t/collinear-equation/18698/8 "2021-08-19T07:10:56Z")

</div>

Check for errors and maybe get rid of sticky prices. Why is there a Lagrange multiplier showing up in the aggregate resource constraint.

---

<div class="post-metadata">

### Author: ![Zak](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@Zak](https://forum.dynare.org/u/Zak)
#### Post date: [9 September 2021 21:51 UTC](https://forum.dynare.org/t/collinear-equation/18698/9 "2021-09-09T21:51:08Z")

</div>

Thanks a lot Peifer,  
after simplifying the model into one sector I was able to address the issue. I later added one more sector. Everything looks alright, except that one Eigen value shows Inf (I checked the timing, all look ok). I read in one of your responses in the forum that it is generally not a problem.

While order 1 works fine, order 2 results in mismatching between #eigenvalue(s) larger than 1 in modulus and forward-looking variables (11 for 9). I guess that means there are still issues with the timing. How come? I think it has to do with the way capitals are treated? [Model1\_Twosect.mod](https://forum.dynare.org/uploads/short-url/yMPqOYVRGjjuapdLWB972VCBXvw.mod) (6.3 KB)  
[Model1\_TwosectSS.m](https://forum.dynare.org/uploads/short-url/Z1LlYbBaO0BXGTksiClPCkFgsy.m) (3.6 KB)

---

<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: [10 September 2021 06:34 UTC](https://forum.dynare.org/t/collinear-equation/18698/10 "2021-09-10T06:34:32Z")

</div>

For the code you posted, I get

> Error using print\_info (line 32)  
> The steadystate file did not compute the steady state

---

<div class="post-metadata">

### Author: ![Zak](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@Zak](https://forum.dynare.org/u/Zak)
#### Post date: [10 September 2021 15:10 UTC](https://forum.dynare.org/t/collinear-equation/18698/11 "2021-09-10T15:10:31Z")

</div>

Sorry @jpfeifer about that. These should work. The Matlab file compute the SS first. Thanks.

[Model1\_Twosect.mod](https://forum.dynare.org/uploads/short-url/2zn5rKmF6V9gxjdNmJ2lTo8f8sD.mod) (6.3 KB)  
[Model1\_TwosectSS.m](https://forum.dynare.org/uploads/short-url/eIqcqUr13YCjwy4jMlVIHNqkrYe.m) (3.6 KB)

---

<div class="post-metadata">

### Author: ![Zak](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@Zak](https://forum.dynare.org/u/Zak)
#### Post date: [10 September 2021 20:03 UTC](https://forum.dynare.org/t/collinear-equation/18698/12 "2021-09-10T20:03:12Z")

</div>

Update ! problem solved !!!. I slept on the forum reading your responses to similar questions. The problem came from K KO and KNO, the way they entered the model. Thanks a lot!

---

<div class="post-metadata">

### Author: ![Zak](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@Zak](https://forum.dynare.org/u/Zak)
#### Post date: [18 September 2021 15:13 UTC](https://forum.dynare.org/t/collinear-equation/18698/13 "2021-09-18T15:13:00Z")

</div>

@jpfeifer . When getting NaN for only the Mean and at order 2, what does mean? Order 1 has no issues and impulse functions (for both order 1 and 2) always die out .

APPROXIMATED THEORETICAL MOMENTS (HP filter, lambda = 1600)  
VARIABLE MEAN STD. DEV. VARIANCE  
Y 2.0091 0.0388 0.0015  
IO NaN 0.0019 0.0000  
INO NaN 0.0138 0.0002  
CO NaN 0.0035 0.0000  
CNO NaN 0.0253 0.0006  
YO 1.0015 0.0181 0.0003  
YNO 1.0053 0.0227 0.0005

---

<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: [18 September 2021 18:30 UTC](https://forum.dynare.org/t/collinear-equation/18698/14 "2021-09-18T18:30:02Z")

</div>

I would need to see the file.

---

<div class="post-metadata">

### Author: ![Zak](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@Zak](https://forum.dynare.org/u/Zak)
#### Post date: [19 September 2021 01:29 UTC](https://forum.dynare.org/t/collinear-equation/18698/15 "2021-09-19T01:29:59Z")

</div>

Here are the files. The m file runs the SS  
[Model4\_subsidies.mod](https://forum.dynare.org/uploads/short-url/olAIqLIX6Aqxtk8j4PJIiof9H6Z.mod) (7.4 KB)  
[Model4\_subsidies.m](https://forum.dynare.org/uploads/short-url/p48YO7CjS1dP6JDkHSxiSX6rYOc.m) (4.0 KB)

---

<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: [19 September 2021 07:13 UTC](https://forum.dynare.org/t/collinear-equation/18698/16 "2021-09-19T07:13:16Z")

</div>

The variables with NaN first moments are the unit root variables. Their unconditional mean does not exist.

---

<div class="post-metadata">

### Author: ![Zak](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@Zak](https://forum.dynare.org/u/Zak)
#### Post date: [19 September 2021 12:54 UTC](https://forum.dynare.org/t/collinear-equation/18698/17 "2021-09-19T12:54:13Z")

</div>

Thanks a lot. What I don’t get is that their impulse response gets back to equilibrium for both order 1 and 2, which implies no unit root.

---

<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: [20 September 2021 08:37 UTC](https://forum.dynare.org/t/collinear-equation/18698/18 "2021-09-20T08:37:52Z")

</div>

You can verify in the displayed eigenvalues that there are three unit roots in your model. The reason is you trying to endogenously compute the steady state with the `steady_state`-operator for things that cannot be endogenously determined. See

> [@An infinity of steady states with Taylor rules](https://forum.dynare.org/t/an-infinity-of-steady-states-with-taylor-rules/4026/4):
>
> Could it be that you are trying to use the steady state operator to compute something that cannot be set endogenously? Take inflation: every percentage point higher steady state inflation will increase the steady state nominal interest accordingly. But any consistent combination of both (via the link the Fisher equation provides) is feasible. You need to pin down one of them by setting the value. The model cannot do this for you.

---

<div class="post-metadata">

### Author: ![Zak](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@Zak](https://forum.dynare.org/u/Zak)
#### Post date: [21 September 2021 18:12 UTC](https://forum.dynare.org/t/collinear-equation/18698/19 "2021-09-21T18:12:59Z")

</div>

Thank a lot. I dropped Infl in the SS operator, but It did not bring a difference, I noticed that for the 4 variables where the mean is NaN (i.e CO, CNO / IO INO) their correlation coefficient with C and I is 1. On the other hand, their expressions contains P (a non-stationary variable) as you can see in the file I sent earlier.

CO=eta\*(POtl/Ptl)^(-theta)_C;  
CNO=(1-eta)_(PNO/Ptl)^(-theta)\*C;

IO=eta\*(POtl/Ptl)^(-theta)_I;  
INO=(1-eta)_(PNO/P)^(-theta)\*I;

where  
\_tl = subsidized prices  
O: oil  
NO : non-oil

This could explain why CO CNO IO and INO have a mean Inf ? If yes, is there any a way to go about it? I thought of using Inflation in the expression.

---

<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: [22 September 2021 07:02 UTC](https://forum.dynare.org/t/collinear-equation/18698/20 "2021-09-22T07:02:43Z")

</div>

Please provide the updated file.

---

<div class="post-metadata">

### Author: ![Zak](https://forum.dynare.org/letter_avatar_proxy/v4/letter/z/8e7dd6/32.png) [@Zak](https://forum.dynare.org/u/Zak)
#### Post date: [22 September 2021 12:52 UTC](https://forum.dynare.org/t/collinear-equation/18698/21 "2021-09-22T12:52:06Z")

</div>

Here is the file. Thanks.  
[Model4\_subsidies.mod](https://forum.dynare.org/uploads/short-url/vXau4dhIcdr456vYuM2XIHKUNIU.mod) (7.3 KB)  
[Model4\_subsidiesSS.m](https://forum.dynare.org/uploads/short-url/hIqlgJCjsc4xQDKHhSzQiyLUWEV.m) (4.0 KB)

[Next page](https://forum.dynare.org/t/collinear-equation/18698.md?page=2)
