# Practice code for upcoming exam

**URL:** <https://forum.dynare.org/t/practice-code-for-upcoming-exam/26916>\
**Category:** Stochastic simulations\
**Created:** [20 December 2024 07:32 UTC](https://forum.dynare.org/t/practice-code-for-upcoming-exam/26916 "2024-12-20T07:32:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sxllik](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/3da27b/32.png) [@Sxllik](https://forum.dynare.org/u/Sxllik)\
**Post date:** [20 December 2024 07:32 UTC](https://forum.dynare.org/t/practice-code-for-upcoming-exam/26916/1 "2024-12-20T07:32:10Z")

</div>

![image](https://forum.dynare.org/uploads/default/original/3X/2/3/2381f3b1e868ee03082fd92dd933a817e60fce2f.png)

Hi All,

Please see the above model in my mock paper,

I’m really unsure as to where I’m going wrong here,

Is anyone able to help?

I have attached my mod file,

Thanks,

[Coursework\_prac.mod](https://forum.dynare.org/uploads/short-url/6QX8vUIrO7CVSB8cOsROg7KXhpC.mod) (626 Bytes)

---

<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 December 2024 07:40 UTC](https://forum.dynare.org/t/practice-code-for-upcoming-exam/26916/2 "2024-12-20T07:40:56Z")

</div>

What exactly is your question?

---

<div class="post-metadata">

**Author:** ![Sxllik](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/3da27b/32.png) [@Sxllik](https://forum.dynare.org/u/Sxllik)\
**Post date:** [20 December 2024 10:47 UTC](https://forum.dynare.org/t/practice-code-for-upcoming-exam/26916/3 "2024-12-20T10:47:50Z")

</div>

Sorry,

I should’ve been clearer,

In part (a) it says determine which policy is preferrable at minimizing the sums of the variances of both inflation and the output gap.

If you run the mod file I have uploaded, it says in the Variance Decomposition output section dmt (equation 6) has no affect on shocks (displays it as NaN).

I’m not sure where in my mod file I have gone wrong to get this output.

Just looking through can you see where I have, or how would you write code for this question?

Cheers,

---

<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 December 2024 11:39 UTC](https://forum.dynare.org/t/practice-code-for-upcoming-exam/26916/4 "2024-12-20T11:39:18Z")

</div>

There are two monetary policy rules. You cannot have both at the same time. Use the attached code to select one of the two regimes:  
[Coursework\_prac.mod](https://forum.dynare.org/uploads/short-url/407fP5uddwJfD3BT30FTiR5NZ0E.mod) (676 Bytes)

---

<div class="post-metadata">

**Author:** ![Sxllik](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/3da27b/32.png) [@Sxllik](https://forum.dynare.org/u/Sxllik)\
**Post date:** [20 December 2024 12:29 UTC](https://forum.dynare.org/t/practice-code-for-upcoming-exam/26916/5 "2024-12-20T12:29:24Z")

</div>

For some reason I am getting the exact same results when running it, even when changing money\_rule from true to false and vice versa

---

<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 December 2024 13:40 UTC](https://forum.dynare.org/t/practice-code-for-upcoming-exam/26916/6 "2024-12-20T13:40:07Z")

</div>

For the money growth rule, I get

```auto
THEORETICAL MOMENTS
VARIABLE MEAN STD. DEV. VARIANCE
x 0.0000 1.9922 3.9690
pi 0.0000 0.0793 0.0063
l 0.0000 2.0539 4.2184
r 0.0000 1.1547 1.3333
i 0.0000 0.1982 0.0393
dmt 0.0000 2.3167 5.3670

```

and for the interest rate rule I get

```auto
THEORETICAL MOMENTS
VARIABLE MEAN STD. DEV. VARIANCE
x 0.0000 0.8807 0.7756
pi 0.0000 0.0247 0.0006
l 0.0000 0.0785 0.0062
r 0.0000 1.1547 1.3333
i 0.0000 0.9179 0.8426
dmt 0.0000 0.0000 0.0000

```
