# How to compute the decision rule matrix oo\_.dr.ghx of a deterministic model?

**URL:** https://forum.dynare.org/t/how-to-compute-the-decision-rule-matrix-oo-dr-ghx-of-a-deterministic-model/13095
**Category:** Stochastic simulations
**Created:** [14 January 2019 18:33 UTC](https://forum.dynare.org/t/how-to-compute-the-decision-rule-matrix-oo-dr-ghx-of-a-deterministic-model/13095 "2019-01-14T18:33:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tgire](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/5fc32e/32.png) [@tgire](https://forum.dynare.org/u/tgire)
#### Post date: [14 January 2019 18:33 UTC](https://forum.dynare.org/t/how-to-compute-the-decision-rule-matrix-oo-dr-ghx-of-a-deterministic-model/13095/1 "2019-01-14T18:33:52Z")

</div>

Hello,

I am trying to get the decision rule matrix oo\_.dr.ghx

If I understand well, it is computed by running the command stoch\_simul, but I get the following error:

error: tril: requested diagonal out of range

Below is a trivial code example. I must be missing something obvious.

Thanks a lot for your help!

Best,  
Thibaut

```
var K q;

parameters
a b delta r alpha dt
K_inf q_inf;

a=1;
b=1;
delta = 0.023;
alpha = 0.33;
r = 0.01;
dt=1;
q_inf = 1+(1+a)*b*delta^a;
K_inf = (((r+delta)*q_inf-a*b*delta^(a+1))/alpha)^(1/(alpha-1));

model;
# I = K(-1)*((q-1)/((1+a)*b))^(1/a);
# w = alpha*K(-1)^(alpha-1)+a*b*(I/K(-1))^(a+1);
K = K(-1) + (I-delta*K(-1))*dt;
q(+1) = q + (r+delta)*q*dt - w*dt;
end;

steady_state_model;
K = K_inf;
q = q_inf;
end;

initval;
K = 20;
q = q_inf;
end;

endval;
K = K_inf;
q = q_inf;
end;

check;

stoch_simul(noprint, order=1);
```

---

<div class="post-metadata">

### Author: ![tgire](https://forum.dynare.org/letter_avatar_proxy/v4/letter/t/5fc32e/32.png) [@tgire](https://forum.dynare.org/u/tgire)
#### Post date: [15 January 2019 10:49 UTC](https://forum.dynare.org/t/how-to-compute-the-decision-rule-matrix-oo-dr-ghx-of-a-deterministic-model/13095/2 "2019-01-15T10:49:06Z")

</div>

It seems actually that stoch\_simul needs some stochastic exogenous variables to be defined.  
How could I then compute the decision rule matrix oo\_.dr.ghx with a deterministic model?  
Thx!  
Thibaut

---

<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 January 2019 07:52 UTC](https://forum.dynare.org/t/how-to-compute-the-decision-rule-matrix-oo-dr-ghx-of-a-deterministic-model/13095/3 "2019-01-18T07:52:57Z")

</div>

Thanks for reporting this. Simply add an unused exogenous variable

```auto
varexo junk;

```

and use the `nostrict` option at command line.
