# Hall 2011, exp-ing model, my silliness and Berlin

Hey guys,

thanks a lot for the help in this forum first, many of my questions were answered only by reading foreign topics. It is really good, to have such a world-wide community stick together!

But right now I am facing some problems, that I cant explain. I am replicating a model, used by Robert E. Hall 2011 to explain the fluctuations of aftercrisis US-economy with financial friction as a driving source. He implements the friciton as a exogenous driven shock that rises the price of capital for firms and housing for household. Households choose their consumption between “usual” consumption and durable goods and housing, so we have two different kinds of capital here.

Ok, my model doesn’t replicate his results correct, but this is fine for me now, because I have to hand in my thesis on monday and … better this, than nothing. The problem I am facing right now, and which I can’t explain to myself, is: I put an exp() around each endogenous variable, but right know, I get some timing problems!!! This is really driving me crazy, and so I am hoping, that some intelligent genius can help me. If you are reading this … I would be glad, if you help me

Soooo, my code that is running some kind of impulse responses:

``````var y, py, k, d, r, w, c, pk, pd, h, qk, qd, cy, m, mu, f;
varexo e;

parameters sigma, chi, psi, beta, phi, alpha, kappa_k, kappa_d, delta_k, delta_d, omega, rho, rho_g;

sigma   = 0.41;
chi     = 1.01;
//chi     = -1.6713;
//chi     = 0.334;     // from Hall 2009b
psi     = 1.66;
//psi     = 1.54;      // from Hall 2009b
//psi     = 0.66;      // guess
beta    = 0.987;
phi     = 0.82;
alpha   = 0.646;
kappa_k = 8.0;
kappa_d = 8.0;
delta_k = 0.0188;
delta_d = 0.0129;
omega   = 1.03;
rho     = 0.60;
rho_g   = 0.60;

// ##############################################################
// ###                       Model normal                     ###
// ##############################################################

model;

y = (h^alpha) * (k(-1)^(1-alpha));
(1-alpha) * (py * y) / (mu * pk) = k(-1);
//pd * d(-1) = (1 - phi) * c;
pd(+1) * d = (1 - phi) * c(+1);
(w * c^(-1/sigma)) * (1-chi*(1-1/sigma)*h^(1+1/psi)) = (-1*h^(1/psi))*(-chi*(1+1/psi)*c^(1-1/sigma)-1);
(1+r)*m = 1;
y = cy + 0.2 + k - (1-delta_k)*k(-1) + (kappa_k/2) * (((k-k(-1))^2)/k(-1)) + d - (1-delta_d)*d(-1) + ((kappa_d/2)*((d-d(-1))^2)/d(-1));
(phi^(-phi)) * ((1-phi)^(-(1-phi))) * (py^phi) * (pd^(1-phi)) = 1;
//pk = (1 + r(-1)) * (1 + f(-1)) * qk(-1) * py(-1) - (1-delta_k) * qk * py;
//pd = (1 + r(-1)) * (1 + f(-1)) * qd(-1) * py(-1) - (1-delta_d) * qd * py;
pk(+1) = (1 + r) * (1 + f) * qk * py - (1-delta_k) * qk(+1) * py(+1);
pd(+1) = (1 + r) * (1 + f) * qd * py - (1-delta_d) * qd(+1) * py(+1);

// ##### Auxilary Model #####

h = alpha * (py*y) / (mu*w);
qk = kappa_k * (k - k(-1))/(k(-1)) + 1;
qd = kappa_d * (d - d(-1))/(d(-1)) + 1;
cy = phi*c/py;
m = beta * (((c(+1)^(-1/sigma))/c^(-1/sigma)) * ((1-chi*(1-1/sigma)*(h(+1))^(1+1/psi)) / (1-chi*(1-1/sigma)*h^(1+1/psi))));
mu = (y/1.89942907558276)^(-omega);

f = rho*f(-1) + e;
end;

initval;

y   = 1.89942907558276;
py = 1.2054994131041;
k   = 21.2073462421196;
d   = 9.9703287551424;
r   = 0.0129058949799601;
w   = 2.92156533602169;
c   = 1.72314927796078;
pk = 0.038221437790282;
pd = 0.0311089912529679;
h   = 0.506298918774804;
qk  = 1;
qd  = 1;
cy  = 1.17211372528957;
m   = 0.987258544901434;
mu  = 1;
f   = 0;

end;

//model_diagnostics(M_,options_,oo_) ;

check;

write_latex_dynamic_model;
shocks;
var e = 0.015;
//var e_g = 1;
//var e; stderr 0.015;
end;

stoch_simul(order = 1, irf = 10) y k d r pk pd f c h;
``````

And now get ready for my exp-version of the model, that is somehow NOT working. And please be so kind and show me the mistake I made, and that I am not able to find.

``````var y, py, k, d, r, w, c, pk, pd, h, qk, qd, cy, m, mu, f;
varexo e;

parameters sigma, chi, psi, beta, phi, alpha, kappa_k, kappa_d, delta_k, delta_d, omega, rho, rho_g;

sigma   = 0.41;
chi     = 1.01;
//chi     = -1.6713;
//chi     = 0.334;     // from Hall 2009b
psi     = 1.66;
//psi     = 1.54;      // from Hall 2009b
//psi     = 0.66;      // guess
beta    = 0.987;
phi     = 0.82;
alpha   = 0.646;
kappa_k = 8.0;
kappa_d = 8.0;
delta_k = 0.0188;
delta_d = 0.0129;
omega   = 1.03;
rho     = 0.60;
rho_g   = 0.60;

// ##############################################################
// ###                       Model exp                        ###
// ##############################################################
//## on: ( )  ||  off: (/*) ##

model;

exp(y) = (exp(h)^alpha) * (exp(k(-1))^(1-alpha));
(1-alpha) * (exp(py) * exp(y)) / (exp(mu) * exp(pk)) = exp(k(-1));
exp(pd) * exp(d(-1)) = (1 - phi) * exp(c);
//exp(pd(+1)) * exp(d) = (1 - phi) * exp(c(+1));
(exp(w) * exp(c)^(-1/sigma)) * (1-chi*(1-1/sigma)*exp(h)^(1+1/psi)) = (-1*exp(h)^(1/psi))*(-chi*(1+1/psi)*exp(c)^(1-1/sigma)-1);
(1+exp(r))*exp(m) = 1;
exp(y) = exp(cy) + 0.2 + exp(k) - (1-delta_k)*exp(k(-1)) + (kappa_k/2) * (((exp(k)-exp(k(-1)))^2)/exp(k(-1))) + exp(d) - (1-delta_d)*exp(d(-1)) + ((kappa_d/2)*((exp(d)-exp(d(-1)))^2)/exp(d(-1)));
(phi^(-phi)) * ((1-phi)^(-(1-phi))) * (exp(py)^phi) * (exp(pd)^(1-phi)) = 1;
exp(pk) = (1 + exp(r(-1))) * (1 + exp(f(-1))) * exp(qk(-1)) * exp(py(-1)) - (1-delta_k) * exp(qk) * exp(py);
exp(pd) = (1 + exp(r(-1))) * (1 + exp(f(-1))) * exp(qd(-1)) * exp(py(-1)) - (1-delta_d) * exp(qd) * exp(py);
//exp(pk(+1)) = (1 + exp(r)) * (1 + exp(f)) * exp(qk) * exp(py) - (1-delta_k) * exp(qk(+1)) * exp(py(+1));
//exp(pd(+1)) = (1 + exp(r)) * (1 + exp(f)) * exp(qd) * exp(py) - (1-delta_d) * exp(qd(+1)) * exp(py(+1));

// ##### Auxilary Model #####

exp(h) = alpha * (exp(py)*exp(y)) / (exp(mu)*exp(w));
exp(qk) = kappa_k * (exp(k) - exp(k(-1)))/(exp(k(-1))) + 1;
exp(qd) = kappa_d * (exp(d) - exp(d(-1)))/(exp(d(-1))) + 1;
exp(cy) = phi*exp(c)/exp(py);
exp(m) = beta * (((exp(c(+1))^(-1/sigma))/exp(c)^(-1/sigma)) * ((1-chi*(1-1/sigma)*(exp(h(+1)))^(1+1/psi)) / (1-chi*(1-1/sigma)*exp(h)^(1+1/psi))));
//exp(m(-1)) = beta * (((exp(c(0))^(-1/sigma))/exp(c(-1))^(-1/sigma)) * ((1-chi*(1-1/sigma)*(exp(h(0)))^(1+1/psi)) / (1-chi*(1-1/sigma)*exp(h(-1))^(1+1/psi))));
exp(mu) = (exp(y)/exp(1.89942907558276))^(-omega);

f = rho*f(-1) + e;

end;

initval;

y   = log(1.89942907558276);
py  = log(1.2054994131041);
k   = log(21.2073462421196);
d   = log(9.9703287551424);
r   = log(0.0129058949799601);
w   = log(2.92156533602169);
c   = log(1.72314927796078);
pk  = log(0.038221437790282);
pd  = log(0.0311089912529679);
h   = log(0.506298918774804);
qk  = log(1);
qd  = log(1);
cy  = log(1.17211372528957);
m   = log(0.987258544901434);
mu  = log(1);
f   = 0;

end;
check;

shocks;
var e = 0.015;
end;

stoch_simul(order = 1, irf = 10) y k d r pk pd f;``````

If you can help me:
Thanks a lot

Valentin

P.S. If there is someone outside, that can help me to replicate Halls results correctly, I will regard him or her as a friend and he or she will be my guest in berlin, providing a deep look into the beautiful and funny side of this city … … … seriously

If you had timing problem, you can try capital stock first. Is it predetermined variable?

You can declare predetermined_variables k; right after var block. Or change the timing in dynare like

Haven’t tried out your model yet. Hope this can fix your problem.

Cheers!

But I think I didn’t really got your point. Should I declare it direct under the var term, or just as the first equation?

I will play with the timing and post my results!

Best regards,

Valentin

If your problem is to log linearized is instead to linearized I think I fixed the problem

see the attached file
prova2.mod (3.07 KB)

Oh yeah, amazing! Thank you a lot!

I really appreciate your solution, it is in fact quite simple. Only introduce some new variables that are the percentage deviation from the steady state values. Simple, but you have to come to the idea. Thanks again!

My Dynare code is running, but still it is not replicating the results from the original paper. So, if you have time on saturday, maybe you could do some dynare magic, too The euqtions are summarized on 22 with one mistake: (A.4) needs to have minus sign on one site, like one site has to be negative.

Best regards and thanks,

Valentin

By the way, who wants to come to Berlin ?

Hi,
Assuming that you insert correctly the equation and the parameters in the mod file I have a couple of remarks.
I didn’t read deeply the Hall’s paper but at page 30 the author describes the soluton method used,
He used a perfect foresight approach (basicly the dynare simul (or the extended path) command instead of stoch_simul) ans not a stochastic one. Even if for small shock the give “essentially the same results of the log - linearization” this does not mean that they are exacly the same . If the difference between ypur model and the original one are small maybe this is the reason.

So you said, I could reach better results with a deterministic variant of the model? I am checking it out right know, the results are somehow proper, but still I am not convinced.

Can dynare print out some IRFs for a deterministic solution?

Best,
Valentin

Honestly i don’t know.
Hall used a deterministic simulation in his paper,
With a small shock he claimed that the results should be “essentially” the same. But they could differ.
Under deterministic simulation you could plot the path of the endogenous variables to the steady state

after simul

rplot y (or any another endogenous variables) and you could see the path

Hey,

with the deterministic model and the plot of the relative values (Thanks again!) I get quite fine values. I even think, that the values would do a good job, if there wouldn’t be something like a big jump, that my variables do in the beginning of the periods, that I really can’t explain. They jump up, when the shock hits the economy, then jump down again, and than they are back on their path to steady state…

Do you have an idea?

Ah ok, now everything is working perfectly.

Thank you guys for your help, thanks dynare and thanks to my Bachelor.

Best regards,

Valentin

Why don’t you share your working code with us?Maybe it could be usefull …