# Problems with more than one lag of a variable

**URL:** <https://forum.dynare.org/t/problems-with-more-than-one-lag-of-a-variable/486>\
**Category:** Dynare v4 (legacy)\
**Created:** [16 November 2007 17:44 UTC](https://forum.dynare.org/t/problems-with-more-than-one-lag-of-a-variable/486 "2007-11-16T17:44:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ansgar](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@Ansgar](https://forum.dynare.org/u/Ansgar)\
**Post date:** [16 November 2007 17:44 UTC](https://forum.dynare.org/t/problems-with-more-than-one-lag-of-a-variable/486/1 "2007-11-16T17:44:50Z")

</div>

Dear all,  
I have the following problem: In the model I am simulating I have for one variable two lags and one lead in one of the equations. The model works fine if I restrict the parameters such that the second lag vanishes, and then type the restricted equation (the one without the second lag) into the code and comment out the unrestricted one. However, if I simulate the unrestricted model, I receive the following statement (this follows the computation of the steady state values, which correspond to my own results, and the check of the eigenvalue/forward looking variables condition, which is fullfilled):

MODEL SIMULATION

??? Index exceeds matrix dimensions.

Error in ==\> simk at 164  
temp(:,iy\_\_) = temp(:,iy\_\_)-w0\*c(j1i,1:ncc1) ;

Error in ==\> simul at 60  
simk ;

Error in ==\> overheadgamma8HF at 243  
simul(oo\_.dr);

Error in ==\> dynare at 49  
evalin(‘base’,fname) ;

As I mentioned above, the model works fine with only one lag in that respective equation, thus it seesm that it is the second lag which causes the problem. However, I thought that Dynare does support two lags of variables? Any comments would be much appreciated!  
Best,  
Ansgar

---

<div class="post-metadata">

**Author:** ![MichelJuillard](https://forum.dynare.org/user_avatar/forum.dynare.org/micheljuillard/32/5318_2.png) [@MichelJuillard](https://forum.dynare.org/u/MichelJuillard)\
**Post date:** [1 December 2007 17:44 UTC](https://forum.dynare.org/t/problems-with-more-than-one-lag-of-a-variable/486/2 "2007-12-01T17:44:35Z")

</div>

Dear Ansgar,

could you please post your model or send it to me?  
Thanks

Michel

---

<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:** [24 July 2017 13:30 UTC](https://forum.dynare.org/t/problems-with-more-than-one-lag-of-a-variable/486/3 "2017-07-24T13:30:52Z")

</div>


