Closed lulu-mao closed 1 year ago
It is nothing to do with not having a steady_state_model block. The issue is precisely as the error stated. You cannot have constraints that just bind in steady state, e.g. x = max( y, z ) where in steady state y = z.
It is nothing to do with not having a steady_state_model block. The issue is precisely as the error stated. You cannot have constraints that just bind in steady state, e.g. x = max( y, z ) where in steady state y = z.
thank you for your quick reply, so that is the problem I have. what I want to do is to control the deposit interest rate and lending interest rate, taking the lending rate as an example is rl = max(r + delta_b b_ss b, rl_cb); where rl_cb is an interest rate depending on Taylor rule. and in the steady state these two elements on the max function bracket are all equal to zero.
I'm studying the monetary policy in China, so now I'm using the method from Chen, Q., Funke, M. and Paetz, M., 2012. Market and non-market monetary policy tools in a calibrated DSGE model for mainland China. just the interest rate corridor part. so if these steady states are all zero, is it possible to define a non_zero steady-state value for one of them to solve this problem ?@tholden or do I need to change my equations?
Hi lulu-mao I think you are saying the lending rate equals the savings rate plus a spread that increases in debt b for positive debt levels. In steady state, debt is zero, so the spread is zero. As you are finding, this means the constraint just binds in steady state (rl = r = rl_cb ). dynareOBC cannot deal with this case as it is unclear how to set up the news shock problem. If this is the model you want, you could just add a very small steady-state spread, e.g.: rl = max(r + delta_b b_ss b + 0.00001, rl_cb); With this, the constraint is definitely binding in steady state but the multiplier associated with this constraint will be very small (so it should be a good approximation). You should bear in mind though that the constraint will presumably bind very frequently. This means that a) ignoring precautionary effects is likely to deliver a poor approximation as agents will not anticipate the spread being zero for negative b; and b) computation may be slower than other models with OBCs. Good luck!
Hi lulu-mao I think you are saying the lending rate equals the savings rate plus a spread that increases in debt b for positive debt levels. In steady state, debt is zero, so the spread is zero. As you are finding, this means the constraint just binds in steady state (rl = r = rl_cb ). dynareOBC cannot deal with this case as it is unclear how to set up the news shock problem. If this is the model you want, you could just add a very small steady-state spread, e.g.: rl = max(r + delta_b b_ss b + 0.00001, rl_cb); With this, the constraint is definitely binding in steady state but the multiplier associated with this constraint will be very small (so it should be a good approximation). You should bear in mind though that the constraint will presumably bind very frequently. This means that a) ignoring precautionary effects is likely to deliver a poor approximation as agents will not anticipate the spread being zero for negative b; and b) computation may be slower than other models with OBCs. Good luck!
hi jonwarbrick
really thanks for the help, yes, what you are saying is exactly what I'm doing now lending rate equals a rate plus a spread. and I just tried adding 0.00001 on r + delta_b * b_ss but the other error come out
Impossible to find the steady state. Either the model doesn't have a steady state, there are an infinity of steady states, or the guess values are too far from the solution
so I have no idea what to do now, and I have a question, now the interest rates equations are all log-linearized by hand. (all the equations on my model are log- linearized by hand). in this case, is it possible that the steady state for all interest rates is zero? , I checked that all my steady states are zero.
really thanks for the help lulu
Hi Lulu
sure, it will affect the SS as rl would equal the spread. Perhaps instead use:
rl = max(r + delta_b b_ss b - 0.00001, rl_cb);
so then rl = rl_cb = 0 in steady state.
jonathan
Hi Jonswarbrick thanks for the suggestion, it works, abstracting 0.00001 and rl still equals 0 in the steady state, so it won't affect the steady state. and I found another error, I found if I use shock equations in the form of A = A(-1) + rho (A(-1) - A(-2)) + ea instead of A = rhoA(-1) + ea for good productivity shock, ea is i. i. d. innovation. the error occurred, that is Error using SolveBoundsProblem (line 241) Impossible problem encountered. Try increasing TimeToEscapeBounds, or reducing the magnitude of shocks. I've tried increasing TimeToEscapeBounds and reducing the magnitude of shocks. I increase TimeToEscapeBounds to 100, not working. and it can work only when I reduce the stand error of ea to 0.0001. but it's too small. I have 8 shock equations; there are two productivity shocks: good productivity shock and housing productivity shocks. and that error occurred when good productivity shock is expressed as the form of A = A(-1) + rho* (A(-1) - A(-2)) + ea. no error for housing productivity shock in this form. Have you ever had this problem? besides, after running Dynare there are several files automatically produced, eg, filename.m, filename_result, filename_dynamic..., for DynareOBC these files are all learned up. @tholden what should I do if I want to keep these files after running DynareOBC?
many thanks lulu
It sounds like you need to understand your model better before taking it to DynareOBC. In answer to your final question: Run with the nocleanup option. E.g. dynareOBC test.mod nocleanup;
Hi lulu
I agree with Tom - you should make sure to understand the model. But the error is what it says it is - the solver wasn’t able to find a solution. This could either be because a) there is no solution because the model is unstable, b) you are using a poor quality solver (check documentation), or c) the constraint binds for longer than time set by TimeToEscapeBounds.
You would need to check but if the linear model is stable, given the form of constraint, I wouldn’t expect (a) to be an issue. You can check the documentation for (b).
Given you have the constraint almost binding at steady state I would expect (c) to be the culprit. It may take a long time for the effects of the shock to decay. You could set the persistence very low to see (eg rho = 0). And you could set TimeToEscapeBounds much higher. You have tried 100, but perhaps try 200.
I assume you are running stochastic simulations. You could instead just study IRFs. Or you could try running the simulations without the OBC, checking to see how long b can remain positive for. It could be that it remains positive for very long periods of time in which case you would need a very high value for TimeToEscapeBounds (at least as long a longest period of positive b). Often these models are calibrated to have debt almost follow a unit root.
A final thing - the constraint has delta_b b_ss b in. But is b_ss = 0? Should it not be delta_b * b in the constraint? I don’t know the model and haven’t seen the code so I don’t know. It’s just a suggestion. This spread will help get b back to zero. You could also try increasing the value of delta_b.
Good luck Jonathan
Hi lulu
I agree with Tom - you should make sure to understand the model. But the error is what it says it is - the solver wasn’t able to find a solution. This could either be because a) there is no solution because the model is unstable, b) you are using a poor quality solver (check documentation), or c) the constraint binds for longer than time set by TimeToEscapeBounds.
You would need to check but if the linear model is stable, given the form of constraint, I wouldn’t expect (a) to be an issue. You can check the documentation for (b).
Given you have the constraint almost binding at steady state I would expect (c) to be the culprit. It may take a long time for the effects of the shock to decay. You could set the persistence very low to see (eg rho = 0). And you could set TimeToEscapeBounds much higher. You have tried 100, but perhaps try 200.
I assume you are running stochastic simulations. You could instead just study IRFs. Or you could try running the simulations without the OBC, checking to see how long b can remain positive for. It could be that it remains positive for very long periods of time in which case you would need a very high value for TimeToEscapeBounds (at least as long a longest period of positive b). Often these models are calibrated to have debt almost follow a unit root.
A final thing - the constraint has delta_b b_ss b in. But is b_ss = 0? Should it not be delta_b * b in the constraint? I don’t know the model and haven’t seen the code so I don’t know. It’s just a suggestion. This spread will help get b back to zero. You could also try increasing the value of delta_b.
Good luck Jonathan
hi Jonathan
thanks for the suggestions, I've tried 1) rho_ac=0 2) just studying IRFs same error:(Impossible problem encountered. Try increasing TimeToEscapeBounds, or reducing the magnitude of shocks.) I also try running the simulation without OBC, I check b (borrowing), and s (saving) are all negative for every simulation. the solver I've been using is GUROBI. for the constraints equations. I have two constraints. I have b_ss because I log-linear the equation. take the lending rate as an example the model equations are rlt = rt + delta_bbt and I log-linear it by hand I get rlt=rt + delta_bb_ss*bt the calibrated valve for b_ss is 0.05 according to the steady-state equation of rlt. I calibrated delta_b = 1. I've tried to set TimeToEscape to 200, but it seems to need a really long time I've waited for about an hour but it's not enough. so I give up. I do have a warning 'Warning: Your model appears to have an exact unit root. Skipping infinite T tests. ' I don't know how to upload the mod file here so I just copy my code, can please you help me to look at them?
many thanks. lulu
// section 2 model has eta, rl, rd, rd_cb, rl_cb, has all interest rate // model // xinlu mao //warning off // 1) preamble
var c, qh, h, wc, nc, wh, nh, r, ce, ic, ih, y, x, yh, kc, kh, pi, R, GDP, C, I, b, s, eta, rl, rd, rl_cb, rd_cb, rlm, rdm,/ 28 endogenous rl_a,rd_a, / esp_g, esp_p, esp_l, esp_h, esp_pi, esp_mp, esp_ac, esp_ah,esp_ac_lag,esp_ah_lag; / esp_ac_lag, exogenous 8 /
varexo mu_g, mu_p, mu_l, mu_h, mu_pi, mu_MP, mu_ac, mu_ah;
parameters c0,c1,c2,c3,c4,c5,c6,c7,k1,k2,y1,y2,y3,y4,y5,y6,y7,y8,y9,n1,n2; parameters aleph, theta, betah, betaf, delta_h, psi, alpha, omega, delta_kc, delta_kh, phi, rho_r, phi_pi, phi_x, G, lota, sigma, eta_ss, delta_b, b_ss, s_ss, delta_s, phi_eta, phi_pi_eta, phi_r_d, phi_r_l;
parameters sigeg, sigep, sigel, sigeh, sigepi, sigeMP, sigeac, sigeah;
parameters rho_g, rho_p, rho_l, rho_h, rho_pi, rho_MP, rho_ac, rho_ah;
eta_ss = 0.1; delta_b = 1; delta_s = 2; b_ss = 0.05; s_ss = 0.055; phi_eta = 0.6; phi_pi_eta = 10; phi_r_d = 0.5; phi_r_l = 0.7;
/ we initialize our parameters this line is a comment / // the initial value
// fixed parameter according to gaiyue
// discount factor
betah = 0.985;
betaf = 0.97;
//Depreciation of capital (normal goods production)
delta_kc = 0.03;
//Depreciation of capital (house 0.04 production)
delta_kh = 0.04;
//Depreciation of houses
delta_h = 0.015;
G = 0.0297750000000000;
//Inverse of labor elasticity aleph = 0.655095218; //labor substitutability theta = 0.374310971;
// Capital share (normal goods production) alpha = 0.595853498; // Capital share (house production) omega = 0.137563541; // Calvo contract non-resetting probability phi = 0.494048596; // Monetary policy inertia rho_r = 0.684217819;
//Interest-rate response to output growth phi_x = 0.199147408;
// Interest-rate response to inflation phi_pi = 1.024614698; //substitution of housing psi = 0.900795823; //inverse elasiticy of household consumption
lota = 2.167093723;
//inverse elasiticy of firm consumption
sigma = 2.623945589;
c0 = 0.928316672; c1 = 0.346972834; c2 = 0.066076473; c3 = 0.001122862; c4 = 0.75829917; c5 = 0.413932827; c6 = 0.61; c7 = 0.62; n1 = 0.992859269; n2 = 0.097075404; k1 = 0.165987783; k2 = 0.647880534; y1 = 0.979308544; y2 = 0.081581488; y3 = 0.545144555; y4 = 0.50378591; y5 = 0.935366835; y6 = 0.344182206; y7 = 0.999116187; y8 = 0.191543989; y9 = 0.809008077;
rho_g = 0.989885287; rho_p = 0.705365704; rho_l = 0.94634008; rho_h = 0.856756401; rho_pi = 0.961484522; rho_MP = 0.597049679; rho_ac = 0.590354449; rho_ah = -0.276489791;
sigeg = 0.02; sigep = 0.02; sigel = 0.02; sigeh = 0.02; sigepi = 0.02; sigeMP = 0.02; sigeac = 0.02; sigeah = 0.02;
model(linear);
//household // 1)Normal food labor supply
wc = esp_l + (aleph - theta) (n1 nc + n2 nh)+ theta nc + lota * c;
// 2) housing labor supply
wh = esp_l + (aleph - theta)(n1 nc + n2 nh)+ theta nh + lota * c;
// 3)housing demand
h = (lota c - qh - betah (1 - delta_h) (lota c(+1) - qh(+1) + esp_p - esp_p(+1)) + G esp_h)/(G psi);
// 4)euler equation
c = c(+1) - rd (1/ lota) + (esp_p - esp_p(+1)) (1/ lota);
//firms // 5)firm borrowing
// b = b0 ce + b1 (wc + nc)+ b2 (wh +nh)+ b3 ic + b4 ih + (1 + r) b(-1) + r(-1) – b5 (y – x) – b6 (qh + yh)
ce - c6 b = c0 (y - x) + c1 (qh + yh) - c2 (wc + nc) - c3 (wh + nh) - c4 ic - c5 ih - c7 b(-1) - c6 * rl(-1);
// 6)production function for normal goods
y = esp_ac + (1-alpha) nc + alpha kc(-1);
// 7)production function for housing
yh = esp_ah + (1-omega) nh + omega kh(-1);
//8)capital accumulation
kc = (1-delta_kc) kc(-1) + delta_kc ic;
// 9)
kh = (1-delta_kh) kh(-1) + delta_kh ih;
// 10)labor demand
nc = y - x - wc;
// 11)
nh = qh + yh - wh;
// 12) Euler equation
ce = ce(+1) - rl (1/ sigma) + (esp_p - esp_p(+1)) (1/ sigma);
// 13) capital demand for normal goods
alpha k1 (y(+1) - x(+1) - kc) = (1/betaf) ((esp_p - sigma ce) - (esp_p(+1) - sigma * ce(+1)));
// 14) capital demand for housing
omega k2 (yh(+1) + qh(+1) - kh) = (1/betaf) ((esp_p - sigma ce)- (esp_p(+1) - sigma * ce(+1)));
// 15) new Keynesian phillip
pi = betah pi(+1) - ((1 - phi) (1 - betah phi)/phi) x + esp_pi;
//banking sector
//16) budget constraint
s = b + eta_ss/(1 - eta_ss) * eta;
// 17)lending rate
rlm = r + delta_b b_ss b;
rl_cb = (1 - phi_r_l) r + phi_r_l rl_cb(-1);
rl = max(rlm - 0.00001, rl_cb);
//rl = max(r + delta_b b_ss b - 0.00001, rl_cb);
//18) deposit rate
rdm = r -(s_ss delta_s (1 - eta_ss)^2) s + 2 (1 - eta_ss) delta_s s_ss eta; rd_cb = (1 - phi_r_d) r + phi_r_d * rd_cb(-1); rd = min( rdm + 0.00001 , rd_cb);
//rd = min(r -( s_ss delta_s (1 - eta_ss)^2) s + 2 (1 - eta_ss) delta_s s_ss * eta + 0.00001 , rd_cb);
//19) reserve requirement ratio
eta = (1 - phi_eta) phi_pi_eta pi + phi_eta * eta(-1);
// 16) monetary policy
R = rho_r R(-1) + (1 - rho_r) phi_pi pi + (1 - rho_r) phi_x GDP - (1 - rho_r) phi_x * GDP(-1) + esp_mp;
// 17) GDP definition
GDP = y1 y + y2 yh;
// 18) fisher equation
R = r + pi(+1);
// market clearing equation // 19)
y = y3 C + y4 I + esp_g;
// 20)
C = y5 c + y6 ce;
// 21)
I = y7 ic + y8 ih;
// 22)
yh = y9 h - (1-delta_h) y9 * h(-1);
// 8 shocks // government shock
esp_g = rho_g * esp_g(-1) + mu_g;
// intermemporal preference shock
esp_p = rho_p * esp_p(-1) + mu_p;
// labor supply shock
esp_l = rho_l * esp_l(-1) + mu_l;
// housing demand shock
esp_h = rho_h * esp_h(-1) + mu_h;
// inflation shock
esp_pi = rho_pi * esp_pi(-1) + mu_pi;
// monetary policy shock
esp_mp = rho_MP * esp_mp(-1) + mu_MP;
// technology shocks (good production) non-stationary shock
esp_ac = esp_ac(-1) + rho_ac * (esp_ac(-1) - esp_ac_lag(-1)) + mu_ac;
//esp_ac = rho_ac * esp_ac(-1) + mu_ac;
// technology shocks (housing production) non-stationary shock
esp_ah = esp_ah(-1) + rho_ah * (esp_ah(-1) - esp_ah_lag(-1)) + mu_ah;
//esp_ah = rho_ah * esp_ah(-1) + mu_ah;
esp_ac_lag = esp_ac(-1); esp_ah_lag = esp_ah(-1);
end;
//resid(1); //steady;
shocks; var mu_g; stderr sigeg;
var mu_p; stderr sigep;
var mu_l; stderr sigel;
var mu_h; stderr sigeh;
var mu_pi; stderr sigepi;
var mu_MP; stderr sigeMP;
var mu_ac; stderr sigeac;
var mu_ah;
stderr sigeah;
end;
steady_state_model;
c = 0; qh = 0; h = 0; wc = 0; nc = 0; wh = 0; nh = 0; r = 0; ce = 0; ic = 0; ih = 0; y = 0; x = 0; yh = 0; kc = 0; kh = 0; pi = 0; R = 0; GDP = 0; C = 0; I = 0; b = 0; s = 0; eta = 0; rl = 0; rd = 0; rlm = 0; rdm = 0; rl_cb = 0; rd_cb = 0; esp_g = 0; esp_p = 0; esp_l = 0; esp_h = 0; esp_pi = 0; esp_mp = 0; esp_ac = 0; esp_ah = 0; esp_ac_lag = 0; esp_ah_lag = 0;
end;
steady;
check;
//model_diagnostics;
// 4) computation for stocastic model
stoch_simul(order=1,irf=40,periods=1000)y;
Hi lulu
I think you need to get back to the model, make sure you understand it and make sure there are no mistakes in the code. It telling you there is a unit root suggests an issue to me.
Best J
really thanks for the reply, to solve the problem, I read the theory papers related RBC and checked my model code. and I have some questions. 1) in my model the elements in the max and min functions are all related to r(Taylor rule interest rate) which is R = rho_r R(-1) + (1 - rho_r) phi_pi pi + (1 - rho_r) phi_x * (GDP - GDP(-1)) + esp_mp; and r= R - pi(+1) ; take lending rate as an example
rlm = r + delta_b b_ss b; 1)
rl_cb = (1 - phi_r_l) r + phi_r_l rl_cb(-1); 2)
rl = max(rlm - 0.00001, rl_cb);
here r is Taylor rule interest rate. so from the equation 1) and 2) we can see they all depend on r. So my question is can it be the possible cause of the error ( Impossible problem encountered. Try increasing TimeToEscapeBounds, or reducing the magnitude of shocks.) because these two elements are all related to r, and these two may have relationships (I don't know it is just guessing)
2) and the second question is can dynare OBC solve the situation if rlm never escapes rl_cb as time goes by? again thanks for the help.
best wishes lulu
hello everyone I'm using dynareOBC to do a stochastic simulation with the model having max and min functions, but I got the error,under performing second dynare run to get the steady-state. the error is DynareOBC does not support cases in which the constraint just binds in steady-state. is it because I do not contain a steady_state_model block in my dynare file ? Has anyone gotten the same error? could you please help me to solve that? @tholden sir any suggestions? thanks
Xin Lu