dynare issueshttps://git.dynare.org/Dynare/dynare/-/issues2019-06-19T15:38:14Zhttps://git.dynare.org/Dynare/dynare/-/issues/554Check whether allowing recursive statements in steady_state_model is possible2019-06-19T15:38:14ZJohannes PfeiferCheck whether allowing recursive statements in steady_state_model is possibleI have a model in logs where I first compute the steady state for the capital and then compute the logs. However, `k=log(k);`
leads to
`ERROR: in the 'steady_state' block, variable 'k' is undefined in the declaration of variable 'k'`
a...I have a model in logs where I first compute the steady state for the capital and then compute the logs. However, `k=log(k);`
leads to
`ERROR: in the 'steady_state' block, variable 'k' is undefined in the declaration of variable 'k'`
although capital was computed earlier on. The preprocessor seems to disallow such recursive statements as it does not recognize that k already exists.
4.5Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/556Change warnings and errors related to steady_state_model2019-06-19T15:38:14ZJohannes PfeiferChange warnings and errors related to steady_state_modelEven substituting the analytical expression for k in
`k=log(k);` in a recursive definition (see #554) does not help, because it leads to
`ERROR: in the 'steady_state' block, variable 'k' is declared twice`
I would prefer to relax this la...Even substituting the analytical expression for k in
`k=log(k);` in a recursive definition (see #554) does not help, because it leads to
`ERROR: in the 'steady_state' block, variable 'k' is declared twice`
I would prefer to relax this last error and make it a warning. There is no reason why we should disallow overwriting previous computations.
At the same time, we do not provide a warning, if not all variables have been defined within a `steady_state_model`. Missing values are simply taken to be 0. This makes debugging of larger models hard. I would suggest to add a warning in this case.
4.5Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/566Deal with stale files that are automatically loaded in computations of e.g. e...2019-06-19T15:38:14ZJohannes PfeiferDeal with stale files that are automatically loaded in computations of e.g. endogenous momentsIn the computation of endogenous moments, e.g. in `correlation_mc_analysis` we have statements like
```
ListOfFiles = dir([ PATH fname '_' TYPE 'Correlations*.mat']);
i1 = 1; tmp = zeros(SampleSize,1);
for file = 1:length(ListOfFiles)
...In the computation of endogenous moments, e.g. in `correlation_mc_analysis` we have statements like
```
ListOfFiles = dir([ PATH fname '_' TYPE 'Correlations*.mat']);
i1 = 1; tmp = zeros(SampleSize,1);
for file = 1:length(ListOfFiles)
```
Hence, all older files with endogenous moments are read out, regardless whether they stem from the current run or are older. This is very dangerous as those additional draws might be from different specifications. I would suggest to automatically delete those files upon running endogenous moments. Note that the same problem with the loading also occurs in identifcation and gsa and sometimes leads to crashes there as the specified number of draws does not coincide with the loaded ones.
4.5https://git.dynare.org/Dynare/dynare/-/issues/570Compatibility with Bison 32019-06-19T15:38:12ZSébastien VillemotCompatibility with Bison 3Dynare is currently incompatible with version 3 of bison.
While fixing this, we should retain compatibility with older versions of bison (at least 2.5).
Dynare is currently incompatible with version 3 of bison.
While fixing this, we should retain compatibility with older versions of bison (at least 2.5).
4.5Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/573Fix bug in interaction of diffuse filter and stoch_simul2019-06-19T15:38:12ZJohannes PfeiferFix bug in interaction of diffuse filter and stoch_simulSee http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5248
See http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5248
4.5MichelJuillardMichelJuillardhttps://git.dynare.org/Dynare/dynare/-/issues/584Improve error messages related to an equation number2019-06-19T15:38:12ZSébastien VillemotImprove error messages related to an equation numberThere are various places (like the detrending engine) where Dynare outputs an error message referring to an equation number.
Unfortunately it is very difficult for the user to find the corresponding equation in the MOD file if there are...There are various places (like the detrending engine) where Dynare outputs an error message referring to an equation number.
Unfortunately it is very difficult for the user to find the corresponding equation in the MOD file if there are lots of equations.
A solution would be to display the line number of the equation. This information can probably be computed in `ParsingDriver` and stored somewhere.
4.5Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/585Fix simpsa2019-06-19T15:38:12ZJohannes PfeiferFix simpsaSimpsa performs well with Bayesian estimation with well-defined priors. However, it is dangerous for ML estimation and Bayesian estimation with `prior_trunc=0` where `LB=-Inf` and `UB=+Inf` . In that case, simpsa will produce garbage due...Simpsa performs well with Bayesian estimation with well-defined priors. However, it is dangerous for ML estimation and Bayesian estimation with `prior_trunc=0` where `LB=-Inf` and `UB=+Inf` . In that case, simpsa will produce garbage due to line 246 using
`P(k+1,k) = LB(k)+rand*(UB(k)-LB(k));`
The infinities in the bounds will lead to NaN in the computation. However, simpsa does not crash, but will typically produce the initial point as its result with
`Change in X less than the specified tolerance (TOLX).`
Example:
```
var m P c e W R k d n l gy_obs gp_obs y dA;
varexo e_a e_m;
parameters alp bet gam mst rho psi del;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
model;
dA = exp(gam+e_a);
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
W = l/n;
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
P*c = m;
m-1+d = l;
e = exp(e_a);
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
gy_obs = dA*y/y(-1);
gp_obs = (P/P(-1))*m(-1)/dA;
end;
initval;
k = 6;
m = mst;
P = 2.25;
c = 0.45;
e = 1;
W = 4;
R = 1.02;
d = 0.85;
n = 0.19;
l = 0.86;
y = 0.6;
gy_obs = exp(gam);
gp_obs = exp(-gam);
dA = exp(gam);
end;
shocks;
var e_a; stderr 0.014;
var e_m; stderr 0.005;
end;
steady_state_model;
dA = exp(gam);
gst = 1/dA;
m = mst;
khst = ( (1-gst*bet*(1-del)) / (alp*gst^alp*bet) )^(1/(alp-1));
xist = ( ((khst*gst)^alp - (1-gst*(1-del))*khst)/mst )^(-1);
nust = psi*mst^2/( (1-alp)*(1-psi)*bet*gst^alp*khst^alp );
n = xist/(nust+xist);
P = xist + nust;
k = khst*n;
l = psi*mst*n/( (1-psi)*(1-n) );
c = mst/P;
d = l - mst + 1;
y = k^alp*n^(1-alp)*gst^alp;
R = mst/bet;
W = l/n;
ist = y-c;
q = 1 - d;
e = 1;
gp_obs = m/dA;
gy_obs = dA;
end;
steady;
check;
estimated_params;
//gam, normal_pdf, 0.0085, 0.003;
//mst, normal_pdf, 1.0002, 0.007;
gam, 0.003;
mst, 0.007;
end;
varobs gp_obs gy_obs;
estimation(order=1,mode_compute=10,prior_trunc=0,datafile=fsdat_simul, nobs=192, loglinear, mh_replic=2000, mh_nblocks=2, mh_jscale=0.8);
```
4.5https://git.dynare.org/Dynare/dynare/-/issues/587new dynare option to suppress diary output2019-06-19T15:38:12ZHoutan Bastaninew dynare option to suppress diary output`nodiary` perhaps. Useful for long dynare runs where the log file would be very large and the user will not use it.
`nodiary` perhaps. Useful for long dynare runs where the log file would be very large and the user will not use it.
4.5Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/589dseries sub-samples2019-06-19T15:38:12ZMichelJuillarddseries sub-samplesIn the manual, I couldn't find the syntax for extracting a subsample from a dseries:
y=x(dates)
In the manual, I couldn't find the syntax for extracting a subsample from a dseries:
y=x(dates)
4.5Stéphane Adjemianstepan@adjemian.euStéphane Adjemianstepan@adjemian.euhttps://git.dynare.org/Dynare/dynare/-/issues/590dseries sub-samples beyond boudary2019-06-19T15:38:12ZMichelJuillarddseries sub-samples beyond boudaryCurrently, one obtains:
``` matlab
>> x=dseries((1:4)');
>> x(dates('2Y'):dates('5Y'))
ans is a dseries object:
| Variable_1
2Y | 2
3Y | 3
4Y | 4
```
Either it should return NaN for 5Y (my preference) or it sho...Currently, one obtains:
``` matlab
>> x=dseries((1:4)');
>> x(dates('2Y'):dates('5Y'))
ans is a dseries object:
| Variable_1
2Y | 2
3Y | 3
4Y | 4
```
Either it should return NaN for 5Y (my preference) or it should return an error. It is not a good idea to return an object that doesn't correspond to the user request.
4.5Stéphane Adjemianstepan@adjemian.euStéphane Adjemianstepan@adjemian.euhttps://git.dynare.org/Dynare/dynare/-/issues/591dseries sub-sample selection with vector of observation indices.2019-06-19T15:38:12ZStéphane Adjemianstepan@adjemian.eudseries sub-sample selection with vector of observation indices.If `ds = dseries(transpose(1:5))` then `ds(2:3)` wrongly returns a matlab's structure:
``` matlab
ans =
data: [2x1 double]
nobs: 2
vobs: 1
freq: 1
dates: [2 dates]
init: [1 dates]
name: {'Variable_1'}...If `ds = dseries(transpose(1:5))` then `ds(2:3)` wrongly returns a matlab's structure:
``` matlab
ans =
data: [2x1 double]
nobs: 2
vobs: 1
freq: 1
dates: [2 dates]
init: [1 dates]
name: {'Variable_1'}
tex: {'Variable\_1'}
```
while it should be a `dseries` object.
4.5Stéphane Adjemianstepan@adjemian.euStéphane Adjemianstepan@adjemian.euhttps://git.dynare.org/Dynare/dynare/-/issues/598Fix specification of confidence level in estimation2019-06-19T15:38:10ZJohannes PfeiferFix specification of confidence level in estimationThe token for specifying the confidence level in `estimation` is `conf_sig`. But the codes actually use `mh_conf_sig`. This needs to be changed in both the manual and the preprocessor.
The token for specifying the confidence level in `estimation` is `conf_sig`. But the codes actually use `mh_conf_sig`. This needs to be changed in both the manual and the preprocessor.
4.5https://git.dynare.org/Dynare/dynare/-/issues/599Fix preprocessor bug2019-02-08T08:31:35ZJohannes PfeiferFix preprocessor bugThe mod-file at http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5310 crashes with:
```
Program: C:\Users\Pfeifer\Dropbox\Dynare Source\GitHub\dynare\matlab\dynare_m.exe
File: ExprNode.cc, Line 491
Expression: type != eExternalFunction...The mod-file at http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5310 crashes with:
```
Program: C:\Users\Pfeifer\Dropbox\Dynare Source\GitHub\dynare\matlab\dynare_m.exe
File: ExprNode.cc, Line 491
Expression: type != eExternalFunction && (lag == 0 || (type != eModelLocalVariable && type != eModFileLocalVariable))
```
The reason seems to be the call to an external function in initval:
```
F=fun_ss(par);
```
Something seems to prevent Dynare from recognizing that F is not known. The minimum working example is the following stripped-down mod-file:
```
var r;
parameters delta;
delta=par(1);
initval;
F=fun_ss(par);
r=F(1);
end;
```
4.5Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/610osr entry in manual2019-06-19T15:38:10ZMichelJuillardosr entry in manualNeed to underlines that osr works only at first order
Need to underlines that osr works only at first order
4.5MichelJuillardMichelJuillardhttps://git.dynare.org/Dynare/dynare/-/issues/611Add conditional check for steady state in unit root models2019-06-19T15:38:10ZJohannes PfeiferAdd conditional check for steady state in unit root modelsAs detailed in #573, for unit root models `options.steadystate.nocheck=1` is set, which implies that there is no check for correctness of the steady state as there are theoretically infinitely many. However, conditional on the trending (...As detailed in #573, for unit root models `options.steadystate.nocheck=1` is set, which implies that there is no check for correctness of the steady state as there are theoretically infinitely many. However, conditional on the trending (exogenous) variable, the steady state should be unique. We should thus test whether this conditional steady state is correct as suggested by @stepan-a instead of allowing to use arbitrary wrong values as supposed steady states.
4.5https://git.dynare.org/Dynare/dynare/-/issues/617Fix translation of histval to one-lag problem2021-09-22T07:54:31ZJohannes PfeiferFix translation of histval to one-lag problemFor deterministic simulations with more than one lag, the translation to a problem with one lag for use in `sim1` does not work.
The mod-file
```
var c k z_forward z_backward;
varexo x z_shock;
parameters alph gam delt bet aa;
alph=0...For deterministic simulations with more than one lag, the translation to a problem with one lag for use in `sim1` does not work.
The mod-file
```
var c k z_forward z_backward;
varexo x z_shock;
parameters alph gam delt bet aa;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
aa=0.5;
model;
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1); // Resource constraint
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam); // Euler equation
z_backward=0.1*1+0.3*z_backward(-1)+0.3*z_backward(-2)+0.3*z_backward(-3)+(x(-4)-1);
z_forward=0.1*1+0.45*z_forward(+1)+0.45*z_forward(+2)+(x(+4)-1);
end;
initval;
c = 1.2;
k = 12;
x = 1;
end;
histval;
x(-1)=1.30;
x(-2)=1.30;
end;
shocks;
var x;
periods 2;
values 0.9;
end;
simul(periods=200,maxit=100);
```
shows that the problem comes from `M_.endo_histval`, which is set to
```
M_.endo_histval = zeros(M_.endo_nbr,M_.maximum_lag);
oo_.exo_simul( M_.maximum_lag + -2, 1 ) = 1.30;
oo_.exo_simul( M_.maximum_lag + -1, 1 ) = 1.30;
```
and thus has more than one initial period.
4.5https://git.dynare.org/Dynare/dynare/-/issues/619Treat exceptions in check2019-06-19T15:38:10ZJohannes PfeiferTreat exceptions in checkCalling `check` together with `noprint` overrides throwing out exceptions in `printinfo`. This can lead to subsequent crashes due to calls like
```
eigenvalues_ = dr.eigval;
```
that try to access fields that are not set in this case....Calling `check` together with `noprint` overrides throwing out exceptions in `printinfo`. This can lead to subsequent crashes due to calls like
```
eigenvalues_ = dr.eigval;
```
that try to access fields that are not set in this case.
My preference would be to locally override the `noprint` option in `check` by replacing
```
if info(1) ~= 0 && info(1) ~= 3 && info(1) ~= 4
print_info(info, options.noprint, options);
end
```
with
```
if info(1) ~= 0 && info(1) ~= 3 && info(1) ~= 4
print_info(info,1, options);
end
```
The typical reaon for using `check` is to only continue if the check is passed. Overriding this by the `noprint`-options seems unintentional and leads to subsequent trouble, see http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4891&p=14256#p14256
4.5https://git.dynare.org/Dynare/dynare/-/issues/624Fix preprocessor bug when model-local variable is specified as an estimated p...2019-06-19T15:38:10ZJohannes PfeiferFix preprocessor bug when model-local variable is specified as an estimated parameterIn the following mod-file `djen` is a model-local variables, but specified in the `estimated_params`-block. The preprocessor then falsely sets
`estim_params_.param_vals = [estim_params_.param_vals; 0, NaN, (-Inf), Inf, 2, 2, 1, NaN, NaN,...In the following mod-file `djen` is a model-local variables, but specified in the `estimated_params`-block. The preprocessor then falsely sets
`estim_params_.param_vals = [estim_params_.param_vals; 0, NaN, (-Inf), Inf, 2, 2, 1, NaN, NaN, NaN ];`
but the first entry is the position in `M_.params` and can never be 0. We should disallow using model-local variables in the parameter blocks.
```
%Model BSB;
var x i dp y n mc mrs c a g dw;
varexo epsilon_a epsilon_g epsilon_ms epsilon_mu;
parameters sigma thetap thetaw beta phi alpha gammay gammapi rhoi rhoa rhog delta mub gam sigmaa sigmams sigmag sigmamu epsilonstar;
model;
#ms=epsilon_ms;
#mu=epsilon_mu;
0 = -sigma * i + sigma * dp(+1) - sigma * g(+1) + sigma * g - c + c(+1);
0 = -y + a + (1-delta) * n;
0 = y - n + mc - x;
0 = -mrs + c / sigma + gam * n - g;
0 = -i + rhoi * i(-1) + gammapi * (1-rhoi) * dp + gammay * (1-rhoi) * y + ms;
0 = -x + x(-1) + dw - dp;
0 = -y + c;
a(+1) = rhoa * a + epsilon_a(+1);
g(+1) = rhog * g + epsilon_g(+1);
%kappap = (1- delta)*(1-thetap*beta)*(1-thetap) / (thetap*(1+delta*(epsib-1)));
%0 = kappap * mc + kappap * mu - dp + beta * dp(+1);
0 = (1- delta)*(1-thetap*beta)*(1-thetap) / (thetap*(1+delta*(epsilonstar-1))) * mc + (1- delta)*(1-thetap*beta)*(1-thetap) / (thetap*(1+delta*(epsilonstar-1))) * mu - dp + beta * dp(+1);
mrs=x;
#djen=(1/(1-thetap))-1;
%epsib = mub / (mub-1);
end;
varobs i dp dw y;
estimated_params;
stderr epsilon_a, normal_pdf,,, 0, sigmaa;
stderr epsilon_g, normal_pdf,,, 0, sigmag;
stderr epsilon_ms, normal_pdf,,, 0, sigmams;
stderr epsilon_mu, normal_pdf,,, 0, sigmamu;
sigmag, uniform_pdf,,, 0, 1;
sigmamu, uniform_pdf,,, 0, 1;
sigmams, uniform_pdf,,, 0, 1;
sigmaa, uniform_pdf,,, 0, 1;
rhoa, uniform_pdf, 0, 1;
rhog, uniform_pdf, 0, 1;
rhoi, uniform_pdf, 0, 1;
gam, normal_pdf, 1, 0.5;
gammay, normal_pdf, 0.125, 0.125;
gammapi, normal_pdf, 1.5, 0.25;
sigma, inv_gamma_pdf, 2, 1.25;
djen, gamma_pdf, 2, 1;
end;
%steady;
%check;
%epsilon = epsib;
%mu = mub;
%end;
steady_state_model;
epsilonstar = mub/ (mub-1);
end;
%steady;
%check;
estimation(datafile=usdata, mh_jscale=0.5);
```
4.5Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/626There is a maximum length for Matlab function names ?2019-02-08T08:30:47ZMichelJuillardThere is a maximum length for Matlab function names ?This function name triggers a warning in R2012b for str2func():
Baseline_gzspread_12614_zlb_hist_nosteady_set_auxiliary_variables
isvarname() doesn't recognize it as a valid name.
That one is OK:
Baseline_gzspread_12614_zlb_hist_nostead...This function name triggers a warning in R2012b for str2func():
Baseline_gzspread_12614_zlb_hist_nosteady_set_auxiliary_variables
isvarname() doesn't recognize it as a valid name.
That one is OK:
Baseline_gzspread_12614_zlb_hist_nosteady_set_auxiliary_variabl
If it has really to do with name length, we need to check for the length of the *.mod file and refuse the ones that are too long.
4.5MichelJuillardMichelJuillardhttps://git.dynare.org/Dynare/dynare/-/issues/633Steady state of a Ramsey model is wrong in some cases2023-03-28T13:03:14ZMichelJuillardSteady state of a Ramsey model is wrong in some casesIf a Lagrange multiplier appears in the Ramsey model with a lead or a lag of more than one period, the steady state may be wrong.
If a Lagrange multiplier appears in the Ramsey model with a lead or a lag of more than one period, the steady state may be wrong.
4.5MichelJuillardMichelJuillard