Indeed, not that messy for this model:

```
var d c h y inv k a lambdaa tb ca riskpremium r
y_obs;
varexo e;
parameters gammaa, omegaa, rhoo, sigmae, deltaa, psii, alphaa, phii, r_w, d_bar;
alphaa = 0.32;
rhoo = 0.42;
phii = 0.028;
r_w = 0.04;
gammaa = 2;
omegaa = 1.455;
psii = 0.000742;
deltaa = 0.1;
sigmae = 0.0129;
d_bar = 0.7442;
model;
#betaa = 1/(1+r_w);
#h_ss = ((1-alphaa)*(alphaa/(r_w+deltaa))^(alphaa/(1-alphaa)))^(1/(omegaa-1));
#k_ss = h_ss/(((r_w+deltaa)/alphaa)^(1/(1-alphaa)));
#inv_ss = deltaa*k_ss;
#y_ss = (k_ss^alphaa)*(h_ss^(1-alphaa));
#d_ss = d_bar;
#c_ss = y_ss-inv_ss-r_w*d_ss;
#tb_ss = y_ss-c_ss-inv_ss;
d = (1+exp(r(-1)))*d(-1)- exp(y)+exp(c)+exp(inv)+(phii/2)*(exp(k)-exp(k(-1)))^2;
exp(y) = exp(a)*(exp(k(-1))^alphaa)*(exp(h)^(1-alphaa));
exp(k) = exp(inv)+(1-deltaa)*exp(k(-1));
exp(lambdaa)= betaa*(1+exp(r))*exp(lambdaa(+1));
(exp(c)-((exp(h)^omegaa)/omegaa))^(-gammaa) = exp(lambdaa);
((exp(c)-((exp(h)^omegaa)/omegaa))^(-gammaa))*(exp(h)^omegaa) = exp(lambdaa)*(1-alphaa)*exp(y);
exp(lambdaa)*(1+phii*(exp(k)-exp(k(-1)))) = betaa*exp(lambdaa(+1))*(alphaa*exp(y(+1))/exp(k)+1-deltaa+phii*(exp(inv(+1))-deltaa*exp(k)));
a = rhoo*a(-1)+e;
tb = 1-((exp(c)+exp(inv))/exp(y));
ca = (1/exp(y))*(d-d(-1));
riskpremium = psii*(exp(d-d_bar)-1);
exp(r) = r_w+riskpremium;
y_obs = 0.012+ y-y(-1); //yoy ss growth 4.8%
end;
// dynare solves ss numerically at every iter which explains the slowness
initval;
r = log((1-1/(1+r_w))/(1/(1+r_w)));
d = d_bar;
h = log(((1-alphaa)*(alphaa/(r_w+deltaa))^(alphaa/(1-alphaa)))^(1/(omegaa-1)));
k = log(exp(h)/(((r_w+deltaa)/alphaa)^(1/(1-alphaa))));
inv=log(deltaa)+k;
y=alphaa*k+(1-alphaa)*h;
c=log(exp(y)-exp(inv)-r_w*d);
tb = 1-((exp(c)+exp(inv))/exp(y));
lambdaa= log((exp(c)-((exp(h)^omegaa)/omegaa))^(-gammaa));
y_obs=0.012; //yoy ss growth 4.8%
end;
shocks;
var e; stderr sigmae;
end;
resid(1);
steady;
check;
estimated_params;
alphaa, beta_pdf, 0.3, .005;
rhoo, beta_pdf, 0.42, .002;
phii, beta_pdf, 0.028, .001;
r_w, beta_pdf, 0.02, .005;
gammaa, normal_pdf, 2, .01;
omegaa, normal_pdf, 1.455, .01;
psii, beta_pdf, 0.000742, .0000001;
deltaa, beta_pdf, 0.1, .001;
d_bar, beta_pdf, 0.7442, .001;
//stderr sigmae, inv_gamma_pdf, 0.0129, inf;
end;
varobs y_obs;
estimation(order=1, datafile=grohe_uribe03data, mh_replic=2000, mh_nblocks=2, mh_jscale=0.4,
mode_compute=6, forecast=40) y_obs;
```