# Looping a model

**URL:** <https://forum.dynare.org/t/looping-a-model/17880>\
**Category:** Steady state\
**Created:** [14 April 2021 15:16 UTC](https://forum.dynare.org/t/looping-a-model/17880 "2021-04-14T15:16:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![E.Ahmed](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/e19b73/32.png) [@E.Ahmed](https://forum.dynare.org/u/E.Ahmed)\
**Post date:** [14 April 2021 15:16 UTC](https://forum.dynare.org/t/looping-a-model/17880/1 "2021-04-14T15:16:38Z")

</div>

Dear Professors and researchers,  
You will observe that several times I ask looping questions.  
In fact, despite your recommendations, I still have errors and I thought of sharing with you my code if it is possible to help me.  
The code has defined the parameters, the equilibrium model, and this linearized.  
I just detect the results when one of the tax rates (defined as variable tauc, taul, and tauk) varies from 0 to 1.  
[model1.mod](https://forum.dynare.org/uploads/short-url/5qAXaEB6W9bticytxrCNrj3gNHV.mod) (5.7 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:** [14 April 2021 19:51 UTC](https://forum.dynare.org/t/looping-a-model/17880/2 "2021-04-14T19:51:23Z")

</div>

Sorry, but what is your question? There is no loop in the mod-file and it does not produce an error.

---

<div class="post-metadata">

**Author:** ![E.Ahmed](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/e19b73/32.png) [@E.Ahmed](https://forum.dynare.org/u/E.Ahmed)\
**Post date:** [14 April 2021 20:20 UTC](https://forum.dynare.org/t/looping-a-model/17880/3 "2021-04-14T20:20:05Z")

</div>

The problem is that I don’t know the technique to calculate the stationary state vector for T =1, 2, … 100

---

<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:** [15 April 2021 08:46 UTC](https://forum.dynare.org/t/looping-a-model/17880/4 "2021-04-15T08:46:01Z")

</div>

You never clearly outlined what you are trying to do. What is `T` in this context? What do you mean with

> stationary state vector  
> ?

---

<div class="post-metadata">

**Author:** ![E.Ahmed](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/e19b73/32.png) [@E.Ahmed](https://forum.dynare.org/u/E.Ahmed)\
**Post date:** [15 April 2021 11:39 UTC](https://forum.dynare.org/t/looping-a-model/17880/5 "2021-04-15T11:39:12Z")

</div>

Stationary state vector represents the values of the variables at equilibrium. This vector can change when one or more parameters are changed. T represents the government revenues. My goal is to calculate the equilibrium vectors by changing a tax (declared as variable tauc) from 0 up to 100%. But I don’t know how to do it on Dynare.

---

<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:** [15 April 2021 18:04 UTC](https://forum.dynare.org/t/looping-a-model/17880/6 "2021-04-15T18:04:32Z")

</div>

Use

> [@Loop over parameters](https://forum.dynare.org/t/loop-over-parameters/3335/2):
>
> You are not actually setting the parameter. What you should do is use the the set\_param\_value command. Moreover, if you have an analytic steady state, use a steady\_state\_model block instead of initval. You can find an example for such a loop here: [[Need help to check Matlab compatibility](http://forum.dynare.org/t/need-help-to-check-matlab-compatibility/3192/1)). Basically, you need to write a Matlab m-file with the following parts: rhos = 0.8:0.05:1.05; first\_time = 1; for i=1:length(rhos) if first\_time set\_param\_value('rho',rhos(i)); dynare your\_…

---

<div class="post-metadata">

**Author:** ![E.Ahmed](https://forum.dynare.org/letter_avatar_proxy/v4/letter/e/e19b73/32.png) [@E.Ahmed](https://forum.dynare.org/u/E.Ahmed)\
**Post date:** [15 April 2021 20:02 UTC](https://forum.dynare.org/t/looping-a-model/17880/7 "2021-04-15T20:02:09Z")

</div>

I thank you Professor @jpfeifer for your time, and for a Help.
