# Running a loop on a parameter

**URL:** <https://forum.dynare.org/t/running-a-loop-on-a-parameter/10889>\
**Category:** Perfect foresight simulations\
**Created:** [17 October 2017 16:45 UTC](https://forum.dynare.org/t/running-a-loop-on-a-parameter/10889 "2017-10-17T16:45:36Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Dora\_Erdelyi](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/b5e925/32.png) [@Dora\_Erdelyi](https://forum.dynare.org/u/Dora_Erdelyi)\
**Post date:** [25 October 2017 18:06 UTC](https://forum.dynare.org/t/running-a-loop-on-a-parameter/10889/3 "2017-10-25T18:06:54Z")

</div>

Dear Prof. Pfeifer,

As I am a truly beginner, I have a basic problem: loop over parameters. I know that this problem was discussed many times since I found some topics connected with it, but I didn’t find any solution for my problem.  
I combined two model: DSGE and human capital model. The model’s most important parameter is named by „x”: x=private investment into human capital/total investment into human capital, 1-x=government investment into human capital/ total investment into human capital. I would like to let that „x” parameter vary.  
I’ve already tried the given .m code, but it does not work properly (for example it could not recognise „var\_list\_”, or I get the following error: „Index exceeds matrix dimensions”). What should I write after stoc\_simul (or how should I write my variables after stoch\_simul)? Or has my Dynare file another problem?  
I would be thankful for any help.  
Dora  
[dsge\_humancapital.m](https://forum.dynare.org/uploads/default/original/2X/4/48d0ff013c29c554007dcb44fb81e892ae7d49b7.m) (417 Bytes)  
[dsge\_humancapital.mod](https://forum.dynare.org/uploads/default/original/2X/5/5d2bc0cad22492288b92c1d506ecad8db8d87ea3.mod) (1.1 KB)

---

_[View the full topic](https://forum.dynare.org/t/running-a-loop-on-a-parameter/10889)._
