dynare issueshttps://git.dynare.org/Dynare/dynare/-/issues2019-06-19T15:38:14Zhttps://git.dynare.org/Dynare/dynare/-/issues/545Phase out global variables2019-06-19T15:38:14ZStéphane Adjemianstepan@adjemian.euPhase out global variables*Created by: MichaelSpece*
Suggested labels: enhancement
The use of global variables renders the code opaque and harder to modify, and dynare more prone to bugs and harder to debug. All functions potentially depend on the global varia...*Created by: MichaelSpece*
Suggested labels: enhancement
The use of global variables renders the code opaque and harder to modify, and dynare more prone to bugs and harder to debug. All functions potentially depend on the global variables in unknown ways (unless the coder is omniscient). Consequently, modifying how global variables work could break any function, and, moreover, any new function which modifies global variables could break existing functions. For similar reasons, multiple dynare instances cannot be run in the same Matlab instance, complicating parallelization (see e.g. http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4981, http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=3531&p=8310&hilit=parfor#p8310, and http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=3530&p=8269&hilit=parfor#p8269). Again because of their universal nature, the relationship among the global variables themselves is opaque (see e.g. #503).
https://git.dynare.org/Dynare/dynare/-/issues/537Metropolis file created with Dynare 4.3.3 can't be loaded by 4.42019-06-19T15:38:14ZMichelJuillardMetropolis file created with Dynare 4.3.3 can't be loaded by 4.4If I'm not mistaken
commit 6390830b4d924df9dba14b3620a77a10409a1880 adds a new field to <fname>_mh_history.mat (record variable): LastLogPost that was not present in version 4.3.3
This breaks compatibility with older <fname>_mh_history.m...If I'm not mistaken
commit 6390830b4d924df9dba14b3620a77a10409a1880 adds a new field to <fname>_mh_history.mat (record variable): LastLogPost that was not present in version 4.3.3
This breaks compatibility with older <fname>_mh_history.mat
I would rather have the new field set to NaN if it is missing in the original file, if it is possible.
4.4Stéphane Adjemianstepan@adjemian.euStéphane Adjemianstepan@adjemian.euhttps://git.dynare.org/Dynare/dynare/-/issues/535dates in mod file2019-06-19T15:38:14ZStéphane Adjemianstepan@adjemian.eudates in mod file`2y` in `disp('Variable toto2y is missing')` should not be interpreted as a date.
`2q4` in `disp('Variable toto2q4 is missing')` should not be interpreted as a date.
but
`2y` in `disp('Variable toto 2y is missing')` should be interpreted...`2y` in `disp('Variable toto2y is missing')` should not be interpreted as a date.
`2q4` in `disp('Variable toto2q4 is missing')` should not be interpreted as a date.
but
`2y` in `disp('Variable toto 2y is missing')` should be interpreted as a date.
`2q4` in `disp('Variable toto 2q4 is missing')` should be interpreted as a date.
When the preprocessor (macro stage) reads the mod file, he should get (for each line) all the words (tokens) and identify the tokens that can be interpreted as dates (using regular expressions).
4.4Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/536Fix mode_compute=82019-06-19T15:38:14ZJohannes PfeiferFix mode_compute=8The header and call to `simplex_optimization_routine` are buggy. The `options` passed to the function seem to be accessed under the name `simplex`. Moreover, `bayestopt_` is passed both as a global variable and as function input.
The header and call to `simplex_optimization_routine` are buggy. The `options` passed to the function seem to be accessed under the name `simplex`. Moreover, `bayestopt_` is passed both as a global variable and as function input.
https://git.dynare.org/Dynare/dynare/-/issues/532Improve Documentation of MS-BVAR2019-06-19T15:38:14ZJohannes PfeiferImprove Documentation of MS-BVARSee http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5139
See http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5139
4.5https://git.dynare.org/Dynare/dynare/-/issues/534Discuss allowed use of endogenous variables outside of model-block2019-06-19T15:38:14ZJohannes PfeiferDiscuss allowed use of endogenous variables outside of model-blockConsider the mod-file
```
var y, c, k, a, h, b;
varexo e, u;
parameters beta, rho, alpha, delta, theta, psi, tau test;
alpha = 0.36;
rho = 0.95;
tau = 0.025;
beta = 0.99;
delta = 0.025;
psi = 0;
theta = 2.95;
phi = 0.1;
test...Consider the mod-file
```
var y, c, k, a, h, b;
varexo e, u;
parameters beta, rho, alpha, delta, theta, psi, tau test;
alpha = 0.36;
rho = 0.95;
tau = 0.025;
beta = 0.99;
delta = 0.025;
psi = 0;
theta = 2.95;
phi = 0.1;
test=y*beta;
model;
c*theta*h^(1+psi)=(1-alpha)*y;
k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))
*(exp(b(+1))*alpha*y(+1)+(1-delta)*k));
y = exp(a)*(k(-1)^alpha)*(h^(1-alpha));
k = exp(b)*(y-c)+(1-delta)*k(-1);
a = rho*a(-1)+tau*b(-1) + e;
b = tau*a(-1)+rho*b(-1) + u;
end;
initval;
y = 1.08068253095672;
c = 0.80359242014163;
h = 0.29175631001732;
k = 11.08360443260358;
a = 0;
b = 0;
e = 0;
u = 0;
end;
shocks;
var e; stderr 0.009;
var u; stderr 0.009;
var e, u = phi*0.009*0.009;
end;
stoch_simul;
```
The definition
`test=y*beta;`
results in the preprocessor plugging in for the endogenous variable `y` with its yet uncomputed steady state, i.e. 0. Users thus can create a circular problem with the steady state of `y` depending on `test` with `test` depending on `y` - and would never notice the problem, because the definition does not result in an error. Would it be possible to block this behavior? If we want to allow users to access the steady state value of endogenous variables outside of the model-block, it should be through the `steady_state`operator.
Or do I miss something that makes this behavior desirable?
4.5https://git.dynare.org/Dynare/dynare/-/issues/529Possible bug in k-order DLL/Dynare++ solver2019-06-19T15:38:14ZSébastien VillemotPossible bug in k-order DLL/Dynare++ solverThe attached MOD-file crashes with the following message:
```
At ./first_order.cweb:55:(255):NaN or Inf asserted in first order derivatives in FirstOrder::solve
```
Removing the `k_order_solver` option solves the issue, so this looks l...The attached MOD-file crashes with the following message:
```
At ./first_order.cweb:55:(255):NaN or Inf asserted in first order derivatives in FirstOrder::solve
```
Removing the `k_order_solver` option solves the issue, so this looks like a bug in k-order DLL.
```
// NonRicardFiscalNKEZSUKRWDisSV Model
// Alex Hsu
// August 23rd, 2013
// Saver-Spender Economy with Price Rigidities, Epstein-Zin Preference
// with Stochastic Continuation Utility
// EZ expressed in terms of Returns on the Wealth Portfolio
// Distortionary Taxation on Capital, Consumption and Labor
// Adjusted Optimal Investment Discount Factor
// 3rd Order Approximation with Stochastic Volatilities
// Variable Declaration
///////////////////////////////////////////////////////////////////////////
// endogenous vars
var m, R_cl, R_c, R_l_star, share, p_c, p_l_star, LI_star, y, x,
m_ns, R_cl_ns, R_c_ns, R_l_star_ns, share_ns, p_c_ns, p_l_star_ns, LI_star_ns
co, cr, no, nr, k, inv, lump, P_real, pi_tot
c, pi, w, n, tau_c, tau_l, tau_k, to, tr, t,
s, h, d, i, f, j, g, z, u,
m_nom, ko, ko_b, invo, Phi, Phi_prime, q, q_b, lambda, lambda_r, mu,
lamb, lamb_r,
y_t2, y_t3, y_t4, y_t5, y_t6, y_t7, y_t8, y_t9, y_t10,
y_t11, y_t12, y_t13, y_t14, y_t15, y_t16, y_t17, y_t18, y_t19, y_t20,
y_t21, y_t22, y_t23, y_t24, y_t25, y_t26, y_t27, y_t28, y_t29, y_t30,
y_t31, y_t32, y_t33, y_t34, y_t35, y_t36, y_t37, y_t38, y_t39, y_t40,
y_t2_hat, y_t3_hat, y_t4_hat, y_t5_hat, y_t6_hat, y_t7_hat, y_t8_hat, y_t9_hat, y_t10_hat,
y_t11_hat, y_t12_hat, y_t13_hat, y_t14_hat, y_t15_hat, y_t16_hat,
y_t17_hat, y_t18_hat, y_t19_hat, y_t20_hat, y_t21_hat, y_t22_hat,
y_t23_hat, y_t24_hat, y_t25_hat, y_t26_hat, y_t27_hat, y_t28_hat,
y_t29_hat, y_t30_hat, y_t31_hat, y_t32_hat, y_t33_hat, y_t34_hat,
y_t35_hat, y_t36_hat, y_t37_hat, y_t38_hat, y_t39_hat, y_t40_hat,
p_t40, p_t39, yslope, xr_t_40, TP40, dc, dc40,
m_f, R_cl_f, R_c_f, R_l_star_f, share_f, p_c_f, p_l_star_f, LI_star_f,
m_f_ns, R_cl_f_ns, R_c_f_ns, R_l_star_f_ns, share_f_ns, p_c_f_ns, p_l_star_f_ns, LI_star_f_ns,
y_f, co_f, cr_f, no_f, nr_f, k_f, inv_f, lump_f, P_real_f,
c_f, w_f, n_f, tau_c_f, tau_l_f, tau_k_f, to_f, tr_f, t_f,
s_f, h_f, d_f, g_f, ko_f, ko_b_f, invo_f, Phi_f, Phi_prime_f,
q_f, q_b_f, lambda_f, lambda_r_f, mu_f,
lamb_f, lamb_r_f;
// exogenous vars
varexo epsilon_g, epsilon_z, epsilon_u,
epsilon_tau_c, epsilon_tau_l, epsilon_tau_k;
// Parameter Declaration
///////////////////////////////////////////////////////////////////////////
parameters beta, psi, gamma, vartheta, omega, theta_mu, alpha, eta, nu, i_bar,
rho_pi, rho_x, rho_i, pi_star, lump_bar, rho_b, varphi, phi_g, phi_g_y, phi_g_b, theta_g,
sigma_g, phi_z, sigma_z, phi_u, sigma_u,
phi_tau_c, phi_tau_c_y, phi_tau_c_b, sigma_tau_c, theta_tau_c, phi_tau_l,
phi_tau_l_y, phi_tau_l_b, sigma_tau_l, theta_tau_l, g_a, delta, zeta, b1, b2, kappa,
phi_tau_k, phi_tau_k_y, phi_tau_k_b, sigma_tau_k, theta_tau_k, D_ss, DoverY_ss, Y_ss,
phi_lambda, phi_lambda_y, phi_lambda_b, sigma_lambda, theta_lambda;
beta = 0.9976; // match i level
psi = 2.8; // 2
gamma = 11; // 16
vartheta = (1-gamma)/(1-psi);
omega = 0.18; // 0.5 lower y vol, increase c vol
theta_mu = 0.5;
alpha = 0.66;
eta = 6;
nu = eta/(eta - 1);
i_bar = 0.02; // 0.0185
rho_pi = 1.65; // match vol of pi
rho_x = 0.9; // ensure cov(y,m)<0
rho_i = 0.8; // match vol of i
pi_star = 0.0133; // match pi level
// fiscal rule
lump_bar = 0.0487;
rho_b = 0.001;
varphi = 0.5; // Cochrane Econometrica
// Productivity
g_a = 0;
delta = 0.021; // Lochstoer
zeta = 0.7;//0.7;//18; // Lochstoer
b1 = (1-delta-exp(g_a))/(zeta-1);
b2 = (exp(g_a)-1+delta)^(1/zeta);
kappa = 0.33;
// government spending shock
phi_g = 0.97;
phi_g_y = -0.009;
phi_g_b = -0.008;
sigma_g = -6.14;
theta_g = 0.1984;
// transitory productivity shock
phi_z = 0.98;
sigma_z = 0.001;
// monetary policy shock
phi_u = 0.145;
sigma_u = 0.0001; // match vol of pi
// consumption tax rate shock
phi_tau_c = 0.99;
phi_tau_c_y = 0.002;
phi_tau_c_b = 0.0006;
sigma_tau_c = -7.11;
theta_tau_c = 0.0775;
// labor tax rate shock
phi_tau_l = 0.99;
phi_tau_l_y = 0.071;
phi_tau_l_b = 0.003;
sigma_tau_l = -6.01;
theta_tau_l = 0.2244;
// capital tax rate shock
phi_tau_k = 0.97;
phi_tau_k_y = 0.1;
phi_tau_k_b = 0.004;
sigma_tau_k = -4.96;
theta_tau_k = 0.3712;
// switching probability shock
phi_lambda = 0.56; // vol of y
phi_lambda_y = 2.8; // vol of pi and i
phi_lambda_b = 3.2; // vol of pi and i
sigma_lambda = 0;
theta_lambda = 4;
// steady states
D_ss = exp(-1.46);
DoverY_ss = 0.3586;
Y_ss = exp(0.26);
// Model Declaration
///////////////////////////////////////////////////////////////////////////
model;
//////////////////////////
// Sticky Price Economy //
//////////////////////////
// marginal rate of substitution of consumption
m = vartheta*log(beta) - (vartheta*psi)*(co - co(-1)) - vartheta*(log(1+tau_c)-log(1+tau_c(-1))) + (vartheta - 1)*R_cl;
exp(R_cl) = (1 - share(-1))*exp(R_c) + share(-1)*exp(R_l_star);
share = 1/(1 - (1 + omega)/(1 - psi)*(1+tau_c)/(1-tau_l)*exp(co)/exp(LI_star)*exp(p_c)/exp(p_l_star));
exp(R_c) = (1+tau_c)*(1 + lambda*exp(p_c))*exp(co)/(1+tau_c(-1))/exp(co(-1))/exp(p_c(-1));
1 = exp(m(+1))*exp(R_c(+1));
exp(R_l_star) = (1-tau_l)*(1 + lambda*exp(p_l_star))*exp(LI_star)/(1-tau_l(-1))/exp(LI_star(-1))/exp(p_l_star(-1));
1 = exp(m(+1))*exp(R_l_star(+1));
exp(LI_star) = exp(w + no);
// real pricing kernel with no switching
m_ns = vartheta*log(beta) - (vartheta*psi)*(co - co(-1)) - vartheta*(log(1+tau_c)-log(1+tau_c(-1))) + (vartheta - 1)*R_cl_ns;
exp(R_cl_ns) = (1 - share_ns(-1))*exp(R_c_ns) + share_ns(-1)*exp(R_l_star_ns);
share_ns = 1/(1 - (1 + omega)/(1 - psi)*(1+tau_c)/(1-tau_l)*exp(co)/exp(LI_star_ns)*exp(p_c_ns)/exp(p_l_star_ns));
exp(R_c_ns) = (1+tau_c)*(1 + exp(p_c_ns))*exp(co)/(1+tau_c(-1))/exp(co(-1))/exp(p_c_ns(-1));
1 = exp(m(+1))*exp(R_c_ns(+1));
exp(R_l_star_ns) = (1-tau_l)*(1 + exp(p_l_star_ns))*exp(LI_star_ns)/(1-tau_l(-1))/exp(LI_star_ns(-1))/exp(p_l_star_ns(-1));
1 = exp(m(+1))*exp(R_l_star_ns(+1));
exp(LI_star_ns) = exp(w + no);
// wage demand equation
w = log(1 + tau_c) - log(1 - tau_l) + psi*co + omega*no;
w = log(1 + tau_c) - log(1 - tau_l) + psi*cr + omega*nr;
// rule-of-thumb FOC
(1 + tau_c)*exp(cr) = (1 - tau_l)*exp(w + nr) - exp(lump);
// consumption aggregation
exp(c) = mu*exp(cr) + (1 - mu)*exp(co);
// labor aggregation
exp(n) = mu*exp(nr) + (1 - mu)*exp(no);
// capital aggregation
exp(k) = (1 - mu)*exp(ko);
// investment aggregation
exp(inv) = (1 - mu)*exp(invo);
// tax aggregation
exp(t) = mu*exp(tr) + (1 - mu)*exp(to);
exp(to) = tau_c*exp(co) + tau_l*exp(w + no) + exp(lump) + tau_k*kappa*exp(y - k(-1))*exp(ko(-1)) - tau_k*delta*exp(ko_b(-1));
exp(tr) = tau_c*exp(cr) + tau_l*exp(w + nr) + exp(lump);
// lump-sum taxes
exp(lump) = lump_bar + rho_b*(exp(d(-1)) - D_ss);
// production function
exp(y) = exp(z)*(exp(k(-1)))^(kappa)*(exp(n))^(1 - kappa);
//Capital accumulation
exp(ko) = ((1 - delta) + Phi)*exp(ko(-1));
//Book Value of Capital accumulation
exp(ko_b) = (1 - delta)*exp(ko_b(-1)) + exp(invo);
//Adjustment cost
Phi = b1 + b2/(1 - 1/zeta)*(exp(invo - ko(-1)))^(1 - 1/zeta);
Phi_prime = b2*exp(invo - ko(-1))^(- 1/zeta);
//Investment return
exp(q) = exp(m_ns(+1))*lambda(+1)*((1 - tau_k(+1))*kappa*exp(y(+1) - k) + exp(q(+1))*(1 - delta + Phi(+1) - Phi_prime(+1)*exp(invo(+1) - ko)));
//Investment return on Book Value
exp(q_b) = exp(m_ns(+1))*lambda(+1)*(tau_k(+1)*delta + exp(q_b(+1))*(1 - delta));
//Marginal q
1 = exp(q)*Phi_prime + exp(q_b);
// //Return on capital
//exp(R_k) = kappa*exp(y - k(-1));
// market clearing condition
1 = exp(c)/exp(y) + exp(inv)/exp(y) + g;
// surplus definition
exp(s)/exp(y) = exp(t)/exp(y) - g;
// government budget constraint
//exp(d(-1)) = exp(s) + P_real*exp(d);
(1 + varphi/(1 - varphi))*exp(d(-1))/exp(s) = exp(h) + varphi/(1 - varphi);
exp(h) = 1 + exp(m(+1) + s(+1) - s + h(+1));
// price rigidities in production
(1/(1 - alpha)*(1 - alpha*(1/exp(pi_star + pi))^(1 - eta)))^(1/(1 - eta))*exp(f) = nu*kappa^(-kappa)*(1 - kappa)^(-(1 - kappa))/exp(z)*(kappa*exp(y - k(-1)))^kappa*exp(w)^(1 - kappa)*exp(j);
exp(f) = 1 + alpha*exp(m_nom(+1) + (y(+1) - y) + eta*(pi_star + pi(+1)) + f(+1));
exp(j) = 1 + alpha*exp(m_nom(+1) + (z - z(+1)) + kappa*(y(+1) - y - k + k(-1)) + (1 - kappa)*(w(+1) - w) + (y(+1) - y) + (1 + eta)*(pi_star + pi(+1)) + j(+1));
// nominal pricing kernel
m_nom = m - (pi + pi_star);
exp(-i) = exp(m_nom(+1));
// output gap
exp(y) = exp(y_f)*exp(x);
// Taylor rule
i = rho_i*i(-1) + (1 - rho_i)*(i_bar + rho_pi*pi + rho_x*x) + u;
// term structure
exp(-2*y_t2) = exp(m_nom(+1) - i(+1));
exp(-3*y_t3) = exp(m_nom(+1) - 2*y_t2(+1));
exp(-4*y_t4) = exp(m_nom(+1) - 3*y_t3(+1));
exp(-5*y_t5) = exp(m_nom(+1) - 4*y_t4(+1));
exp(-6*y_t6) = exp(m_nom(+1) - 5*y_t5(+1));
exp(-7*y_t7) = exp(m_nom(+1) - 6*y_t6(+1));
exp(-8*y_t8) = exp(m_nom(+1) - 7*y_t7(+1));
exp(-9*y_t9) = exp(m_nom(+1) - 8*y_t8(+1));
exp(-10*y_t10) = exp(m_nom(+1) - 9*y_t9(+1));
exp(-11*y_t11) = exp(m_nom(+1) - 10*y_t10(+1));
exp(-12*y_t12) = exp(m_nom(+1) - 11*y_t11(+1));
exp(-13*y_t13) = exp(m_nom(+1) - 12*y_t12(+1));
exp(-14*y_t14) = exp(m_nom(+1) - 13*y_t13(+1));
exp(-15*y_t15) = exp(m_nom(+1) - 14*y_t14(+1));
exp(-16*y_t16) = exp(m_nom(+1) - 15*y_t15(+1));
exp(-17*y_t17) = exp(m_nom(+1) - 16*y_t16(+1));
exp(-18*y_t18) = exp(m_nom(+1) - 17*y_t17(+1));
exp(-19*y_t19) = exp(m_nom(+1) - 18*y_t18(+1));
exp(-20*y_t20) = exp(m_nom(+1) - 19*y_t19(+1));
exp(-21*y_t21) = exp(m_nom(+1) - 20*y_t20(+1));
exp(-22*y_t22) = exp(m_nom(+1) - 21*y_t21(+1));
exp(-23*y_t23) = exp(m_nom(+1) - 22*y_t22(+1));
exp(-24*y_t24) = exp(m_nom(+1) - 23*y_t23(+1));
exp(-25*y_t25) = exp(m_nom(+1) - 24*y_t24(+1));
exp(-26*y_t26) = exp(m_nom(+1) - 25*y_t25(+1));
exp(-27*y_t27) = exp(m_nom(+1) - 26*y_t26(+1));
exp(-28*y_t28) = exp(m_nom(+1) - 27*y_t27(+1));
exp(-29*y_t29) = exp(m_nom(+1) - 28*y_t28(+1));
exp(-30*y_t30) = exp(m_nom(+1) - 29*y_t29(+1));
exp(-31*y_t31) = exp(m_nom(+1) - 30*y_t30(+1));
exp(-32*y_t32) = exp(m_nom(+1) - 31*y_t31(+1));
exp(-33*y_t33) = exp(m_nom(+1) - 32*y_t32(+1));
exp(-34*y_t34) = exp(m_nom(+1) - 33*y_t33(+1));
exp(-35*y_t35) = exp(m_nom(+1) - 34*y_t34(+1));
exp(-36*y_t36) = exp(m_nom(+1) - 35*y_t35(+1));
exp(-37*y_t37) = exp(m_nom(+1) - 36*y_t36(+1));
exp(-38*y_t38) = exp(m_nom(+1) - 37*y_t37(+1));
exp(-39*y_t39) = exp(m_nom(+1) - 38*y_t38(+1));
exp(-40*y_t40) = exp(m_nom(+1) - 39*y_t39(+1));
// risk neutral term structure
exp(-2*y_t2_hat) = exp(-i)*exp(-i(+1));
exp(-3*y_t3_hat) = exp(-i)*exp(-2*y_t2_hat(+1));
exp(-4*y_t4_hat) = exp(-i)*exp(-3*y_t3_hat(+1));
exp(-5*y_t5_hat) = exp(-i)*exp(-4*y_t4_hat(+1));
exp(-6*y_t6_hat) = exp(-i)*exp(-5*y_t5_hat(+1));
exp(-7*y_t7_hat) = exp(-i)*exp(-6*y_t6_hat(+1));
exp(-8*y_t8_hat) = exp(-i)*exp(-7*y_t7_hat(+1));
exp(-9*y_t9_hat) = exp(-i)*exp(-8*y_t8_hat(+1));
exp(-10*y_t10_hat) = exp(-i)*exp(-9*y_t9_hat(+1));
exp(-11*y_t11_hat) = exp(-i)*exp(-10*y_t10_hat(+1));
exp(-12*y_t12_hat) = exp(-i)*exp(-11*y_t11_hat(+1));
exp(-13*y_t13_hat) = exp(-i)*exp(-12*y_t12_hat(+1));
exp(-14*y_t14_hat) = exp(-i)*exp(-13*y_t13_hat(+1));
exp(-15*y_t15_hat) = exp(-i)*exp(-14*y_t14_hat(+1));
exp(-16*y_t16_hat) = exp(-i)*exp(-15*y_t15_hat(+1));
exp(-17*y_t17_hat) = exp(-i)*exp(-16*y_t16_hat(+1));
exp(-18*y_t18_hat) = exp(-i)*exp(-17*y_t17_hat(+1));
exp(-19*y_t19_hat) = exp(-i)*exp(-18*y_t18_hat(+1));
exp(-20*y_t20_hat) = exp(-i)*exp(-19*y_t19_hat(+1));
exp(-21*y_t21_hat) = exp(-i)*exp(-20*y_t20_hat(+1));
exp(-22*y_t22_hat) = exp(-i)*exp(-21*y_t21_hat(+1));
exp(-23*y_t23_hat) = exp(-i)*exp(-22*y_t22_hat(+1));
exp(-24*y_t24_hat) = exp(-i)*exp(-23*y_t23_hat(+1));
exp(-25*y_t25_hat) = exp(-i)*exp(-24*y_t24_hat(+1));
exp(-26*y_t26_hat) = exp(-i)*exp(-25*y_t25_hat(+1));
exp(-27*y_t27_hat) = exp(-i)*exp(-26*y_t26_hat(+1));
exp(-28*y_t28_hat) = exp(-i)*exp(-27*y_t27_hat(+1));
exp(-29*y_t29_hat) = exp(-i)*exp(-28*y_t28_hat(+1));
exp(-30*y_t30_hat) = exp(-i)*exp(-29*y_t29_hat(+1));
exp(-31*y_t31_hat) = exp(-i)*exp(-30*y_t30_hat(+1));
exp(-32*y_t32_hat) = exp(-i)*exp(-31*y_t31_hat(+1));
exp(-33*y_t33_hat) = exp(-i)*exp(-32*y_t32_hat(+1));
exp(-34*y_t34_hat) = exp(-i)*exp(-33*y_t33_hat(+1));
exp(-35*y_t35_hat) = exp(-i)*exp(-34*y_t34_hat(+1));
exp(-36*y_t36_hat) = exp(-i)*exp(-35*y_t35_hat(+1));
exp(-37*y_t37_hat) = exp(-i)*exp(-36*y_t36_hat(+1));
exp(-38*y_t38_hat) = exp(-i)*exp(-37*y_t37_hat(+1));
exp(-39*y_t39_hat) = exp(-i)*exp(-38*y_t38_hat(+1));
exp(-40*y_t40_hat) = exp(-i)*exp(-39*y_t39_hat(+1));
// 1-quarter realized holding period return for 10-year bonds
p_t40 = exp(-40*y_t40);
p_t39 = exp(-39*y_t39);
xr_t_40 = p_t39/p_t40(-1) - exp(i(-1));
// term premium
//rTP40 = -r_t40_hat + r_t40;
TP40 = -y_t40_hat + y_t40;
// slope
//rslope = r_t40 - r;
yslope = y_t40 - i;
// total inflation
pi_tot = pi_star + pi;
// growth
dc = co - co(-1);
dc40 = co(+40) - co(+3);
// Real Bond Price
P_real = exp(m(+1));
// Exogenous Shocks
z = phi_z*z(-1) + sigma_z*epsilon_z;
u = phi_u*u(-1) + sigma_u*epsilon_u;
g = (1 - phi_g)*theta_g + phi_g*g(-1) + phi_g_y*(exp(y(-1)) - Y_ss) + phi_g_b*(exp(d(-1))*P_real(-1)/exp(y(-1)) - DoverY_ss) + exp(sigma_g)*epsilon_g;
tau_c = (1 - phi_tau_c)*theta_tau_c + phi_tau_c*tau_c(-1) + phi_tau_c_y*(exp(y(-1)) - Y_ss) + phi_tau_c_b*(exp(d(-1))*P_real(-1)/exp(y(-1)) - DoverY_ss) + exp(sigma_tau_c)*epsilon_tau_c;
tau_l = (1 - phi_tau_l)*theta_tau_l + phi_tau_l*tau_l(-1) + phi_tau_l_y*(exp(y(-1)) - Y_ss) + phi_tau_l_b*(exp(d(-1))*P_real(-1)/exp(y(-1)) - DoverY_ss) + exp(sigma_tau_l)*epsilon_tau_l;
tau_k = (1 - phi_tau_k)*theta_tau_k + phi_tau_k*tau_k(-1) + phi_tau_k_y*(exp(y(-1)) - Y_ss) + phi_tau_k_b*(exp(d(-1))*P_real(-1)/exp(y(-1)) - DoverY_ss) + exp(sigma_tau_k)*epsilon_tau_k;
lambda = 1/(1 + 1/exp(lamb));
lamb = (1 - phi_lambda)*theta_lambda + phi_lambda*lamb(-1) + phi_lambda_y*(exp(y(-1)) - Y_ss) + phi_lambda_b*(exp(d(-1))*P_real(-1)/exp(y(-1)) - DoverY_ss);
lambda_r = 1/(1 + 1/exp(lamb_r));
lamb_r = (1 - phi_lambda)*theta_lambda + phi_lambda*lamb_r(-1) - phi_lambda_y*(exp(y(-1)) - Y_ss) - phi_lambda_b*(exp(d(-1))*P_real(-1)/exp(y(-1)) - DoverY_ss);
mu = theta_mu + (lambda_r - lambda)/2;
////////////////////////
// Flex Price Economy //
////////////////////////
// marginal rate of substitution of consumption
m_f = vartheta*log(beta) - (vartheta*psi)*(co_f - co_f(-1)) - vartheta*(log(1+tau_c_f)-log(1+tau_c_f(-1))) + (vartheta - 1)*R_cl_f;
exp(R_cl_f) = (1 - share_f(-1))*exp(R_c_f) + share_f(-1)*exp(R_l_star_f);
share_f = 1/(1 - (1 + omega)/(1 - psi)*(1+tau_c_f)/(1-tau_l_f)*exp(co_f)/exp(LI_star_f)*exp(p_c_f)/exp(p_l_star_f));
exp(R_c_f) = (1+tau_c_f)*(1 + lambda_f*exp(p_c_f))*exp(co_f)/(1+tau_c_f(-1))/exp(co_f(-1))/exp(p_c_f(-1));
1 = exp(m_f(+1))*exp(R_c_f(+1));
exp(R_l_star_f) = (1-tau_l_f)*(1 + lambda_f*exp(p_l_star_f))*exp(LI_star_f)/(1-tau_l_f(-1))/exp(LI_star_f(-1))/exp(p_l_star_f(-1));
1 = exp(m_f(+1))*exp(R_l_star_f(+1));
exp(LI_star_f) = exp(w_f + no_f);
// real pricing kernel with no switching
m_f_ns = vartheta*log(beta) - (vartheta*psi)*(co_f - co_f(-1)) - vartheta*(log(1+tau_c_f)-log(1+tau_c_f(-1))) + (vartheta - 1)*R_cl_f_ns;
exp(R_cl_f_ns) = (1 - share_f_ns(-1))*exp(R_c_f_ns) + share_f_ns(-1)*exp(R_l_star_f_ns);
share_f_ns = 1/(1 - (1 + omega)/(1 - psi)*(1+tau_c_f)/(1-tau_l_f)*exp(co_f)/exp(LI_star_f_ns)*exp(p_c_f_ns)/exp(p_l_star_f_ns));
exp(R_c_f_ns) = (1+tau_c_f)*(1 + exp(p_c_f_ns))*exp(co_f)/(1+tau_c_f(-1))/exp(co_f(-1))/exp(p_c_f_ns(-1));
1 = exp(m_f(+1))*exp(R_c_f_ns(+1));
exp(R_l_star_f_ns) = (1-tau_l_f)*(1 + exp(p_l_star_f_ns))*exp(LI_star_f_ns)/(1-tau_l_f(-1))/exp(LI_star_f_ns(-1))/exp(p_l_star_f_ns(-1));
1 = exp(m_f(+1))*exp(R_l_star_f_ns(+1));
exp(LI_star_f_ns) = exp(w_f + no_f);
// wage demand equation
w_f = log(1 + tau_c_f) - log(1 - tau_l_f) + psi*co_f + omega*no_f;
w_f = log(1 + tau_c_f) - log(1 - tau_l_f) + psi*cr_f + omega*nr_f;
// rule-of-thumb FOC
(1 + tau_c_f)*exp(cr_f) = (1 - tau_l_f)*exp(w_f + nr_f) - exp(lump_f);
// consumption aggregation
exp(c_f) = mu*exp(cr_f) + (1 - mu)*exp(co_f);
// labor aggregation
exp(n_f) = mu*exp(nr_f) + (1 - mu)*exp(no_f);
// capital aggregation
exp(k_f) = (1 - mu)*exp(ko_f);
// investment aggregation
exp(inv_f) = (1 - mu)*exp(invo_f);
// tax aggregation
exp(t_f) = mu*exp(tr_f) + (1 - mu)*exp(to_f);
exp(to_f) = tau_c_f*exp(co_f) + tau_l_f*exp(w_f + no_f) + exp(lump_f) + tau_k_f*kappa*exp(y_f - k_f(-1))*exp(ko_f(-1)) - tau_k_f*delta*exp(ko_b_f(-1));
exp(tr_f) = tau_c_f*exp(cr_f) + tau_l_f*exp(w_f + nr_f) + exp(lump_f);
// lump-sum taxes
exp(lump_f) = lump_bar + rho_b*(exp(d_f(-1)) - D_ss);
// production function
exp(y_f) = exp(z)*(exp(k_f(-1)))^(kappa)*(exp(n_f))^(1 - kappa);
//Capital accumulation
exp(ko_f) = ((1 - delta) + Phi_f)*exp(ko_f(-1));
//Book Value of Capital accumulation
exp(ko_b_f) = (1 - delta)*exp(ko_b_f(-1)) + exp(invo_f);
//Adjustment cost
Phi_f = b1 + b2/(1 - 1/zeta)*(exp(invo_f - ko_f(-1)))^(1 - 1/zeta);
Phi_prime_f = b2*exp(invo_f - ko_f(-1))^(- 1/zeta);
//Investment return
exp(q_f) = exp(m_f_ns(+1))*lambda_f(+1)*((1 - tau_k_f(+1))*kappa*exp(y_f(+1) - k_f) + exp(q_f(+1))*(1 - delta + Phi_f(+1) - Phi_prime_f(+1)*exp(invo_f(+1) - ko_f)));
//Investment return on Book Value
exp(q_b_f) = exp(m_f_ns(+1))*lambda_f(+1)*(tau_k_f(+1)*delta + exp(q_b_f(+1))*(1 - delta));
//Marginal q
1 = exp(q_f)*Phi_prime_f + exp(q_b_f);
// market clearing condition
1 = exp(c_f)/exp(y_f) + exp(inv_f)/exp(y_f) + g_f;
// surplus definition
exp(s_f)/exp(y_f) = exp(t_f)/exp(y_f) - g_f;
// government budget constraint
//exp(d_f(-1)) = exp(s_f) + P_real_f*exp(d_f);
(1 + varphi/(1 - varphi))*exp(d_f(-1))/exp(s_f) = exp(h_f) + varphi/(1 - varphi);
exp(h_f) = 1 + exp(m_f(+1) + s_f(+1) - s_f + h_f(+1));
// price rigidities in production
1 = nu*kappa^(-kappa)*(1 - kappa)^(-(1 - kappa))/exp(z)*(kappa*exp(y_f - k_f(-1)))^kappa*exp(w_f)^(1 - kappa);
// Real Bond Price
P_real_f = exp(m_f(+1));
// Exogenous Shocks
g_f = (1 - phi_g)*theta_g + phi_g*g_f(-1) + phi_g_y*(exp(y_f(-1)) - Y_ss) + phi_g_b*(exp(d_f(-1))*P_real_f(-1)/exp(y_f(-1)) - DoverY_ss) + exp(sigma_g)*epsilon_g;
tau_c_f = (1 - phi_tau_c)*theta_tau_c + phi_tau_c*tau_c_f(-1) + phi_tau_c_y*(exp(y_f(-1)) - Y_ss) + phi_tau_c_b*(exp(d_f(-1))*P_real_f(-1)/exp(y_f(-1)) - DoverY_ss) + exp(sigma_tau_c)*epsilon_tau_c;
tau_l_f = (1 - phi_tau_l)*theta_tau_l + phi_tau_l*tau_l_f(-1) + phi_tau_l_y*(exp(y_f(-1)) - Y_ss) + phi_tau_l_b*(exp(d_f(-1))*P_real_f(-1)/exp(y_f(-1)) - DoverY_ss) + exp(sigma_tau_l)*epsilon_tau_l;
tau_k_f = (1 - phi_tau_k)*theta_tau_k + phi_tau_k*tau_k_f(-1) + phi_tau_k_y*(exp(y_f(-1)) - Y_ss) + phi_tau_k_b*(exp(d_f(-1))*P_real_f(-1)/exp(y_f(-1)) - DoverY_ss) + exp(sigma_tau_k)*epsilon_tau_k;
lambda_f = 1/(1 + 1/exp(lamb_f));
lamb_f = (1 - phi_lambda)*theta_lambda + phi_lambda*lamb_f(-1) + phi_lambda_y*(exp(y_f(-1)) - Y_ss) + phi_lambda_b*(exp(d(-1))*P_real(-1)/exp(y(-1)) - DoverY_ss);
lambda_r_f = 1/(1 + 1/exp(lamb_r_f));
lamb_r_f = (1 - phi_lambda)*theta_lambda + phi_lambda*lamb_r_f(-1) - phi_lambda_y*(exp(y_f(-1)) - Y_ss) - phi_lambda_b*(exp(d(-1))*P_real(-1)/exp(y(-1)) - DoverY_ss);
mu_f = theta_mu + (lambda_r_f - lambda_f)/2;
end;
// Initializing Nonlinear Solver
///////////////////////////////////////////////////////////////////////////
initval;
m = -0.00350614 ;
R_cl = 0.00350614 ;
R_c = 0.00350614 ;
R_l_star = 0.00350614 ;
share = 0.163252 ;
p_c = 2.73859 ;
p_l_star = 2.73859 ;
LI_star = -1.87481 ;
y = 0.257669 ;
x = 5.63E-05 ;
m_ns = -0.00350545 ;
R_cl_ns = 0.00350639 ;
R_c_ns = 0.00350627 ;
R_l_star_ns = 0.00350627 ;
share_ns = 0.163252 ;
p_c_ns = 5.65141 ;
p_l_star_ns = 5.65141 ;
LI_star_ns = -1.87481 ;
co = -0.040641 ;
cr = -0.168042 ;
no = -1.6808 ;
nr = 0.300989 ;
k = 1.23046 ;
inv = -2.63277 ;
lump = -3.0213 ;
P_real = 0.9965 ;
pi_tot = 0.00505602 ;
c = -0.105884 ;
pi = -0.00764398 ;
w = -0.194009 ;
n = -0.221467 ;
tau_c = 0.0656594 ;
tau_l = 0.146779 ;
tau_k = 0.336165 ;
to = -0.948767 ;
tr = -1.31829 ;
t = -1.12684 ;
s = -6.46838 ;
h = 5.6;
d = -1.50304 ;
i = 0.00856216 ;
f = 1.12248 ;
j = 1.13304 ;
g = 0.249247 ;
z = 5.26E-19 ;
u = -8.49E-22 ;
m_nom = -0.00856216 ;
ko = 1.98126 ;
ko_b = 1.98126 ;
invo = -1.88197 ;
Phi = 0.021 ;
Phi_prime = 1 ;
q = -0.081807 ;
q_b = -2.54402 ;
lambda = 0.938851 ;
lambda_r = 0.994876 ;
mu = 0.528012 ;
lamb = 2.73134 ;
lamb_r = 5.26866 ;
y_t2 = 0.00856216 ;
y_t3 = 0.00856216 ;
y_t4 = 0.00856216 ;
y_t5 = 0.00856216 ;
y_t6 = 0.00856216 ;
y_t7 = 0.00856216 ;
y_t8 = 0.00856215 ;
y_t9 = 0.00856215 ;
y_t10 = 0.00856215 ;
y_t11 = 0.00856215 ;
y_t12 = 0.00856215 ;
y_t13 = 0.00856215 ;
y_t14 = 0.00856215 ;
y_t15 = 0.00856215 ;
y_t16 = 0.00856215 ;
y_t17 = 0.00856215 ;
y_t18 = 0.00856215 ;
y_t19 = 0.00856215 ;
y_t20 = 0.00856215 ;
y_t21 = 0.00856215 ;
y_t22 = 0.00856214 ;
y_t23 = 0.00856214 ;
y_t24 = 0.00856214 ;
y_t25 = 0.00856214 ;
y_t26 = 0.00856214 ;
y_t27 = 0.00856214 ;
y_t28 = 0.00856214 ;
y_t29 = 0.00856214 ;
y_t30 = 0.00856213 ;
y_t31 = 0.00856213 ;
y_t32 = 0.00856213 ;
y_t33 = 0.00856213 ;
y_t34 = 0.00856213 ;
y_t35 = 0.00856213 ;
y_t36 = 0.00856212 ;
y_t37 = 0.00856212 ;
y_t38 = 0.00856212 ;
y_t39 = 0.00856212 ;
y_t40 = 0.00856212 ;
y_t2_hat = 0.00856216 ;
y_t3_hat = 0.00856216 ;
y_t4_hat = 0.00856216 ;
y_t5_hat = 0.00856216 ;
y_t6_hat = 0.00856216 ;
y_t7_hat = 0.00856216 ;
y_t8_hat = 0.00856215 ;
y_t9_hat = 0.00856215 ;
y_t10_hat = 0.00856215 ;
y_t11_hat = 0.00856215 ;
y_t12_hat = 0.00856215 ;
y_t13_hat = 0.00856215 ;
y_t14_hat = 0.00856215 ;
y_t15_hat = 0.00856215 ;
y_t16_hat = 0.00856215 ;
y_t17_hat = 0.00856215 ;
y_t18_hat = 0.00856215 ;
y_t19_hat = 0.00856215 ;
y_t20_hat = 0.00856215 ;
y_t21_hat = 0.00856215 ;
y_t22_hat = 0.00856214 ;
y_t23_hat = 0.00856214 ;
y_t24_hat = 0.00856214 ;
y_t25_hat = 0.00856214 ;
y_t26_hat = 0.00856214 ;
y_t27_hat = 0.00856214 ;
y_t28_hat = 0.00856214 ;
y_t29_hat = 0.00856214 ;
y_t30_hat = 0.00856213 ;
y_t31_hat = 0.00856213 ;
y_t32_hat = 0.00856213 ;
y_t33_hat = 0.00856213 ;
y_t34_hat = 0.00856213 ;
y_t35_hat = 0.00856213 ;
y_t36_hat = 0.00856212 ;
y_t37_hat = 0.00856212 ;
y_t38_hat = 0.00856212 ;
y_t39_hat = 0.00856212 ;
y_t40_hat = 0.00856212 ;
p_t40 = 0.710004 ;
p_t39 = 0.716109 ;
yslope = -5.77E-18 ;
xr_t_40 = 9.93E-18 ;
TP40 = -5.09E-17 ;
dc = 0 ;
dc40 = 0 ;
m_f = -0.00350614 ;
R_cl_f = 0.00350614 ;
R_c_f = 0.00350614 ;
R_l_star_f = 0.00350614 ;
share_f = 0.163972 ;
p_c_f = 2.73816 ;
p_l_star_f = 2.73816 ;
LI_star_f = -1.86991 ;
m_f_ns = -0.00350545 ;
R_cl_f_ns = 0.00350639 ;
R_c_f_ns = 0.00350627 ;
R_l_star_f_ns = 0.00350627 ;
share_f_ns = 0.163972 ;
p_c_f_ns = 5.65141 ;
p_l_star_f_ns = 5.65141 ;
LI_star_f_ns = -1.86991 ;
y_f = 0.257613 ;
co_f = -0.040634 ;
cr_f = -0.167716 ;
no_f = -1.67635 ;
nr_f = 0.300477 ;
k_f = 1.23022 ;
inv_f = -2.63301 ;
lump_f = -3.02128 ;
P_real_f = 0.9965 ;
c_f = -0.105719 ;
w_f = -0.193553 ;
n_f = -0.221433 ;
tau_c_f = 0.0656821 ;
tau_l_f = 0.146449 ;
tau_k_f = 0.336005 ;
to_f = -0.948876 ;
tr_f = -1.31955 ;
t_f = -1.12746 ;
s_f = -6.46481 ;
h_f = -5.6;
d_f = -1.49948 ;
g_f = 0.249103 ;
ko_f = 1.98102 ;
ko_b_f = 1.98102 ;
invo_f = -1.88221 ;
Phi_f = 0.021 ;
Phi_prime_f = 1 ;
q_f = -0.0817364 ;
q_b_f = -2.54485 ;
lambda_f = 0.938823 ;
lambda_r_f = 0.994878 ;
mu_f = 0.528028 ;
lamb_f = 2.73086 ;
lamb_r_f = 5.26914 ;
end;
shocks;
var epsilon_g = 1;
var epsilon_z = 1;
var epsilon_u = 1;
var epsilon_tau_c = 1;
var epsilon_tau_l = 1;
var epsilon_tau_k = 1;
end;
// Dynare Model Simulation
///////////////////////////////////////////////////////////////////////////
steady;
check;
stoch_simul(order=1, k_order_solver, periods=0, drop=0, nograph) y, c, inv, k, w, m_nom, m,
co, cr, n, no, nr, t, to, tr,
g, s, d, tau_c, tau_l, tau_k, mu, lambda, lambda_r,
pi_tot, i, y_t4, y_t8, y_t12, y_t16, y_t20, y_t40, yslope, xr_t_40, TP40,
R_c, R_l_star, q;
```
4.4https://git.dynare.org/Dynare/dynare/-/issues/531Check initialization of static_and_dynamic_models_differ2019-06-19T15:38:14ZJohannes PfeiferCheck initialization of static_and_dynamic_models_differDuring a classroom session today a Linux-user encountered a strange error with the recent snapshot. Whenever he used the `steady;` command, he got
```
Reference to non-existent field
'static_and_dynamic_models_differ'.
Error in evaluat...During a classroom session today a Linux-user encountered a strange error with the recent snapshot. Whenever he used the `steady;` command, he got
```
Reference to non-existent field
'static_and_dynamic_models_differ'.
Error in evaluate_steady_state (line 127)
if M.static_and_dynamic_models_differ
Error in steady_ (line 54)
[steady_state,params,info] =
evaluate_steady_state(oo_.steady_state,M_,options_,oo_,~options_.steadystate.nocheck);
Error in steady (line 81)
[steady_state,M_.params,info] = steady_(M_,options_,oo_);
Error in mymodel (line 152)
steady;
Error in dynare (line 147)
evalin('base',fname) ;
```
I cannot replicate the issue under Windows, but as far as I can see, the field `static_and_dynamic_models_differ` is only set in the preprocessor. Could it be that it is not always properly initialized?
Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/530checking singularity in first order approximation2021-08-15T19:44:22ZMichelJuillardchecking singularity in first order approximationCurrently, we don't check for singularity in first order approximation when solving for static variables (is b10 singular?) or solving for shocks coefficient (is A_ singular?)
1) We should probably add a warning to stoch_simul (and ramse...Currently, we don't check for singularity in first order approximation when solving for static variables (is b10 singular?) or solving for shocks coefficient (is A_ singular?)
1) We should probably add a warning to stoch_simul (and ramsey_policy)
2) Should we care for estimation? Should expand the implicit prior to b10 and A_ non-singular?
3) If b10 is singular, the model has a problem: it is not possible to determine some static variable from the solution of the dynamic part of the model
4) The conditions under which A_ can be singular are mode difficult to determine.
https://git.dynare.org/Dynare/dynare/-/issues/526Support the estimation of static models2018-11-08T11:49:07ZJohannes PfeiferSupport the estimation of static modelsSee http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5120
It seems not all variables are correctly initialized
See http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5120
It seems not all variables are correctly initialized
https://git.dynare.org/Dynare/dynare/-/issues/525Check prior truncation2019-06-19T15:38:14ZJohannes PfeiferCheck prior truncationThere are two issues:
a) There are three cases where priors are/should be truncated in Dynare
1. If the user explicitly specifies this
2. If the prior for a correlation has mass outside [-1,1]
3. If prior for standard deviations has mas...There are two issues:
a) There are three cases where priors are/should be truncated in Dynare
1. If the user explicitly specifies this
2. If the prior for a correlation has mass outside [-1,1]
3. If prior for standard deviations has mass below 0.
#522 suggests to issue a warning in cases 2 and 3. However, the point where truncation is problematic is computing marginal data densities. I suggest to set a flag for all three cases and issue a warning in marginal_density if the prior was truncated.
b) I am not sure I understand the prior truncation in case 1 above. The manual says that the prior does not integrate to 1 anymore. This is fine. But in `set_prior.m` we have code like
```
k = find(bayestopt_.pshape == 4);
k1 = find(isnan(bayestopt_.p3(k)));
k2 = find(isnan(bayestopt_.p4(k)));
bayestopt_.p3(k(k1)) = zeros(length(k1),1);
bayestopt_.p4(k(k2)) = Inf(length(k2),1);
for i=1:length(k)
[bayestopt_.p6(k(i)),bayestopt_.p7(k(i))] = ...
inverse_gamma_specification(bayestopt_.p1(k(i))-bayestopt_.p3(k(i)),bayestopt_.p2(k(i)),1,0) ;
bayestopt_.p5(k(i)) = compute_prior_mode([ bayestopt_.p6(k(i)) , bayestopt_.p7(k(i)) , bayestopt_.p3(k(i)) ], 4) ;
end
```
The way I read this, the mean of the prior seems to take the truncation in p3 into account. Thus, instead of fixing the prior distribution according to mean and variance and then truncating it, it seems we are partially setting the mean of the truncated distribution. I am not sure this behavior is desired/expected by the user. We at least need to document what Dynare is doing here.
https://git.dynare.org/Dynare/dynare/-/issues/522Deal with negative estimated standard deviation2019-06-19T15:38:14ZJohannes PfeiferDeal with negative estimated standard deviationIn #392 we had the issue that we do not enforce positive standard deviations. I thus proposed 72208b1b7c7075211edde8fd71e363ccf0d01ca4. @stepan-a suggested that optimizers might dislike the resulting cliff at 0 and that negative standard...In #392 we had the issue that we do not enforce positive standard deviations. I thus proposed 72208b1b7c7075211edde8fd71e363ccf0d01ca4. @stepan-a suggested that optimizers might dislike the resulting cliff at 0 and that negative standard deviations are perfectly equivalent for the likelihood to the positive ones. Unfortunately, I don't see this as they are not always squared for covariance elements.
In any case, if @stepan-a is correct, we still need to adapt the saving and displaying of parameter estimation results to not confuse users with negative numbers.
https://git.dynare.org/Dynare/dynare/-/issues/521Check treatment of covariances in DSGE-VAR2019-06-19T15:38:16ZJohannes PfeiferCheck treatment of covariances in DSGE-VARIn the wake of #392, #494, and #511 various issues with parameter updating around covariance matrices have been detected. None of these changes have been ported to `DsgeVarLikelihood` as the file still contains a TODO list in the comment...In the wake of #392, #494, and #511 various issues with parameter updating around covariance matrices have been detected. None of these changes have been ported to `DsgeVarLikelihood` as the file still contains a TODO list in the comments that suggests that bigger changes are required.
4.5Stéphane Adjemianstepan@adjemian.euStéphane Adjemianstepan@adjemian.euhttps://git.dynare.org/Dynare/dynare/-/issues/519mode_compute consistency check2019-06-19T15:38:16ZMichelJuillardmode_compute consistency checkIn unstable, we have added a check that reports an error if the parameters contained in a previously computed mode don't match the list of currently estimated ones.
Some users (Christiano, Motto, Rostagno, 2013, public code for Risk Shoc...In unstable, we have added a check that reports an error if the parameters contained in a previously computed mode don't match the list of currently estimated ones.
Some users (Christiano, Motto, Rostagno, 2013, public code for Risk Shocks, AER) rely on the behavior of version 4.3.2 that didn't perform this check.
I suggest to transform the error in warning and use the prior mean to initialize estimated parameters that are missing in the previously computed mode.
4.4Stéphane Adjemianstepan@adjemian.euStéphane Adjemianstepan@adjemian.euhttps://git.dynare.org/Dynare/dynare/-/issues/520Weibull prior distibution2021-08-02T11:31:20ZMichelJuillardWeibull prior distibutionCMR 2013 are using a Weibull prior distribution. I suggest to add it to the list of prior used by Dynare
CMR 2013 are using a Weibull prior distribution. I suggest to add it to the list of prior used by Dynare
4.5Johannes PfeiferJohannes Pfeiferhttps://git.dynare.org/Dynare/dynare/-/issues/517Discuss saving of results2019-06-19T15:38:16ZJohannes PfeiferDiscuss saving of resultsBy default, Dynare only saves the first three of the global structures
```
M_ options_ oo_ estim_params_ bayestopt_ dataset_
```
to the harddisk. We might want accomodate the additional new structures that have been added over time as...By default, Dynare only saves the first three of the global structures
```
M_ options_ oo_ estim_params_ bayestopt_ dataset_
```
to the harddisk. We might want accomodate the additional new structures that have been added over time as not all required information is stored in M_, oo_, and options_.
Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/515Deal with cases where no var_exo are specified2019-02-08T08:30:47ZJohannes PfeiferDeal with cases where no var_exo are specifiedIn mod-files without specified exogenous variables, the respective fields associated with them are not set. This leads to cryptic error messages: http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5100
We should either disallow such mod-f...In mod-files without specified exogenous variables, the respective fields associated with them are not set. This leads to cryptic error messages: http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5100
We should either disallow such mod-files or simply set
```
M_.maximum_exo_lag=0;
M_.maximum_exo_lead=0;
```
https://git.dynare.org/Dynare/dynare/-/issues/506Fix check for balanced growth path2019-06-19T15:38:16ZSébastien VillemotFix check for balanced growth pathThe check implemented in the preprocessor for the balanced growth path does not work well for `logtrend_var`.
Fixing it does not seem trivial, at least it requires some thinking. In the meantime, we may disable the check to make GPM work.
The check implemented in the preprocessor for the balanced growth path does not work well for `logtrend_var`.
Fixing it does not seem trivial, at least it requires some thinking. In the meantime, we may disable the check to make GPM work.
4.4Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/504Discuss and document the load_mh_file option2019-06-19T15:38:16ZJohannes PfeiferDiscuss and document the load_mh_file optionThe current behavior of the `load_mh_file`-option with it recomputing the mode, the Hessian, and the scale-factor by default seems counterintuitive. Given the fixed seed, one should get the same results, but there is the risk of them cha...The current behavior of the `load_mh_file`-option with it recomputing the mode, the Hessian, and the scale-factor by default seems counterintuitive. Given the fixed seed, one should get the same results, but there is the risk of them changing between the reloaded chain and the new elements to be added and thus having a chain with difffering proposal densities. We should at least document this behavior and potentially reload the mode-file by default. See also http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5051
4.5https://git.dynare.org/Dynare/dynare/-/issues/505ms-sbvar: support flat option2019-06-19T15:38:16ZHoutan Bastanims-sbvar: support flat option4.4Houtan BastaniHoutan Bastani