dynare issueshttps://git.dynare.org/Dynare/dynare/-/issues2019-06-19T15:38:16Zhttps://git.dynare.org/Dynare/dynare/-/issues/477use of tags in write_latex_dynamic_model2019-06-19T15:38:16ZMarco Rattouse of tags in write_latex_dynamic_modelwould it be possible to add tag info in the write_latex_dynamic_model, e.g. by inserting a simple text line with tags info before each equation?
would it be possible to add tag info in the write_latex_dynamic_model, e.g. by inserting a simple text line with tags info before each equation?
4.5Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/476Fix preprocessor bug related to estimated_params_init2019-06-19T15:38:16ZJohannes Pfeifer Fix preprocessor bug related to estimated_params_initThe file
```
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;
check;
estimated_params;
alp, beta_pdf, 0.356, 0.02;
bet, beta_pdf, 0.993, 0.002;
gam, normal_pdf, 0.0085, 0.003;
mst, normal_pdf, 1.0002, 0.007;
rho,2, normal_pdf, 0.129, 0.223;
psi, beta_pdf, 0.65, 0.05;
del, beta_pdf, 0.01, 0.005;
stderr e_a, inv_gamma_pdf, 0.035449, inf;
stderr e_m, inv_gamma_pdf, 0.008862, inf;
corr e_a, e_m, normal_pdf, 0, 0.007;
stderr gp_obs, inv_gamma_pdf, 0.008862, inf;
corr gp_obs, gy_obs, normal_pdf, 0, 0.007;
end;
varobs gp_obs gy_obs;
estimated_params_init;
stderr e_a, 0.014000;
stderr e_m, 0.005000;
stderr gp_obs, 0.000000;
corr e_a, e_m, 0.000000;
corr gp_obs, gy_obs, 0.000000;
alp, 0.330000;
bet, 0.990000;
gam, 0.003000;
mst, 1.011000;
rho, 0.700000;
psi, 0.787000;
del, 0.020000;
end;
estimation(order=1, datafile=fsdat_simul, nobs=192, loglinear, mh_replic=2000, mh_nblocks=2, mh_jscale=0.8,prior_trunc=0);
```
creates matlab code
```
tmp1 = find((estim_params_.corrx(:,1)==1)) & (estim_params_.corrx(:,2)==2);
tmp1 = find((estim_params_.corrn(:,1)==12)) & (estim_params_.corrn(:,2)==11;
```
Somehow the brackets are incorrect and should be
```
tmp1 = find((estim_params_.corrx(:,1)==1) & (estim_params_.corrx(:,2)==2));
tmp1 = find((estim_params_.corrn(:,1)==12) & (estim_params_.corrn(:,2)==11));
```
The file
```
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;
check;
estimated_params;
alp, beta_pdf, 0.356, 0.02;
bet, beta_pdf, 0.993, 0.002;
gam, normal_pdf, 0.0085, 0.003;
mst, normal_pdf, 1.0002, 0.007;
rho,2, normal_pdf, 0.129, 0.223;
psi, beta_pdf, 0.65, 0.05;
del, beta_pdf, 0.01, 0.005;
stderr e_a, inv_gamma_pdf, 0.035449, inf;
stderr e_m, inv_gamma_pdf, 0.008862, inf;
corr e_a, e_m, normal_pdf, 0, 0.007;
stderr gp_obs, inv_gamma_pdf, 0.008862, inf;
corr gp_obs, gy_obs, normal_pdf, 0, 0.007;
end;
varobs gp_obs gy_obs;
estimated_params_init;
stderr e_a, 0.014000;
stderr e_m, 0.005000;
stderr gp_obs, 0.000000;
corr e_a, e_m, 0.000000;
corr gp_obs, gy_obs, 0.000000;
alp, 0.330000;
bet, 0.990000;
gam, 0.003000;
mst, 1.011000;
rho, 0.700000;
psi, 0.787000;
del, 0.020000;
end;
estimation(order=1, datafile=fsdat_simul, nobs=192, loglinear, mh_replic=2000, mh_nblocks=2, mh_jscale=0.8,prior_trunc=0);
```
creates matlab code
```
tmp1 = find((estim_params_.corrx(:,1)==1)) & (estim_params_.corrx(:,2)==2);
tmp1 = find((estim_params_.corrn(:,1)==12)) & (estim_params_.corrn(:,2)==11;
```
Somehow the brackets are incorrect and should be
```
tmp1 = find((estim_params_.corrx(:,1)==1) & (estim_params_.corrx(:,2)==2));
tmp1 = find((estim_params_.corrn(:,1)==12) & (estim_params_.corrn(:,2)==11));
```
Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/469Prevent estimating parameters used inside shocks-block2019-06-19T15:38:16ZJohannes Pfeifer Prevent estimating parameters used inside shocks-blockI would classify the following behavior as a bug. `stoch_simul` allows using parameters to set variances inside of the `shocks` block. However, `estimation` completely ignores the updating of such a parameter if it is estimated as the covariance matrix is not updated. As can be seen in the mode_check plots of the attached modification of fs2000.mod, estimating sig_e_a results in the likelihood kernel being flat. Only the prior provides curvature. We should disallow such behavior as people should use the `stderr e_a` version.
```
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 sig_e_a;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
sig_e_a=0.014;
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 sig_e_a;
var e_m; stderr 0.005;
end;
steady;
check;
estimated_params;
del, beta_pdf, 0.01, 0.005;
sig_e_a, inv_gamma_pdf, 0.035449, inf;
end;
varobs gp_obs gy_obs;
estimation(order=1,bayesian_irf,irf_shocks=(e_m),datafile=fsdat_simul,mode_check, nobs=192, loglinear, mh_replic=2000, mh_nblocks=2, mh_jscale=0.8);
```
I would classify the following behavior as a bug. `stoch_simul` allows using parameters to set variances inside of the `shocks` block. However, `estimation` completely ignores the updating of such a parameter if it is estimated as the covariance matrix is not updated. As can be seen in the mode_check plots of the attached modification of fs2000.mod, estimating sig_e_a results in the likelihood kernel being flat. Only the prior provides curvature. We should disallow such behavior as people should use the `stderr e_a` version.
```
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 sig_e_a;
alp = 0.33;
bet = 0.99;
gam = 0.003;
mst = 1.011;
rho = 0.7;
psi = 0.787;
del = 0.02;
sig_e_a=0.014;
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 sig_e_a;
var e_m; stderr 0.005;
end;
steady;
check;
estimated_params;
del, beta_pdf, 0.01, 0.005;
sig_e_a, inv_gamma_pdf, 0.035449, inf;
end;
varobs gp_obs gy_obs;
estimation(order=1,bayesian_irf,irf_shocks=(e_m),datafile=fsdat_simul,mode_check, nobs=192, loglinear, mh_replic=2000, mh_nblocks=2, mh_jscale=0.8);
```
4.4Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/461dynare++ doesn't compile with bison >= 2.72019-06-19T15:38:16ZMichelJuillarddynare++ doesn't compile with bison >= 2.7The functions xx_parse() are now declared int in csv_tab.hh formula_tab.hh and matrix_tab.hh, generated by bison, but declared void in csv_parser.cpp, formula_parser.cpp, matrix_parser.cpp
The functions xx_parse() are now declared int in csv_tab.hh formula_tab.hh and matrix_tab.hh, generated by bison, but declared void in csv_parser.cpp, formula_parser.cpp, matrix_parser.cpp
4.4https://git.dynare.org/Dynare/dynare/-/issues/446ms-sbvar/test_ms_variances.mod fails under Octave with MatIO 1.52019-06-19T15:38:18ZSébastien Villemotms-sbvar/test_ms_variances.mod fails under Octave with MatIO 1.5Here is the error message:
```
WHILE RUNNING MODFILE: ms-sbvar/test_ms_variances
MSG: load: reading matrix data for 'A0'
IN FILE: /home/sebastien/dynare/unstable/tests/../matlab//ms-sbvar/set_ms_estimation_file.m
IN FUNCTION: set_ms_estimation_file
ON LINE and COLUMN: 49 and 12
```
Note that the problem does not occur with MatIO 1.3.
Here is the error message:
```
WHILE RUNNING MODFILE: ms-sbvar/test_ms_variances
MSG: load: reading matrix data for 'A0'
IN FILE: /home/sebastien/dynare/unstable/tests/../matlab//ms-sbvar/set_ms_estimation_file.m
IN FUNCTION: set_ms_estimation_file
ON LINE and COLUMN: 49 and 12
```
Note that the problem does not occur with MatIO 1.3.
4.4Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/448Relax check for varobs statement with measurement error.2019-06-19T15:38:18ZJohannes Pfeifer Relax check for varobs statement with measurement error.The following mod-file leads to a preprocessor error of
`ERROR: test_ME_shocks.mod: line 18, cols 1-16: shocks: standard error can only be specified for exogenous or observed endogenous variables`
```
var c, k;
varexo e;
model;
c=0.5*c(+1)+e;
k = 0.9*k(-1);
end;
shocks;
var e; stderr 0.009;
var k; stderr 1;
end;
varobs k;
stoch_simul(periods=500);
```
The reason is that the `varobs` statement comes after the `shocks` block. Moving it before the `shocks` makes the file run. We might want to relax this restriction on the positioning for the check.
The following mod-file leads to a preprocessor error of
`ERROR: test_ME_shocks.mod: line 18, cols 1-16: shocks: standard error can only be specified for exogenous or observed endogenous variables`
```
var c, k;
varexo e;
model;
c=0.5*c(+1)+e;
k = 0.9*k(-1);
end;
shocks;
var e; stderr 0.009;
var k; stderr 1;
end;
varobs k;
stoch_simul(periods=500);
```
The reason is that the `varobs` statement comes after the `shocks` block. Moving it before the `shocks` makes the file run. We might want to relax this restriction on the positioning for the check.
4.4Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/438investigate problem deleting files with ms-sbvar on windows 72019-06-19T15:38:18ZHoutan Bastaniinvestigate problem deleting files with ms-sbvar on windows 7This is about the problem we discussed with ms_estimation under Windows 7, Matlab 7.8.0 (R2009a). In a nutshell, if msvar is run more than once in a single Matlab session, the init files created on the first run cannot subsequently be deleted. This is a problem as when the init files are not deleted, changes to the model made in the mod file are not reflected in the dynare run. Matlab does not believe that it has any files open – type fopen(‘all’) to check – but windows thinks that Matlab does in fact have these files open. A guess is that the C code may not have fflush()ed the write buffer to the files before closing.
Thanks for your help.
- Roland
To replicate the problem:
· Starting from a clean directory with only RM_test.mod and data_SwitchingFed11_demeaned.dat, run dynare. Should be successful.
· Run dynare a second time. The log file output I get is pasted below. Windows cannot delete “init_RM_test.dat” and other files because they are said to be in use by Matlab.
(email 28 June 2013 12:00:08 PM GMT+02:00)
This is about the problem we discussed with ms_estimation under Windows 7, Matlab 7.8.0 (R2009a). In a nutshell, if msvar is run more than once in a single Matlab session, the init files created on the first run cannot subsequently be deleted. This is a problem as when the init files are not deleted, changes to the model made in the mod file are not reflected in the dynare run. Matlab does not believe that it has any files open – type fopen(‘all’) to check – but windows thinks that Matlab does in fact have these files open. A guess is that the C code may not have fflush()ed the write buffer to the files before closing.
Thanks for your help.
- Roland
To replicate the problem:
· Starting from a clean directory with only RM_test.mod and data_SwitchingFed11_demeaned.dat, run dynare. Should be successful.
· Run dynare a second time. The log file output I get is pasted below. Windows cannot delete “init_RM_test.dat” and other files because they are said to be in use by Matlab.
(email 28 June 2013 12:00:08 PM GMT+02:00)
4.5Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/437Add verbatim option to preprocessor2019-06-19T15:38:18ZJohannes Pfeifer Add verbatim option to preprocessorSometimes one would like to use a keyword detected by the preprocessor in a Matlab command, but the parsing detects this as invalid syntax. If possible, we should add something like a verbatim command to the preprocessor that adds the content without changing it to the m-file.
For example
```
verbatim(cellstr={'eps_a';'eps_b'};)
```
would write the content to the m-file without leading to an error as it currently does if `eps_a` is declared in `var_exo`
Sometimes one would like to use a keyword detected by the preprocessor in a Matlab command, but the parsing detects this as invalid syntax. If possible, we should add something like a verbatim command to the preprocessor that adds the content without changing it to the m-file.
For example
```
verbatim(cellstr={'eps_a';'eps_b'};)
```
would write the content to the m-file without leading to an error as it currently does if `eps_a` is declared in `var_exo`
4.4Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/435Potentially automatically detect non-stationary model and change QZ criterium2019-06-19T15:38:18ZJohannes Pfeifer Potentially automatically detect non-stationary model and change QZ criteriumWhile the manual states that `kalman_algo` automatically uses the correct filter for stationary and nonstationary models, this case never seems to happen. If the user does not specify that the model is non-stationary, initial_estimation_checks will throw out an error, because the QZ criterium is too high for the BK conditions to be satisfied. It might be a good idea to check in `initial_estimation_checks` for the presence of a unit root, throw out a warning, and set the `qz_criterium` to 0.999999 if a unit root is detected.
While the manual states that `kalman_algo` automatically uses the correct filter for stationary and nonstationary models, this case never seems to happen. If the user does not specify that the model is non-stationary, initial_estimation_checks will throw out an error, because the QZ criterium is too high for the BK conditions to be satisfied. It might be a good idea to check in `initial_estimation_checks` for the presence of a unit root, throw out a warning, and set the `qz_criterium` to 0.999999 if a unit root is detected.
4.5https://git.dynare.org/Dynare/dynare/-/issues/436Add length() operator to macroprocessor2019-06-19T15:38:18ZSébastien VillemotAdd length() operator to macroprocessorThe operator would return the length of an array. Useful for loops where you want to iterate over the array index rather than the array element.
The operator would return the length of an array. Useful for loops where you want to iterate over the array index rather than the array element.
4.4Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/431Potentially allow for loglinear option in stoch_simul2019-06-19T15:38:18ZJohannes Pfeifer Potentially allow for loglinear option in stoch_simulCurrently, stoch_simul does not take the loglinear option as a preprocessor command, although technically everything seems to be in place. Using `options_.loglinear` already seems to trigger the desired computations.
Currently, stoch_simul does not take the loglinear option as a preprocessor command, although technically everything seems to be in place. Using `options_.loglinear` already seems to trigger the desired computations.
4.4Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/430Deal with treatment of presample2019-06-19T15:38:18ZJohannes Pfeifer Deal with treatment of presample#429 introduces an error messsage for non-linear estimation with a `presample` being specified. This incorrectly used the first `presample` observations to compute the likelihood despite the manual saying that they are skipped. In the long-run, we might either want to actually use the presample to initialize the state matrix (e.g. as an option for initialization similar to using the ergodic state variance matrix of the linear model) or just skip the first `presample` periods by only using the observations `presample+1:end`
Another place where presample shows up is `bvar_toolbox.m`. Here we should clarify the distinction to the training sample in `options_.bvar_prior_train`
#429 introduces an error messsage for non-linear estimation with a `presample` being specified. This incorrectly used the first `presample` observations to compute the likelihood despite the manual saying that they are skipped. In the long-run, we might either want to actually use the presample to initialize the state matrix (e.g. as an option for initialization similar to using the ergodic state variance matrix of the linear model) or just skip the first `presample` periods by only using the observations `presample+1:end`
Another place where presample shows up is `bvar_toolbox.m`. Here we should clarify the distinction to the training sample in `options_.bvar_prior_train`
4.5https://git.dynare.org/Dynare/dynare/-/issues/423Transform hardcoded tolerance of OSR into an option2019-06-19T15:38:18ZJohannes Pfeifer Transform hardcoded tolerance of OSR into an optionSee http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4728
See http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4728
4.4Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/420Perfect foresight simulator with bytecode/block option is brocken if dynare i...2019-06-19T15:38:18ZStéphane Adjemianstepan@adjemian.euPerfect foresight simulator with bytecode/block option is brocken if dynare is compiled with --enable-openmp flag4.5https://git.dynare.org/Dynare/dynare/-/issues/419Expand model_diagnostics to test whether the model is truly linear2019-06-19T15:38:18ZJohannes Pfeifer Expand model_diagnostics to test whether the model is truly linearOften users specify model(linear), but don't enter all FOCs correctly. Testing in model_diagnostics whether all equations are linear and displaying the wrong equations would provide a valuable diagnostic tool. Alternatively, the preprocessor could check whether the Hessian g2 is a zero matrix if the linear option is specified.
Often users specify model(linear), but don't enter all FOCs correctly. Testing in model_diagnostics whether all equations are linear and displaying the wrong equations would provide a valuable diagnostic tool. Alternatively, the preprocessor could check whether the Hessian g2 is a zero matrix if the linear option is specified.
4.5Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/415Use of subexpression caching in Dynare++ evaluator can lead to wrong results2019-06-19T15:38:18ZSébastien VillemotUse of subexpression caching in Dynare++ evaluator can lead to wrong resultsConsider the following MOD file:
```
var y;
varexo e;
parameters beta rbar rebar lambdae t1 t2;
beta = 1/1.02^0.25;
rbar = 1.02^0.25;
rebar = (1.065-rbar^4+1)^0.25;
lambdae = 0.2;
lambdae = 1-lambdae;
t1 = (1-lambdae)/beta;
t2 = lambdae/beta;
model;
y = t2*y(-1)+e;
end;
initval;
y = 0;
end;
vcov = [1];
order = 1;
```
The value computed for `t1` will be wrong, and will be equal to that of `t2`. Here is what happens step-by-step:
- `lambdae = 0.2;` => Dynare++ registers that `lambdae=0.2`
- `lambdae=1-lambdae;` => Dynare++ computes `1-lambdae=0.8` **and caches that identity**; then it updates `lambdae=0.8`
- `t1 = (1-lambdae)/beta;` => Dynare++ (wrongly) uses the cached value `1-lambdae=0.8`
- `t2 = lambdae/beta;` => Dynare++ (rightly) uses the value `lambdae=0.8`
It seems that the only sensible solution to this problem is to disable subexpression caching during the evaluation phase.
Consider the following MOD file:
```
var y;
varexo e;
parameters beta rbar rebar lambdae t1 t2;
beta = 1/1.02^0.25;
rbar = 1.02^0.25;
rebar = (1.065-rbar^4+1)^0.25;
lambdae = 0.2;
lambdae = 1-lambdae;
t1 = (1-lambdae)/beta;
t2 = lambdae/beta;
model;
y = t2*y(-1)+e;
end;
initval;
y = 0;
end;
vcov = [1];
order = 1;
```
The value computed for `t1` will be wrong, and will be equal to that of `t2`. Here is what happens step-by-step:
- `lambdae = 0.2;` => Dynare++ registers that `lambdae=0.2`
- `lambdae=1-lambdae;` => Dynare++ computes `1-lambdae=0.8` **and caches that identity**; then it updates `lambdae=0.8`
- `t1 = (1-lambdae)/beta;` => Dynare++ (wrongly) uses the cached value `1-lambdae=0.8`
- `t2 = lambdae/beta;` => Dynare++ (rightly) uses the value `lambdae=0.8`
It seems that the only sensible solution to this problem is to disable subexpression caching during the evaluation phase.
4.4https://git.dynare.org/Dynare/dynare/-/issues/414Add interface and doc to use_univariate_filters_if_singularity_is_detected op...2019-06-19T15:38:18ZSébastien VillemotAdd interface and doc to use_univariate_filters_if_singularity_is_detected optionWas added in 894b3d69f4662a1132c0f7fb50083bf982745536
Was added in 894b3d69f4662a1132c0f7fb50083bf982745536
4.4Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/412Document identification schemes for svar in MS-SBVAR2019-06-19T15:38:18ZJohannes Pfeifer Document identification schemes for svar in MS-SBVARDocumentation on options like `lower_cholesky` is missing in the manual
Documentation on options like `lower_cholesky` is missing in the manual
MichelJuillardMichelJuillardhttps://git.dynare.org/Dynare/dynare/-/issues/406Agree on system for storing results and figures2019-06-19T15:38:18ZJohannes Pfeifer Agree on system for storing results and figuresCurrently we don't have a consistent system for saving results and figures. The MS-BVAR code for example saves the computation matrices in folders like IRF, Forecast, and Variance_Decomposition. But the corresponding graphs are saved in correspondingly named subfolders of the Output-Folder. This creates a confusing double structure. I am pretty sure there was some method to this separation, but I am unable to see it.
This treatment for example is different from other parts of the code, where results are either directly stored to "Output" or special folders like "gsa" are created at the same level as the Output folder.
In the longrun, we might want to agree on a consistent system.
Currently we don't have a consistent system for saving results and figures. The MS-BVAR code for example saves the computation matrices in folders like IRF, Forecast, and Variance_Decomposition. But the corresponding graphs are saved in correspondingly named subfolders of the Output-Folder. This creates a confusing double structure. I am pretty sure there was some method to this separation, but I am unable to see it.
This treatment for example is different from other parts of the code, where results are either directly stored to "Output" or special folders like "gsa" are created at the same level as the Output folder.
In the longrun, we might want to agree on a consistent system.
https://git.dynare.org/Dynare/dynare/-/issues/407Test for block with stack_solve_algo=3 is broken2019-06-19T15:38:18ZSébastien VillemotTest for block with stack_solve_algo=3 is brokenIt enters an infinite loop, and has therefore been disabled in 25269c3c6bb608f3295c308c156ce7bac2836d6a.
It enters an infinite loop, and has therefore been disabled in 25269c3c6bb608f3295c308c156ce7bac2836d6a.
4.4FerhatMihoubiFerhatMihoubihttps://git.dynare.org/Dynare/dynare/-/issues/400Add steady_no_check option to estimation command2019-06-19T15:38:18ZJohannes Pfeifer Add steady_no_check option to estimation command`unit_root_vars` is supposed to be deprecated by using ``diffuse_filter` instead for estimating a model with non-stationary observed variables. But estimation still checks the steady state unless it is preceded by a `steady(nocheck)` command that sets `options_.steadystate.nocheck` to 1. We should add an explicit option to set this option in estimation or automatically trigger it if the diffuse filter is requested. For a background, see
http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4671
http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=2813
`unit_root_vars` is supposed to be deprecated by using ``diffuse_filter` instead for estimating a model with non-stationary observed variables. But estimation still checks the steady state unless it is preceded by a `steady(nocheck)` command that sets `options_.steadystate.nocheck` to 1. We should add an explicit option to set this option in estimation or automatically trigger it if the diffuse filter is requested. For a background, see
http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4671
http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=2813
4.4Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/398Update Wiki for mode_compute=62019-06-19T15:38:18ZJohannes Pfeifer Update Wiki for mode_compute=6The information in http://www.dynare.org/DynareWiki/MonteCarloOptimization is outdated. See http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4672&start=0
Most importantly, e81f9d48ac5b5dab724ec48195301d139cef85ef changed the option naming.
Unfortunately, it seems I don't have the access rights to change the Wiki. I always get an internal server error when trying to access anything associated with login.
The information in http://www.dynare.org/DynareWiki/MonteCarloOptimization is outdated. See http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4672&start=0
Most importantly, e81f9d48ac5b5dab724ec48195301d139cef85ef changed the option naming.
Unfortunately, it seems I don't have the access rights to change the Wiki. I always get an internal server error when trying to access anything associated with login.
https://git.dynare.org/Dynare/dynare/-/issues/396Potentially change use of options_.drop in simulations2019-06-19T15:38:18ZJohannes Pfeifer Potentially change use of options_.drop in simulationsCurrently, options_.drop is used for both IRFs and moments. However, the simulated series generated with simult_ do not drop periods. I think that this is not desirable and we should also drop periods at the beginning unless the user wants to start at the deterministic steady state.
For linear models, this would not matter. But for models solved at higher order, we would then not knowingly output simulated series that for sure have not yet converged to the ergodic distribution.
Currently, options_.drop is used for both IRFs and moments. However, the simulated series generated with simult_ do not drop periods. I think that this is not desirable and we should also drop periods at the beginning unless the user wants to start at the deterministic steady state.
For linear models, this would not matter. But for models solved at higher order, we would then not knowingly output simulated series that for sure have not yet converged to the ergodic distribution.
https://git.dynare.org/Dynare/dynare/-/issues/350Dynare++ fails to load2019-06-19T15:38:18ZStéphane Adjemianstepan@adjemian.euDynare++ fails to load*Created by: davidrpugh*
I recently re-installed Dynare 4.3.2 and this has cause Dynare++ to fail to load. Here is the traceback:
`Cole-2:~ clarissasweet$ dynare++
dyld: Library not loaded: /usr/local/Cellar/gfortran/4.7.2/gfortran/lib/i386/libgfortran.3.dylib
Referenced from: /Applications/Dynare/4.3.2/dynare++/dynare++
Reason: image not found
Trace/BPT trap`
The library is not loading because the path is wrong: `/usr/local/gfortran` is where my FORTRAN compiler lives, not `/usr/local/Cellar/`. Switching back to Dynare 4.3.1 fixed the problem (which is what made me think it must be a bug in Dynare++). FYI I have a MacBook running OSX Snow leopard.
*Created by: davidrpugh*
I recently re-installed Dynare 4.3.2 and this has cause Dynare++ to fail to load. Here is the traceback:
`Cole-2:~ clarissasweet$ dynare++
dyld: Library not loaded: /usr/local/Cellar/gfortran/4.7.2/gfortran/lib/i386/libgfortran.3.dylib
Referenced from: /Applications/Dynare/4.3.2/dynare++/dynare++
Reason: image not found
Trace/BPT trap`
The library is not loading because the path is wrong: `/usr/local/gfortran` is where my FORTRAN compiler lives, not `/usr/local/Cellar/`. Switching back to Dynare 4.3.1 fixed the problem (which is what made me think it must be a bug in Dynare++). FYI I have a MacBook running OSX Snow leopard.
Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/1653kstate2020-05-04T16:22:56ZWilli Mutschlerwilli@mutschler.eukstateHi,
I was wondering if somebody can explain to me the structure of kstate? I am aware that using this is depreciated, as this is a reminiscence of old dynare versions where we did not create auxiliary variables for leads and lags greater than one, but still I find it is used in several functions dealing with e.g. the perturbation solution or identification toolbox.
In any case, I still have problems to get the hang of this. So maybe someone can help me out, given the following simple example:
```
var Y C K A;
varexo eps_A;
parameters alph betta rhoA sigA;
alph = 0.35; betta = 0.99; rhoA = 0.9; sigA = 0.6;
model;
C^(-1)=alph*betta*C(+1)^(-1)*A(+1)*K^(alph-1);
K=A*K(-1)^alph-C;
log(A)=rhoA*log(A(-1))+sigA*eps_A;
Y = A*K(-1)^alph;
end;
```
As I understand, my state variables are K and A, i.e.
- the declaration order is Y C K A
- the DR order is Y K A C
- lead_lag_incidence is equal to
| | Y | C | K | A |
|------|---|---|---|---|
| t-1 | 0 | 0 | 1 | 2 |
| t | 3 | 4 | 5 | 6 |
| t+1 | 0 | 7 | 0 | 8 |
where the number corresponds to the corresponding column number in the dynamic files (i.e. derivative wrt the variable)
Now, the kstate variable is given by:
| | | | |
| ------ | ------ | -----|--|
| 3 | 3 | 4 | 0|
| 4 | 3 | 3 | 0|
| 2 | 2 | 0 | 1|
| 3 | 2 | 0 | 2|
but I do not understand this. As far as I see, there is only one comment in set_state_space.m:
```
% composition of state vector
% col 1: variable; col 2: lead/lag in z(t+1);
% col 3: A cols for t+1 (D); col 4: A cols for t (E)
```
but what is the meaning of z(t+1), A, D and E or to which state space representation do these correspond to?
Thanks!Hi,
I was wondering if somebody can explain to me the structure of kstate? I am aware that using this is depreciated, as this is a reminiscence of old dynare versions where we did not create auxiliary variables for leads and lags greater than one, but still I find it is used in several functions dealing with e.g. the perturbation solution or identification toolbox.
In any case, I still have problems to get the hang of this. So maybe someone can help me out, given the following simple example:
```
var Y C K A;
varexo eps_A;
parameters alph betta rhoA sigA;
alph = 0.35; betta = 0.99; rhoA = 0.9; sigA = 0.6;
model;
C^(-1)=alph*betta*C(+1)^(-1)*A(+1)*K^(alph-1);
K=A*K(-1)^alph-C;
log(A)=rhoA*log(A(-1))+sigA*eps_A;
Y = A*K(-1)^alph;
end;
```
As I understand, my state variables are K and A, i.e.
- the declaration order is Y C K A
- the DR order is Y K A C
- lead_lag_incidence is equal to
| | Y | C | K | A |
|------|---|---|---|---|
| t-1 | 0 | 0 | 1 | 2 |
| t | 3 | 4 | 5 | 6 |
| t+1 | 0 | 7 | 0 | 8 |
where the number corresponds to the corresponding column number in the dynamic files (i.e. derivative wrt the variable)
Now, the kstate variable is given by:
| | | | |
| ------ | ------ | -----|--|
| 3 | 3 | 4 | 0|
| 4 | 3 | 3 | 0|
| 2 | 2 | 0 | 1|
| 3 | 2 | 0 | 2|
but I do not understand this. As far as I see, there is only one comment in set_state_space.m:
```
% composition of state vector
% col 1: variable; col 2: lead/lag in z(t+1);
% col 3: A cols for t+1 (D); col 4: A cols for t (E)
```
but what is the meaning of z(t+1), A, D and E or to which state space representation do these correspond to?
Thanks!https://git.dynare.org/Dynare/dynare/-/issues/1654Efficient computation of products of matrix arrays2019-07-03T10:43:38ZWilli Mutschlerwilli@mutschler.euEfficient computation of products of matrix arraysHi,
while extending the identification toolbox I often run into the need to compute a 2d matrix with a 3d array. That is, assume `A is [m x n]`, `B is [n x o x p]` and I need to compute `C(:,:,j)=A*B(:,:,j)`. Currently, I simply run a for loop (as p is dimension of parameters and hence not so large), i.e. the minimal matlab code looks like
```
for j=1:size(B,3)
C(:,:,j) = A*B(:,:,j);
end
```
Is there a more efficient way/trick to do so?Hi,
while extending the identification toolbox I often run into the need to compute a 2d matrix with a 3d array. That is, assume `A is [m x n]`, `B is [n x o x p]` and I need to compute `C(:,:,j)=A*B(:,:,j)`. Currently, I simply run a for loop (as p is dimension of parameters and hence not so large), i.e. the minimal matlab code looks like
```
for j=1:size(B,3)
C(:,:,j) = A*B(:,:,j);
end
```
Is there a more efficient way/trick to do so?https://git.dynare.org/Dynare/dynare/-/issues/1655Move created LaTeX-files to subfolder2019-11-21T14:15:56ZJohannes Pfeifer Move created LaTeX-files to subfolderSee https://git.dynare.org/Dynare/preprocessor/commit/0988a1f755be01b00aab7a458c89d9b63800875d#note_8528See https://git.dynare.org/Dynare/preprocessor/commit/0988a1f755be01b00aab7a458c89d9b63800875d#note_85284.6Johannes Pfeifer Johannes Pfeifer https://git.dynare.org/Dynare/dynare/-/issues/1656Provide documentation for the upgrading to 4.62020-01-10T15:47:45ZSébastien VillemotProvide documentation for the upgrading to 4.6Between 4.5 and 4.6, many structures in `M_`, `options_` and elsewhere which used to be character vectors are now cell arrays. Other things have changed in a backward-incompatible way.
We need to compile the list of all those structures, and document that change in the release notes.
Between 4.5 and 4.6, many structures in `M_`, `options_` and elsewhere which used to be character vectors are now cell arrays. Other things have changed in a backward-incompatible way.
We need to compile the list of all those structures, and document that change in the release notes.
4.6https://git.dynare.org/Dynare/dynare/-/issues/1657add shock decomposition for forecasts done after estimation2019-12-20T16:32:54ZSébastien Villemotadd shock decomposition for forecasts done after estimation@MichelJuillard has some preliminary codes.@MichelJuillard has some preliminary codes.4.7Dóra Kocsisdora@dynare.orgDóra Kocsisdora@dynare.orghttps://git.dynare.org/Dynare/dynare/-/issues/1658Write a howto on forecasting2019-09-20T13:06:55ZSébastien VillemotWrite a howto on forecastinghttps://git.dynare.org/Dynare/dynare/-/issues/1659Filter out non-positive definite Hessians before Laplace approximation2019-11-21T14:06:17ZJohannes Pfeifer Filter out non-positive definite Hessians before Laplace approximationWe do not check whether the normal approximation underlying the Laplace approximation to the marginal data density makes any sense given the Hessian at hand. That results in wrong output, because the log determinant will be complex and Matlab only prints the real-valued parts.
See https://forum.dynare.org/t/hessian-matrix-at-the-mode-is-not-positive-definite-but-the-marginal-density-is-displayed-anyway/14510/3
Proposed solution: skip the computation of the Hessian is not positive semi-definite and return NaN.We do not check whether the normal approximation underlying the Laplace approximation to the marginal data density makes any sense given the Hessian at hand. That results in wrong output, because the log determinant will be complex and Matlab only prints the real-valued parts.
See https://forum.dynare.org/t/hessian-matrix-at-the-mode-is-not-positive-definite-but-the-marginal-density-is-displayed-anyway/14510/3
Proposed solution: skip the computation of the Hessian is not positive semi-definite and return NaN.4.6Johannes Pfeifer Johannes Pfeifer https://git.dynare.org/Dynare/dynare/-/issues/1660Update documentation of dseries2020-02-17T09:27:42ZSébastien VillemotUpdate documentation of dseriesSince dseries have been substantially rewritten since 4.5, the documentation in the reference needs to be updated.Since dseries have been substantially rewritten since 4.5, the documentation in the reference needs to be updated.4.7Stéphane Adjemianstepan@adjemian.euStéphane Adjemianstepan@adjemian.euhttps://git.dynare.org/Dynare/dynare/-/issues/1661`fast` option to dynare does not recompile every time the model changes2019-10-08T07:17:30ZHoutan Bastani`fast` option to dynare does not recompile every time the model changesThe temporary terms of the equations are not printed in the buffer on which the checksum is calculated. Hence, if the model is changed in a term that then becomes a temporary term, the checksum does not change.The temporary terms of the equations are not printed in the buffer on which the checksum is calculated. Hence, if the model is changed in a term that then becomes a temporary term, the checksum does not change.4.6Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/1662Add support for linear models in perfect_foresight_problem MEX2019-11-27T13:11:54ZSébastien VillemotAdd support for linear models in perfect_foresight_problem MEXIn that case, the Jacobian needs not be recomputed for each period.In that case, the Jacobian needs not be recomputed for each period.Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1663datafile option in perfect_foresight_setup: incomplete documentation and not ...2020-01-02T18:21:21ZMichelJuillarddatafile option in perfect_foresight_setup: incomplete documentation and not flexible enoughthe datafile option in perfect_foresight solver requires a text file without variable names, variables being order in order of VAR statement. The file name must end with ``_endo.dat``.
- [x] make loading data for guess value more flexible
- [x] honor INITVAL_FILE command or deprecate it
- [ ] make possible to use guess values with simul_backward-modelthe datafile option in perfect_foresight solver requires a text file without variable names, variables being order in order of VAR statement. The file name must end with ``_endo.dat``.
- [x] make loading data for guess value more flexible
- [x] honor INITVAL_FILE command or deprecate it
- [ ] make possible to use guess values with simul_backward-model4.7https://git.dynare.org/Dynare/dynare/-/issues/1664Implement option to use LMMCP for steady state computation2019-11-09T17:37:42ZMichelJuillardImplement option to use LMMCP for steady state computationIntroducing mixed complementarity problems in steady state computation may be useful to exclude parts of the definition space where no solution exists. It may also help when one doesn't know whether an occasionally binding constraints bites at the steady state or not, depending on the value of the parameters.Introducing mixed complementarity problems in steady state computation may be useful to exclude parts of the definition space where no solution exists. It may also help when one doesn't know whether an occasionally binding constraints bites at the steady state or not, depending on the value of the parameters.https://git.dynare.org/Dynare/dynare/-/issues/1665Implement bridge sampler for computing marginal data density2019-11-26T16:25:08ZJohannes Pfeifer Implement bridge sampler for computing marginal data density4.7https://git.dynare.org/Dynare/dynare/-/issues/1666option for tolerance value in Modified Harmonic Mean estimator2019-12-12T11:58:40ZMarco Rattooption for tolerance value in Modified Harmonic Mean estimatorcurrently there is an hard-coded threshold set to 0.01 for the relative difference between the marginal likelihood computed withing the 1st and 9th deciles.
It might be helpful to allow modifying it with an explicit option, something like:
`options_.Modified_Harmonic_Mean_Tolerance`
with default 0.01currently there is an hard-coded threshold set to 0.01 for the relative difference between the marginal likelihood computed withing the 1st and 9th deciles.
It might be helpful to allow modifying it with an explicit option, something like:
`options_.Modified_Harmonic_Mean_Tolerance`
with default 0.014.6Johannes Pfeifer Johannes Pfeifer https://git.dynare.org/Dynare/dynare/-/issues/1667Problem with command line options passed on the first line of a `.mod` file w...2020-01-23T17:58:43ZHoutan BastaniProblem with command line options passed on the first line of a `.mod` file when they are used in dynare.mWhen command line options are passed on the first line of a `.mod` file within `// --+ options: +--`, they are parsed by the preprocessor and ignored by `dynare.m`.
This ignores the options `nopathchange`, `nopreprocessoroutput`, `onlymacro`, `onlyjson`, and `nolog`. An attempt to fix this was made with a regex for `nolog` but it is buggy (e.g. a command line argument such as `savemacro=,nolog,` would result in no Dynare log being created).When command line options are passed on the first line of a `.mod` file within `// --+ options: +--`, they are parsed by the preprocessor and ignored by `dynare.m`.
This ignores the options `nopathchange`, `nopreprocessoroutput`, `onlymacro`, `onlyjson`, and `nolog`. An attempt to fix this was made with a regex for `nolog` but it is buggy (e.g. a command line argument such as `savemacro=,nolog,` would result in no Dynare log being created).4.6Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1668Tighten tolerance for first iteration in solve1()2019-12-12T17:59:24ZMichelJuillardTighten tolerance for first iteration in solve1()Currently solve1() uses the same tolerance level (``tolf``) to decide to start Newton iterations or to terminate them. I suggest the the tolerance above which to start Newton iterations should be tighter.
It is mainly useful for the simulation of purely backward models. When the model is stationary, we expect the trajectory to converge asymptotically towards the steady state. This occurs as long as at least one iteration Newton takes place in each period. If the tolerance criteria is too lax, the simulation remains constant from too early a point.
**I suggest to use the square of ``tolf`` at the start of the computation**
For reference, csolve() always performs one Newton iteration. Matlab's fsolve() and lmmcp use a single tolerance level.Currently solve1() uses the same tolerance level (``tolf``) to decide to start Newton iterations or to terminate them. I suggest the the tolerance above which to start Newton iterations should be tighter.
It is mainly useful for the simulation of purely backward models. When the model is stationary, we expect the trajectory to converge asymptotically towards the steady state. This occurs as long as at least one iteration Newton takes place in each period. If the tolerance criteria is too lax, the simulation remains constant from too early a point.
**I suggest to use the square of ``tolf`` at the start of the computation**
For reference, csolve() always performs one Newton iteration. Matlab's fsolve() and lmmcp use a single tolerance level.https://git.dynare.org/Dynare/dynare/-/issues/1669Restore index of functions and commands in the manual2019-12-03T14:45:18ZSébastien VillemotRestore index of functions and commands in the manualIn the texinfo manual, there used to be an index for functions and commands (see https://www.dynare.org/manual/Command-and-Function-Index.html#Command-and-Function-Index).
This has been lost in the conversion to sphinx, and should therefore be restored.
By the way, if this is technically feasible, and index of variables (fields of `M_`, `oo_`, …) would also be useful.In the texinfo manual, there used to be an index for functions and commands (see https://www.dynare.org/manual/Command-and-Function-Index.html#Command-and-Function-Index).
This has been lost in the conversion to sphinx, and should therefore be restored.
By the way, if this is technically feasible, and index of variables (fields of `M_`, `oo_`, …) would also be useful.4.6Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/1670Mac Package: see if we can use Homebrew `binutils` package to provide `as` an...2020-05-07T17:44:34ZHoutan BastaniMac Package: see if we can use Homebrew `binutils` package to provide `as` and `ld` and thus not install CLTThe idea is that if we can use Homebrew to provide `as` and `ld` then we can avoid installing Command Line Tools. I am not hopeful because `install_name_tool`, which is used to rename library paths when installing to a non-default directory is installed via Command Line Tools. The thing to check is whether this is used only when installing to non-default directories or whether it is always used. If it is always used, then CLT must not be required (though, it is located in `/Library/Developer/CommandLineTools/usr/bin/install_name_tool`)The idea is that if we can use Homebrew to provide `as` and `ld` then we can avoid installing Command Line Tools. I am not hopeful because `install_name_tool`, which is used to rename library paths when installing to a non-default directory is installed via Command Line Tools. The thing to check is whether this is used only when installing to non-default directories or whether it is always used. If it is always used, then CLT must not be required (though, it is located in `/Library/Developer/CommandLineTools/usr/bin/install_name_tool`)4.7https://git.dynare.org/Dynare/dynare/-/issues/1671Refactoring initval_file and histval_file2020-05-14T14:46:58ZMichelJuillardRefactoring initval_file and histval_file``initval_file`` and ``histvfal_file`` should be more flexible and have functionalities similar to option ``datafile``in ``estimation``
# Usage
## initval_file
- is used only in perfect foresight
- provides a guess value for computing the solution
- in absence of ``histval`` or ``histval_file`` provides the initial conditions for the simulation (we don't want to require users to upload two files for initial conditions and guess values
## histval_file
- is used for stochastic and perfect foresight models
- provides initial conditions
# Current implementation
## initval_file
- accept ``.m``, ``.mat``, ``.xls(x)``, ``.csv`` files
- modifies directly ``oo_.endo_simul``, ``oo_.exo_simul``, but not ``oo_.exo_det_simul``
## histval_file
- accept only files prepared by ``smoother2histval`` that uses odd format
- modifies directly ``oo_.endo_simul``, ``oo_.exo_simul``, but not ``oo_.exo_det_simul``
- note that ``histval`` sets a ``dseries`` object
# Proposal
1. have the same interface for ``initval_file`` and ``histval_file``
2. add an option ``dseries`` to be able to pass a ``dseries`` object
3. handle references to ``varexo_det`` variables
4. use the ``dseries`` interface to read files
5. ``initval_file`` and ``histval_file```set ``dseries`` object
6. modify ``make_y_`` ``make_ex_`` accordingly
7. handle auxiliary variables in a consistent manner (see #1004)
# Breaking changes
1. Documented behavior of ``initval_file``: None
2. Documented behavior of ``histval_file``: None
3. Documented behavior of ``perfect_foresight_setup``: the format of files designated in option ``filename`` has changed
4. Function ``initvalf.m``
* ``M_`` and ``options`` are added to inputs
* the old ``filename`` input triggers an error
* function ``initvalf()`` sets a result ``dseries`` on output
5. Function ``histvalf.m``
* ``M_`` and ``options`` are added to inputs
* the old ``filename`` input triggers an error
* function ``histvalf()`` sets a result ``dseries`` on output
* ``histvalf.m``doesn't recognize the old ``smoother2histval`` file format anymore.
6. Function ``smoother2histval.m``
* when an output file is requested ``smoother2histval()`` creates a ``.mat`` file containing a single ``dseries``
* ``smoother2histval.m`` saves now M_.orig_maximum_lag`` observations instead of ``oo_.maximum_lag`` in order to be able to recompute auxiliary variables
* It will not be possible to use a file saved with an previous version of ``smoother2histval``
# Questions
1. Is it a problem to have an optional ``dseries`` input in an instruction called ``initval_file`` and no file strictly speaking of?
WORK IN PROGRESS``initval_file`` and ``histvfal_file`` should be more flexible and have functionalities similar to option ``datafile``in ``estimation``
# Usage
## initval_file
- is used only in perfect foresight
- provides a guess value for computing the solution
- in absence of ``histval`` or ``histval_file`` provides the initial conditions for the simulation (we don't want to require users to upload two files for initial conditions and guess values
## histval_file
- is used for stochastic and perfect foresight models
- provides initial conditions
# Current implementation
## initval_file
- accept ``.m``, ``.mat``, ``.xls(x)``, ``.csv`` files
- modifies directly ``oo_.endo_simul``, ``oo_.exo_simul``, but not ``oo_.exo_det_simul``
## histval_file
- accept only files prepared by ``smoother2histval`` that uses odd format
- modifies directly ``oo_.endo_simul``, ``oo_.exo_simul``, but not ``oo_.exo_det_simul``
- note that ``histval`` sets a ``dseries`` object
# Proposal
1. have the same interface for ``initval_file`` and ``histval_file``
2. add an option ``dseries`` to be able to pass a ``dseries`` object
3. handle references to ``varexo_det`` variables
4. use the ``dseries`` interface to read files
5. ``initval_file`` and ``histval_file```set ``dseries`` object
6. modify ``make_y_`` ``make_ex_`` accordingly
7. handle auxiliary variables in a consistent manner (see #1004)
# Breaking changes
1. Documented behavior of ``initval_file``: None
2. Documented behavior of ``histval_file``: None
3. Documented behavior of ``perfect_foresight_setup``: the format of files designated in option ``filename`` has changed
4. Function ``initvalf.m``
* ``M_`` and ``options`` are added to inputs
* the old ``filename`` input triggers an error
* function ``initvalf()`` sets a result ``dseries`` on output
5. Function ``histvalf.m``
* ``M_`` and ``options`` are added to inputs
* the old ``filename`` input triggers an error
* function ``histvalf()`` sets a result ``dseries`` on output
* ``histvalf.m``doesn't recognize the old ``smoother2histval`` file format anymore.
6. Function ``smoother2histval.m``
* when an output file is requested ``smoother2histval()`` creates a ``.mat`` file containing a single ``dseries``
* ``smoother2histval.m`` saves now M_.orig_maximum_lag`` observations instead of ``oo_.maximum_lag`` in order to be able to recompute auxiliary variables
* It will not be possible to use a file saved with an previous version of ``smoother2histval``
# Questions
1. Is it a problem to have an optional ``dseries`` input in an instruction called ``initval_file`` and no file strictly speaking of?
WORK IN PROGRESS4.7MichelJuillardMichelJuillardhttps://git.dynare.org/Dynare/dynare/-/issues/1672conditional_forecast should save its output in oo_2019-11-29T16:11:56ZSébastien Villemotconditional_forecast should save its output in oo_Currently, `conditional_forecast` stores its output in a file. This is inconsistent with the rest of Dynare commands, and renders the post-processing of this data less robust, because we have to reload that file from the hard drive (without the guarantee that it comes from the same Dynare session).
The output should be saved in a field of `oo_` (without changing the structure).
`plot_ic_forecast` needs to be adapted. `shock_decomposition` as well, once #1657 is done.
The various fields should also be documented.Currently, `conditional_forecast` stores its output in a file. This is inconsistent with the rest of Dynare commands, and renders the post-processing of this data less robust, because we have to reload that file from the hard drive (without the guarantee that it comes from the same Dynare session).
The output should be saved in a field of `oo_` (without changing the structure).
`plot_ic_forecast` needs to be adapted. `shock_decomposition` as well, once #1657 is done.
The various fields should also be documented.4.6https://git.dynare.org/Dynare/dynare/-/issues/1673Nonlinear filters at k-order2020-02-17T09:28:31ZSébastien VillemotNonlinear filters at k-orderA MEX file for iterating in the state space (based on Dynare++) is already present in the `local_state_space_iteration_k` branch.
It needs to be tested and integrated in the estimation routines.A MEX file for iterating in the state space (based on Dynare++) is already present in the `local_state_space_iteration_k` branch.
It needs to be tested and integrated in the estimation routines.4.6Stéphane Adjemianstepan@adjemian.euStéphane Adjemianstepan@adjemian.euhttps://git.dynare.org/Dynare/dynare/-/issues/1674Modification to shock_decomposition and plot_decomposition interfaces to incl...2020-01-21T17:47:09ZDóra Kocsisdora@dynare.orgModification to shock_decomposition and plot_decomposition interfaces to include flexibility with datesInclude the following options for dates when shock_decomposition is triggered:
* date of the start of the decomposition, default: start of the estimation sample (some people may want to start the decomposition with the smoothed value at the end of the sample). Proposed option name: `init_date = INTEGER`.
* date of the start of the graph, default: start of the estimation sample. Proposed option name: `graph_init_date = INTEGER`.Include the following options for dates when shock_decomposition is triggered:
* date of the start of the decomposition, default: start of the estimation sample (some people may want to start the decomposition with the smoothed value at the end of the sample). Proposed option name: `init_date = INTEGER`.
* date of the start of the graph, default: start of the estimation sample. Proposed option name: `graph_init_date = INTEGER`.4.7Dóra Kocsisdora@dynare.orgDóra Kocsisdora@dynare.orghttps://git.dynare.org/Dynare/dynare/-/issues/1675Migrate to Dragonfly parallel toolkit2020-05-07T17:44:21ZSébastien VillemotMigrate to Dragonfly parallel toolkitThe embedded parallel toolkit should be replaced by the [Dragonfly](https://github.com/DragonflyTeam/dragonfly) toolkit.
A branch called `dragonfly` has been created, with the toolkit under `matlab/modules/dragonfly` (see ee3971ad6364910851ff06da9729d9b4a084ca4b).The embedded parallel toolkit should be replaced by the [Dragonfly](https://github.com/DragonflyTeam/dragonfly) toolkit.
A branch called `dragonfly` has been created, with the toolkit under `matlab/modules/dragonfly` (see ee3971ad6364910851ff06da9729d9b4a084ca4b).4.7Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1676Investigate macro-processor behavior related to defined() statement2019-12-10T15:53:50ZJohannes Pfeifer Investigate macro-processor behavior related to defined() statementI am running
```
@#if !defined(DEFINEDvar) || DEFINEDvar==0
@#echo "Good"
@#else
@#error "ELSE ERROR"
@#endif
```
and get
```
Macro-processing error: backtrace...
- Unknown variable DEFINEDvar
- binary operation: "macro.mod" line 1, col 29-42
- binary operation: "macro.mod" line 1, col 5-42
- @#if: "macro.mod" line 1, col 1 to line 5, col 7
```I am running
```
@#if !defined(DEFINEDvar) || DEFINEDvar==0
@#echo "Good"
@#else
@#error "ELSE ERROR"
@#endif
```
and get
```
Macro-processing error: backtrace...
- Unknown variable DEFINEDvar
- binary operation: "macro.mod" line 1, col 29-42
- binary operation: "macro.mod" line 1, col 5-42
- @#if: "macro.mod" line 1, col 1 to line 5, col 7
```4.6Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/1677Exempt Ramsey instruments from warning in steady_state_model block2019-12-12T17:22:48ZJohannes Pfeifer Exempt Ramsey instruments from warning in steady_state_model blockCurrently, we provide a preprocessor warning if a variable has not been set in a `steady_state_model`-block. E.g.
>WARNING: in the 'steady_state_model' block, variable 'R' is not assigned a value
But if the user provides an instrument (`ramsey_policy(instruments=(R))`), the steady state file needs to be conditional on this instrument. So the warning points users to a wrong "fix".Currently, we provide a preprocessor warning if a variable has not been set in a `steady_state_model`-block. E.g.
>WARNING: in the 'steady_state_model' block, variable 'R' is not assigned a value
But if the user provides an instrument (`ramsey_policy(instruments=(R))`), the steady state file needs to be conditional on this instrument. So the warning points users to a wrong "fix".4.6Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1678Provide interface to access evaluate_planner_objective.m2020-01-10T14:48:18ZJohannes Pfeifer Provide interface to access evaluate_planner_objective.mAs noted in https://git.dynare.org/Dynare/dynare/issues/564#note_9765, `ramsey_policy` only allows for `order=1`. The solution is to replace it by
```
ramsey_model;
stoch_simul(order=2)
```
But the downside of this approach is that we do not compute the welfare function in this case and one cannot add it to the model-block. For that reason, we need to provide the user with an interface to call `evaluate_planner_objective`As noted in https://git.dynare.org/Dynare/dynare/issues/564#note_9765, `ramsey_policy` only allows for `order=1`. The solution is to replace it by
```
ramsey_model;
stoch_simul(order=2)
```
But the downside of this approach is that we do not compute the welfare function in this case and one cannot add it to the model-block. For that reason, we need to provide the user with an interface to call `evaluate_planner_objective`4.6Johannes Pfeifer Johannes Pfeifer https://git.dynare.org/Dynare/dynare/-/issues/1679Document epilogue2020-01-22T09:33:16ZSébastien VillemotDocument epilogueIt should also be added to the new features wiki page.It should also be added to the new features wiki page.4.6Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/1680Adapt evaluate_planner_objective.m to higher order and perfect foresight2020-04-06T07:52:02ZJohannes Pfeifer Adapt evaluate_planner_objective.m to higher order and perfect foresightSupersedes https://git.dynare.org/Dynare/dynare/issues/564 and is related to https://git.dynare.org/Dynare/dynare/issues/1678
See also https://forum.dynare.org/t/evaluate-planner-objective-in-non-linear-model/15492Supersedes https://git.dynare.org/Dynare/dynare/issues/564 and is related to https://git.dynare.org/Dynare/dynare/issues/1678
See also https://forum.dynare.org/t/evaluate-planner-objective-in-non-linear-model/154924.7https://git.dynare.org/Dynare/dynare/-/issues/1681Model incorrectly detected as linear for ramsey_model2019-12-13T19:54:26ZJohannes Pfeifer Model incorrectly detected as linear for ramsey_modelI am experiencing trouble with `ramsey_model` in `Ramsey_Example.mod`. If I use `stoch_simul` via `dynare Ramsey_Example -DOptimal_policy=0`, then
```
M_.nonzero_hessian_eqs = [0 1 2 5 6 7 9 10 11];
M_.hessian_eq_zero = isempty(M_.nonzero_hessian_eqs);
```
but with `ramsey_model` via `dynare Ramsey_Example`
```
M_.nonzero_hessian_eqs = [];
M_.hessian_eq_zero = isempty(M_.nonzero_hessian_eqs);
```
So for some reason the model is detected as being linear, which it is notI am experiencing trouble with `ramsey_model` in `Ramsey_Example.mod`. If I use `stoch_simul` via `dynare Ramsey_Example -DOptimal_policy=0`, then
```
M_.nonzero_hessian_eqs = [0 1 2 5 6 7 9 10 11];
M_.hessian_eq_zero = isempty(M_.nonzero_hessian_eqs);
```
but with `ramsey_model` via `dynare Ramsey_Example`
```
M_.nonzero_hessian_eqs = [];
M_.hessian_eq_zero = isempty(M_.nonzero_hessian_eqs);
```
So for some reason the model is detected as being linear, which it is not4.6Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1682Sort out correct order of blocks in perfect foresight Ramsey and document it2020-01-10T14:48:20ZJohannes Pfeifer Sort out correct order of blocks in perfect foresight Ramsey and document itUsually `steady` after `initval` computes a steady state. But with `ramsey_model`, one seems to need the `ramsey_model(planner_discount=0.99);` statement before the call to steady and therefore `initval`. Also, it is not clear what `steady` does in this case. Is it the private sector equilibrium steady state or the Ramsey steady state that is computed.
Relevant test case: `optimal_policy/nk_ramsey_det.mod`Usually `steady` after `initval` computes a steady state. But with `ramsey_model`, one seems to need the `ramsey_model(planner_discount=0.99);` statement before the call to steady and therefore `initval`. Also, it is not clear what `steady` does in this case. Is it the private sector equilibrium steady state or the Ramsey steady state that is computed.
Relevant test case: `optimal_policy/nk_ramsey_det.mod`4.6https://git.dynare.org/Dynare/dynare/-/issues/1683Provide preprocessor warning that `simul` is deprecated2019-12-13T17:22:32ZJohannes Pfeifer Provide preprocessor warning that `simul` is deprecatedWe provide a preprocessor warning that `ramsey_policy` is deprecated. We should provide a similar warning if `simul` is called that the recommended syntax is `perfect_foresight_setup` and `perfect_foresight_solver`.We provide a preprocessor warning that `ramsey_policy` is deprecated. We should provide a similar warning if `simul` is called that the recommended syntax is `perfect_foresight_setup` and `perfect_foresight_solver`.4.6Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/1684New WITH_TREND() operator for epilogue block2019-12-13T17:29:05ZSébastien VillemotNew WITH_TREND() operator for epilogue blockImplement a new operator (something like `WITH_TREND()` that could be used in the epilogue block, and that would add back the trend on the computed variables. In this way, the symbolic manipulations would be done in the preprocessor, which is much more easier to do than in MATLAB.
Initially discussed in #1648Implement a new operator (something like `WITH_TREND()` that could be used in the epilogue block, and that would add back the trend on the computed variables. In this way, the symbolic manipulations would be done in the preprocessor, which is much more easier to do than in MATLAB.
Initially discussed in #16484.7https://git.dynare.org/Dynare/dynare/-/issues/1685Fix write_latex_dynamic_model(write_equation_tags) for ramsey_model2020-01-06T17:33:31ZJohannes Pfeifer Fix write_latex_dynamic_model(write_equation_tags) for ramsey_modelWhen using `ramsey_model`, the `M_.ramsey_eq_nbr` planner FOCs are written before the `M_.orig_eq_nbr` private sector FOCs for which the equation tags have been provided. But the equation tags are printed for the first `M_.orig_eq_nbr` equations, not for the `M_.ramsey_eq_nbr+1:M_.eq_nbr` ones.When using `ramsey_model`, the `M_.ramsey_eq_nbr` planner FOCs are written before the `M_.orig_eq_nbr` private sector FOCs for which the equation tags have been provided. But the equation tags are printed for the first `M_.orig_eq_nbr` equations, not for the `M_.ramsey_eq_nbr+1:M_.eq_nbr` ones.4.6Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1686Add interface to set LaTeX-name of optimal_policy_discount_factor2019-12-18T16:46:52ZJohannes Pfeifer Add interface to set LaTeX-name of optimal_policy_discount_factorI would propose an option `planner_discount_latex_name` to `ramsey_model` that takes a string and sets `M_.param_names_tex{strmatch('optimal_policy_discount_factor',M_.param_names,'exact')}` as well as the internal field in the preprocessor output used for the `write_latex_*` commands. Unfortunately, this needs to be a LaTeX string that can contain a backslash. If the parser cannot easily handle this, we should not implement it.I would propose an option `planner_discount_latex_name` to `ramsey_model` that takes a string and sets `M_.param_names_tex{strmatch('optimal_policy_discount_factor',M_.param_names,'exact')}` as well as the internal field in the preprocessor output used for the `write_latex_*` commands. Unfortunately, this needs to be a LaTeX string that can contain a backslash. If the parser cannot easily handle this, we should not implement it.4.6Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1687Interface and documentation for new shock decomposition functionalities2020-01-22T17:18:39ZSébastien VillemotInterface and documentation for new shock decomposition functionalitiesImplement the preprocessor changes needed for !1655.
The test `tests/shock_decomposition/ls2003_plot.mod` will need to be adapted for the new `squeeze_shock_decomposition` command.
Also add the related documentation.Implement the preprocessor changes needed for !1655.
The test `tests/shock_decomposition/ls2003_plot.mod` will need to be adapted for the new `squeeze_shock_decomposition` command.
Also add the related documentation.4.6Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1688fix `basic_plan`, `flip_plan` in doc2020-01-28T14:01:41ZHoutan Bastanifix `basic_plan`, `flip_plan` in docThe calling structure for both of these functions runs off the end of the pageThe calling structure for both of these functions runs off the end of the page4.7Stéphane Adjemianstepan@adjemian.euStéphane Adjemianstepan@adjemian.euhttps://git.dynare.org/Dynare/dynare/-/issues/1689Clarify licensing information for identification stuff2020-01-24T14:41:20ZSébastien VillemotClarify licensing information for identification stuffSee !1689
The information should be added in the corresponding headers, and in `license.txt`See !1689
The information should be added in the corresponding headers, and in `license.txt`4.6Willi Mutschlerwilli@mutschler.euWilli Mutschlerwilli@mutschler.euhttps://git.dynare.org/Dynare/dynare/-/issues/1690Return an error if nonlinear filters are used with trends or prefilter2020-01-13T17:40:52ZStéphane Adjemianstepan@adjemian.euReturn an error if nonlinear filters are used with trends or prefilterSee discussion [here](https://git.dynare.org/Dynare/dynare/commit/76e3c6ca687dbbb55f5e8b47cc8a613b039d80ed#note_10148).See discussion [here](https://git.dynare.org/Dynare/dynare/commit/76e3c6ca687dbbb55f5e8b47cc8a613b039d80ed#note_10148).4.6Stéphane Adjemianstepan@adjemian.euStéphane Adjemianstepan@adjemian.euhttps://git.dynare.org/Dynare/dynare/-/issues/1691Allow dynasave and dynatype to also save simulated exogenous variables2020-01-06T13:59:31ZJohannes Pfeifer Allow dynasave and dynatype to also save simulated exogenous variablesThe documentation does not state that this is not allowed. We would need to
* [x] Adjust the Matlab code
* [ ] Make the documentation more explicit
* [x] Allow for the `var_list_` to accept exogenousThe documentation does not state that this is not allowed. We would need to
* [x] Adjust the Matlab code
* [ ] Make the documentation more explicit
* [x] Allow for the `var_list_` to accept exogenous4.6https://git.dynare.org/Dynare/dynare/-/issues/1692Update doc for dynasave and dynatype2020-01-06T10:05:46ZHoutan BastaniUpdate doc for dynasave and dynatypeSplitting up #1691, update the doc for 4.6 and leave the other changes for 4.7Splitting up #1691, update the doc for 4.6 and leave the other changes for 4.74.6Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/1693Various improvements in Sphinx doc2020-01-08T16:24:40ZHoutan BastaniVarious improvements in Sphinx doc- see if we can use https://pypi.org/project/sphinxcontrib-matlabdomain/ instead of `MatComm` and `MatlabVar` defined in `doc/manual/utils/dynare_dom.py`
- if not, add new domain entry to differentiate between MATLAB commands and MATLAB functions
- find way to fix output of Matlab Commands so the options conform to the true type used for Dynare Command options
- code block:
- many general problems with highlighting: e.g. `end` is highlighted when it is MATLAB code but the corresponding `for` is not highlighted
- despite being in `doc/manual/utils/dynare_lex.py`, `var` is not highlighted in code blocks
- ideally find a programmatic way to fill `doc/manual/utils/dynare_lex.py` from the `rst` files instead of having to update it by hand- see if we can use https://pypi.org/project/sphinxcontrib-matlabdomain/ instead of `MatComm` and `MatlabVar` defined in `doc/manual/utils/dynare_dom.py`
- if not, add new domain entry to differentiate between MATLAB commands and MATLAB functions
- find way to fix output of Matlab Commands so the options conform to the true type used for Dynare Command options
- code block:
- many general problems with highlighting: e.g. `end` is highlighted when it is MATLAB code but the corresponding `for` is not highlighted
- despite being in `doc/manual/utils/dynare_lex.py`, `var` is not highlighted in code blocks
- ideally find a programmatic way to fill `doc/manual/utils/dynare_lex.py` from the `rst` files instead of having to update it by hand4.7https://git.dynare.org/Dynare/dynare/-/issues/1694Identification tests fail for old matlab2020-01-24T17:25:41ZWilli Mutschlerwilli@mutschler.euIdentification tests fail for old matlabSome identification tests fail under MATLAB R2009b, see https://git.dynare.org/Dynare/dynare/-/jobs/12770. Some functions need to be replaced.Some identification tests fail under MATLAB R2009b, see https://git.dynare.org/Dynare/dynare/-/jobs/12770. Some functions need to be replaced.4.6Willi Mutschlerwilli@mutschler.euWilli Mutschlerwilli@mutschler.euhttps://git.dynare.org/Dynare/dynare/-/issues/1695Calib_Smoother options specify sheet and range2020-01-13T17:40:52ZCamilo MarchesiniCalib_Smoother options specify sheet and range```calib_smoother``` currently does not support options related to 'sheet' and 'range' of the Excel spreadsheet. However, these options can be included in the ```estimation``` call. It could be useful to include them also in the call to ```calib_smoother``` .
```calib_smoother``` currently does not support options related to 'sheet' and 'range' of the Excel spreadsheet. However, these options can be included in the ```estimation``` call. It could be useful to include them also in the call to ```calib_smoother``` .
4.6https://git.dynare.org/Dynare/dynare/-/issues/1696fix parsing of user-provided command line arguments2020-02-11T17:15:49ZHoutan Bastanifix parsing of user-provided command line argumentsMatlab is actually quite good about keeping user-provided arguments together. See:
```
>> dynare example1 '-DA="nthn thnth"' -DB=[1,2, .3] -DB=( oe )
-DA="nthn thnth"
-DB=[1,2, .3]
-DB=( oe )
```
The output above comes from simply printing the arguments of `varargin`.
We should be able to thus simply add single quotes around every user-provided argument in `dynare.m` and pass these directly to the preprocessor for processing. We'd then require that all strings be double-quoted and could potentially even handle macro expressions (not just base values) in `-D` arguments.Matlab is actually quite good about keeping user-provided arguments together. See:
```
>> dynare example1 '-DA="nthn thnth"' -DB=[1,2, .3] -DB=( oe )
-DA="nthn thnth"
-DB=[1,2, .3]
-DB=( oe )
```
The output above comes from simply printing the arguments of `varargin`.
We should be able to thus simply add single quotes around every user-provided argument in `dynare.m` and pass these directly to the preprocessor for processing. We'd then require that all strings be double-quoted and could potentially even handle macro expressions (not just base values) in `-D` arguments.4.6Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/1697Regression in LMMCP perfect foresight solver2020-03-30T12:25:19ZSébastien VillemotRegression in LMMCP perfect foresight solverThe simulation in `tests/lmmcp/rbcii.mod` fails to converge. The same file works with 4.5.
Once this is fixed, a check that convergence has indeed been obtained should be added, so that regressions may be detected earlier in the future.The simulation in `tests/lmmcp/rbcii.mod` fails to converge. The same file works with 4.5.
Once this is fixed, a check that convergence has indeed been obtained should be added, so that regressions may be detected earlier in the future.4.6Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1698Allow checking linearity for perfect foresight models2020-02-14T15:05:47ZJohannes Pfeifer Allow checking linearity for perfect foresight modelsThe linearity check underlying `model(linear)` is based on the Hessian of the model. But we don’t compute the Hessian for a perfect foresight simulation, hence the check is skipped. See line 799 of `preprocessor/src/ModFile.cc`.
That can be problematic in case of nonlinearities like a ZLB constraint in an otherwise linear model. The solver assumes that the Jacobian is the same at every period, and the constraint is not enforced.
For very large perfect foresight models, we actually don’t want to put the Hessian in the generated dynamic file, because compiling it can be very time consuming. Hence the fix is not straightforward.
I would suggest to add a way of testing this. One option would be trigger the Hessian computation with a `debug` option or something like this. For example, we could use the already present command line option `debug`.The linearity check underlying `model(linear)` is based on the Hessian of the model. But we don’t compute the Hessian for a perfect foresight simulation, hence the check is skipped. See line 799 of `preprocessor/src/ModFile.cc`.
That can be problematic in case of nonlinearities like a ZLB constraint in an otherwise linear model. The solver assumes that the Jacobian is the same at every period, and the constraint is not enforced.
For very large perfect foresight models, we actually don’t want to put the Hessian in the generated dynamic file, because compiling it can be very time consuming. Hence the fix is not straightforward.
I would suggest to add a way of testing this. One option would be trigger the Hessian computation with a `debug` option or something like this. For example, we could use the already present command line option `debug`.4.7https://git.dynare.org/Dynare/dynare/-/issues/1699Welfare under optimal discretionary policy not computed2020-01-30T14:50:04ZSébastien VillemotWelfare under optimal discretionary policy not computedAt least with `dennis_1.mod` and `Gali_discretion.mod` from `tests/discretionary_policy/`, the welfare (as stored in `oo_.planner_objective_value`) is a `NaN`. This is a regression from 4.5.
Unfortunately, the test at the end of `Gali_discretion.mod` did not catch the problem, because of the specific evaluation rules for `NaN`. This should also be fixed with some call to `isnan()`.At least with `dennis_1.mod` and `Gali_discretion.mod` from `tests/discretionary_policy/`, the welfare (as stored in `oo_.planner_objective_value`) is a `NaN`. This is a regression from 4.5.
Unfortunately, the test at the end of `Gali_discretion.mod` did not catch the problem, because of the specific evaluation rules for `NaN`. This should also be fixed with some call to `isnan()`.4.6Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1700Proposal for a generalized solver2020-01-30T09:53:09ZMichelJuillardProposal for a generalized solverModel inversion and deterministic conditional forecast solve the same mathematical problem: solving a (non-)linear system where the identity of the unknown variables change from period to period. I suggest to create a unique function that would solve such problems.
``general_solver`` would take at least the following arguments:
* y: endogenous variables (matrix)
* x: exogenous variables (matrix) [possible concatenation of exo_det variables to the right]
* model: model (function handle)
* i_endo_flip: flip variables indices in endogenous variables (vector)
* i_exo_flip: flip variables indices in exogenous variables (vector)
### Conventions
1. there are as many endogenous flip variables as exogenenous or exo det variables
1. the endogenous and exogenous flip variables are in the same order (not necessary to be contiguous but may help)
1. given the indices vector of flip variablesm implicit pairs of endogenous/exogenous variables are formed
1. If the observation of an endogenous variable is a NaN, the endogenous variables plays it usual role of endogenous variable
1. If the observation of an endogenous variables is a valid number, the endogenous variable is treated as exogenous and the corresponding flip exogenous variables is treated as endogenous
1. The presence of a NaN for an endogenous variable not declared as a flip variable is an error
1. The corner case of unconditional forecast should be accepted for ease of use
1. The solution is written back in ``y`` and ``x`` irrespective of the actual role of a variable in a given period
### Operations
``general_solver`` dispatches la résolution du nouveau problème selon
1. purely backward linear model
1. purely backward nonlinear model
1. purely forward linear model (if we have the algorithm...)
1. purely forward nonlinear model
1. general linear model
1. general nonlinear model
1. bytecode and or block model
and according to the options selecting a particular algorithmModel inversion and deterministic conditional forecast solve the same mathematical problem: solving a (non-)linear system where the identity of the unknown variables change from period to period. I suggest to create a unique function that would solve such problems.
``general_solver`` would take at least the following arguments:
* y: endogenous variables (matrix)
* x: exogenous variables (matrix) [possible concatenation of exo_det variables to the right]
* model: model (function handle)
* i_endo_flip: flip variables indices in endogenous variables (vector)
* i_exo_flip: flip variables indices in exogenous variables (vector)
### Conventions
1. there are as many endogenous flip variables as exogenenous or exo det variables
1. the endogenous and exogenous flip variables are in the same order (not necessary to be contiguous but may help)
1. given the indices vector of flip variablesm implicit pairs of endogenous/exogenous variables are formed
1. If the observation of an endogenous variable is a NaN, the endogenous variables plays it usual role of endogenous variable
1. If the observation of an endogenous variables is a valid number, the endogenous variable is treated as exogenous and the corresponding flip exogenous variables is treated as endogenous
1. The presence of a NaN for an endogenous variable not declared as a flip variable is an error
1. The corner case of unconditional forecast should be accepted for ease of use
1. The solution is written back in ``y`` and ``x`` irrespective of the actual role of a variable in a given period
### Operations
``general_solver`` dispatches la résolution du nouveau problème selon
1. purely backward linear model
1. purely backward nonlinear model
1. purely forward linear model (if we have the algorithm...)
1. purely forward nonlinear model
1. general linear model
1. general nonlinear model
1. bytecode and or block model
and according to the options selecting a particular algorithm4.7https://git.dynare.org/Dynare/dynare/-/issues/1701det_conditional_forecast doesn't set set options_.qz_criterium2020-02-03T17:37:21ZMichelJuillarddet_conditional_forecast doesn't set set options_.qz_criteriumWhen ``det_conditional_forecast`` is used by itself in a *.mod file as in the example of the manual options_.qz_criterium isn't set.
We should have
```
options_.qz_criterium = 1+1e-6;
```
at the beginning of the functionWhen ``det_conditional_forecast`` is used by itself in a *.mod file as in the example of the manual options_.qz_criterium isn't set.
We should have
```
options_.qz_criterium = 1+1e-6;
```
at the beginning of the function4.6https://git.dynare.org/Dynare/dynare/-/issues/1702det_cond_forecast() argument checking is broken2020-02-11T09:44:04ZMichelJuillarddet_cond_forecast() argument checking is brokenIf one calls det_cond_forecast with two arguments only as in the manual example, the function fails with error
```
impossible case
```
that is triggered near line 208If one calls det_cond_forecast with two arguments only as in the manual example, the function fails with error
```
impossible case
```
that is triggered near line 2084.7MichelJuillardMichelJuillardhttps://git.dynare.org/Dynare/dynare/-/issues/1703det_cond_forecast() depends on oo_.dr.state_var but this is not always available2020-02-11T10:08:29ZMichelJuillarddet_cond_forecast() depends on oo_.dr.state_var but this is not always available``det_cond_forecast()`` depends on ``oo_.dr.state_var`` but this variable is computed by ``dyn_first_order_solver``. So it isn't available for a purely backward or purely forward model``det_cond_forecast()`` depends on ``oo_.dr.state_var`` but this variable is computed by ``dyn_first_order_solver``. So it isn't available for a purely backward or purely forward model4.7MichelJuillardMichelJuillardhttps://git.dynare.org/Dynare/dynare/-/issues/1704Update partial information code2020-03-02T16:14:50ZSébastien VillemotUpdate partial information codeFirst version located in https://git.dynare.org/Yang/dynareFirst version located in https://git.dynare.org/Yang/dynare4.7Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1705Fix, clean and speed up discretionary_policy routines2020-02-12T16:18:04ZJohannes Pfeifer Fix, clean and speed up discretionary_policy routinesAs is `discretionary_policy_1.m` has various issues
1. At its end, we have
```
function ys=NondistortionarySteadyState(M_)
if exist([M_.fname,'_steadystate.m'],'file')
eval(['ys=',M_.fname,'_steadystate.m;'])
else
ys=zeros(M_.endo_nbr,1);
end
```
which seems to miss the case of a `steady_state_model`-block. It's also not clear why we have this in any case. At the end of the function, we write `ys` based on this input. But throughout the function, like in
```
[U,Uy,W] = feval([M_.fname,'.objective.static'],zeros(endo_nbr,1),[], M_.params);
```
we assume the steady state to be 0.
2. The handling of error codes should be nested into the `print_info`-framework as opposed to always issuing errors.
3. The function is very verbatim in terms of providing diagnostics. That is useful in standalone code, but a bottleneck when run in a loop like `estimation` where we only want to discard infeasible draws without providing diagnostics.
4. The order of some checks is strange. We do computations on the model before checking e.g. whether the number of instruments is valid. We should be able to do this without computing the Jacobian. Also a check like this should only be done once in the context of estimation and does not belong into the core engine. This suggests a different factorization.
Related to https://git.dynare.org/Dynare/dynare/issues/1173As is `discretionary_policy_1.m` has various issues
1. At its end, we have
```
function ys=NondistortionarySteadyState(M_)
if exist([M_.fname,'_steadystate.m'],'file')
eval(['ys=',M_.fname,'_steadystate.m;'])
else
ys=zeros(M_.endo_nbr,1);
end
```
which seems to miss the case of a `steady_state_model`-block. It's also not clear why we have this in any case. At the end of the function, we write `ys` based on this input. But throughout the function, like in
```
[U,Uy,W] = feval([M_.fname,'.objective.static'],zeros(endo_nbr,1),[], M_.params);
```
we assume the steady state to be 0.
2. The handling of error codes should be nested into the `print_info`-framework as opposed to always issuing errors.
3. The function is very verbatim in terms of providing diagnostics. That is useful in standalone code, but a bottleneck when run in a loop like `estimation` where we only want to discard infeasible draws without providing diagnostics.
4. The order of some checks is strange. We do computations on the model before checking e.g. whether the number of instruments is valid. We should be able to do this without computing the Jacobian. Also a check like this should only be done once in the context of estimation and does not belong into the core engine. This suggests a different factorization.
Related to https://git.dynare.org/Dynare/dynare/issues/11734.6Johannes Pfeifer Johannes Pfeifer https://git.dynare.org/Dynare/dynare/-/issues/1706Fix wrong computation in third-order approximation in pruned_state_space.m2020-04-06T08:19:17ZJohannes Pfeifer Fix wrong computation in third-order approximation in pruned_state_space.mMattermost discussion 06/02/20Mattermost discussion 06/02/204.6Willi Mutschlerwilli@mutschler.euWilli Mutschlerwilli@mutschler.euhttps://git.dynare.org/Dynare/dynare/-/issues/1707Macro commands that take no arguments have spurious parentheses appended to t...2020-05-07T17:43:51ZSébastien VillemotMacro commands that take no arguments have spurious parentheses appended to their synopsisSee for example the definition of `@#else`, `@#endif`, `@#endfor`, `@#echomacrovars` in the reference manual.See for example the definition of `@#else`, `@#endif`, `@#endfor`, `@#echomacrovars` in the reference manual.4.7https://git.dynare.org/Dynare/dynare/-/issues/1708Preprocessor fails to parse dates with negative date2020-02-17T17:41:25ZMichelJuillardPreprocessor fails to parse dates with negative date```
dates('-4Y');
```
translates in
```
dates('-dates('4Y')');
```
and
```
'-4Y'
```
translates in
```
'-dates('4Y')';
```
See attached *.mod file[test_negative_date.mod](/uploads/bd77dc2c55701ffd505b432a2071f86d/test_negative_date.mod)
The problem didn't appear in 4.5.7```
dates('-4Y');
```
translates in
```
dates('-dates('4Y')');
```
and
```
'-4Y'
```
translates in
```
'-dates('4Y')';
```
See attached *.mod file[test_negative_date.mod](/uploads/bd77dc2c55701ffd505b432a2071f86d/test_negative_date.mod)
The problem didn't appear in 4.5.74.6Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/-/issues/1709Automatic detrending2020-03-06T17:35:41ZFerhatMihoubiAutomatic detrendingFor the moment the deterministic or stochastic trends have to be declared using the trend_var (or log_trend_var) commands and the option deflator (or log_deflator) in var command to declare the trended variables.
The purpose of the new feature is to find and remove automatically the trends. To do so, the proposal is to add :
- an option in var command to indicate if the variable is expressed in logarithm or not (the default being not in logarithm). For instance *var(log) list of variables*.
- a command that will add to all endogenous variables a growth factor (additive or multiplicative depending on the previously declared status) and the equations that put in relation all the growth factors to theirs endogenous variables. This step should be performed in the preprocessor to produce a new dynamic model containing all the endogenous variables and the growth factor associated to all the endogenous variables.
- during the execution the complete new dynamic model should be solved to compute the growth factors and the steady state values of the endogenous variables.
This command could be *detrend* for instance.For the moment the deterministic or stochastic trends have to be declared using the trend_var (or log_trend_var) commands and the option deflator (or log_deflator) in var command to declare the trended variables.
The purpose of the new feature is to find and remove automatically the trends. To do so, the proposal is to add :
- an option in var command to indicate if the variable is expressed in logarithm or not (the default being not in logarithm). For instance *var(log) list of variables*.
- a command that will add to all endogenous variables a growth factor (additive or multiplicative depending on the previously declared status) and the equations that put in relation all the growth factors to theirs endogenous variables. This step should be performed in the preprocessor to produce a new dynamic model containing all the endogenous variables and the growth factor associated to all the endogenous variables.
- during the execution the complete new dynamic model should be solved to compute the growth factors and the steady state values of the endogenous variables.
This command could be *detrend* for instance.https://git.dynare.org/Dynare/dynare/-/issues/1710num_procs doesn't exist in Matalb R2019b anymore2020-02-22T17:49:35ZMichelJuillardnum_procs doesn't exist in Matalb R2019b anymoreThere is no function ``num_procs``in Matlab release 2019b
``num_procs`` is used in ``default_option_values.m`` to initialize number of threads for ``kronecker.sparse_hessian_times_B_kronecker_C``, ``perfect_foresight_problem`` and ``k_order_perturbation``
A possible alternative would be an undocumented Matlab feature: ``feature('numcores')``
Undocumented Matlab features are discussed in this old document: http://undocumentedmatlab.com/articles/undocumented-feature-function/ but is still working.There is no function ``num_procs``in Matlab release 2019b
``num_procs`` is used in ``default_option_values.m`` to initialize number of threads for ``kronecker.sparse_hessian_times_B_kronecker_C``, ``perfect_foresight_problem`` and ``k_order_perturbation``
A possible alternative would be an undocumented Matlab feature: ``feature('numcores')``
Undocumented Matlab features are discussed in this old document: http://undocumentedmatlab.com/articles/undocumented-feature-function/ but is still working.https://git.dynare.org/Dynare/dynare/-/issues/1711Provide M_ as output of stoch_simul and discretionary_policy2020-05-06T14:33:56ZJohannes Pfeifer Provide M_ as output of stoch_simul and discretionary_policyWe forgot in https://git.dynare.org/Dynare/dynare/commit/e043c60903dd0e5746feb8af25cd60f1dbcbe53f
that within the computation of decision rules, the steady state file can change parameters and therefore `M_.params`. In the current version, that change will not be passed to the base workspace.We forgot in https://git.dynare.org/Dynare/dynare/commit/e043c60903dd0e5746feb8af25cd60f1dbcbe53f
that within the computation of decision rules, the steady state file can change parameters and therefore `M_.params`. In the current version, that change will not be passed to the base workspace.https://git.dynare.org/Dynare/dynare/-/issues/1712Difficulty configuring dynare in Ubuntu 18.042020-03-17T10:31:02ZCraig FratrikDifficulty configuring dynare in Ubuntu 18.04There doesn't seem to be an easy way to get Ubuntu 18.04 to default to GCC 8 if GCC 7 is around, which is normally is because of build-essentials.
It would be nice if the configure script for dynare, double checked that gcc and g++ and gfortran are >= 8, and if they aren't lookede for gcc-8, etc. instead.
I'm not sure how much work this would be inside the configure scripts. But if you think it's a good idea I can look into it. It would be especially helpful if you had thoughts on the best way to do this, because I'm ignorant when it comes to configure things.
I did write this script after >30m of searching on the internet [update-alternatives.sh](/uploads/7fd44dc23129675f12ea787e3c5e561c/update-alternatives.sh)There doesn't seem to be an easy way to get Ubuntu 18.04 to default to GCC 8 if GCC 7 is around, which is normally is because of build-essentials.
It would be nice if the configure script for dynare, double checked that gcc and g++ and gfortran are >= 8, and if they aren't lookede for gcc-8, etc. instead.
I'm not sure how much work this would be inside the configure scripts. But if you think it's a good idea I can look into it. It would be especially helpful if you had thoughts on the best way to do this, because I'm ignorant when it comes to configure things.
I did write this script after >30m of searching on the internet [update-alternatives.sh](/uploads/7fd44dc23129675f12ea787e3c5e561c/update-alternatives.sh)https://git.dynare.org/Dynare/dynare/-/issues/1713Decide minimal MATLAB version requirement for Dynare 4.72020-04-02T16:14:40ZSébastien VillemotDecide minimal MATLAB version requirement for Dynare 4.7We need to decide what will be the minimal version of MATLAB required to run Dynare 4.7.
For Dynare 4.6, our policy has been to support MATLAB versions that are at most 10 years old.
Assuming that Dynare 4.7 is released in 2021, keeping the same policy would imply raising the minimal MATLAB version to R2011a or R2011b (depending on the exact release date).
But we could also decide to change our policy and support less versions. For example, we could go for a 5-years windows, which would imply R2016a or R2016b. Or we could choose something between 5 and 10 years.
Relevant to this discussion is the list of [MATLAB incompatibilities across versions](https://git.dynare.org/Dynare/dynare/-/wikis/MATLAB-Versions). Here are the main benefits that would bring certain requirements:
- *R2013a*: we could get rid of the hack needed to support `intersect(…, 'stable')`
- *R2014a*: we could easily install the minimal required MATLAB version on modern GNU/Linux systems (currently we need a hack to create an artificial `eth0` device with the correct MAC address)
- *R2016a*: we could drop the support for 32-bit versions, which would halve the size of the Windows installer and simplify the build process
- *R2016b*: we could use automatic broadcasting in many places, instead of the obscure `bsxfun` syntaxWe need to decide what will be the minimal version of MATLAB required to run Dynare 4.7.
For Dynare 4.6, our policy has been to support MATLAB versions that are at most 10 years old.
Assuming that Dynare 4.7 is released in 2021, keeping the same policy would imply raising the minimal MATLAB version to R2011a or R2011b (depending on the exact release date).
But we could also decide to change our policy and support less versions. For example, we could go for a 5-years windows, which would imply R2016a or R2016b. Or we could choose something between 5 and 10 years.
Relevant to this discussion is the list of [MATLAB incompatibilities across versions](https://git.dynare.org/Dynare/dynare/-/wikis/MATLAB-Versions). Here are the main benefits that would bring certain requirements:
- *R2013a*: we could get rid of the hack needed to support `intersect(…, 'stable')`
- *R2014a*: we could easily install the minimal required MATLAB version on modern GNU/Linux systems (currently we need a hack to create an artificial `eth0` device with the correct MAC address)
- *R2016a*: we could drop the support for 32-bit versions, which would halve the size of the Windows installer and simplify the build process
- *R2016b*: we could use automatic broadcasting in many places, instead of the obscure `bsxfun` syntax4.7Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1714`get_error_message` does not return an output when `options_.noprint = 1`2020-03-10T08:26:24ZAliaksandr Zaretski`get_error_message` does not return an output when `options_.noprint = 1`The function `get_error_message` must return an output, but does so only when `options_.noprint = 0`. Hence, there is an unexpected error message when both `info(1) > 0` and `options_.noprint = 1`. To replicate, see attached [example1_ed.mod](/uploads/f0716731f7540ce7030e68dd2e5de1eb/example1_ed.mod), where I set `alpha = -0.36` to generate an error and added the `noprint` option. See attached slightly revised [print_info.m](/uploads/30439caa39aacbdac9f9e1b2a644483b/print_info.m) and [get_error_message.m](/uploads/c15787c57bb9e46b6a3136be9a803db9/get_error_message.m) where the issue is solved.The function `get_error_message` must return an output, but does so only when `options_.noprint = 0`. Hence, there is an unexpected error message when both `info(1) > 0` and `options_.noprint = 1`. To replicate, see attached [example1_ed.mod](/uploads/f0716731f7540ce7030e68dd2e5de1eb/example1_ed.mod), where I set `alpha = -0.36` to generate an error and added the `noprint` option. See attached slightly revised [print_info.m](/uploads/30439caa39aacbdac9f9e1b2a644483b/print_info.m) and [get_error_message.m](/uploads/c15787c57bb9e46b6a3136be9a803db9/get_error_message.m) where the issue is solved.https://git.dynare.org/Dynare/dynare/-/issues/1715Clean root folder of /tests2020-03-07T17:21:34ZJohannes Pfeifer Clean root folder of /testsAll integration tests should be in subfolders. The current structure is a messAll integration tests should be in subfolders. The current structure is a mess4.7https://git.dynare.org/Dynare/dynare/-/issues/1716Fix bug in contemp_reduced_form of SBVAR2020-03-16T08:27:57ZJohannes Pfeifer Fix bug in contemp_reduced_form of SBVARAs outlined in https://forum.dynare.org/t/different-results-of-a0-using-sbvar/15359 the attached codes crashes due to non-conformable matrices.
[MacroData.mat](/uploads/e30cd873d1add8fc54a1e0e65aa0949d/MacroData.mat)
[constantRecursiveBVAR.mod](/uploads/f7b1c204676a2323d03a467702f6e3c5/constantRecursiveBVAR.mod)As outlined in https://forum.dynare.org/t/different-results-of-a0-using-sbvar/15359 the attached codes crashes due to non-conformable matrices.
[MacroData.mat](/uploads/e30cd873d1add8fc54a1e0e65aa0949d/MacroData.mat)
[constantRecursiveBVAR.mod](/uploads/f7b1c204676a2323d03a467702f6e3c5/constantRecursiveBVAR.mod)https://git.dynare.org/Dynare/dynare/-/issues/1718Auxillary particle filter --- number_of_state_variables is undefined2020-03-30T10:09:49ZArtur ZmanovskiiAuxillary particle filter --- number_of_state_variables is undefinedIn `particles/src/auxiliary_particle_filter.m` under specific options (`options_.particle.pruning=1`, `resampling` in `estimation()` is `systematic/generic`), a chunk of code is executed (lines 136--139), which has undefined variable (`number_of_state_variables` --- at lines 137--138) and causes error.In `particles/src/auxiliary_particle_filter.m` under specific options (`options_.particle.pruning=1`, `resampling` in `estimation()` is `systematic/generic`), a chunk of code is executed (lines 136--139), which has undefined variable (`number_of_state_variables` --- at lines 137--138) and causes error.4.7Stéphane Adjemianstepan@adjemian.euStéphane Adjemianstepan@adjemian.euhttps://git.dynare.org/Dynare/dynare/-/issues/1719Allow running shock_decomposition on simulated model2020-03-31T16:18:23ZJohannes Pfeifer Allow running shock_decomposition on simulated modelCurrently, `shock_decomposition` only allows for
```
if isempty(parameter_set)
if isfield(oo_,'posterior_mean')
parameter_set = 'posterior_mean';
elseif isfield(oo_,'mle_mode')
parameter_set = 'mle_mode';
elseif isfield(oo_,'posterior')
parameter_set = 'posterior_mode';
else
error(['shock_decomposition: option parameter_set is not specified ' ...
'and posterior mode is not available'])
end
end
```
but then we call `evaluate_smoother`, where we allow for
```
switch parameters
case 'posterior_mode'
parameters = get_posterior_parameters('mode',M_,estim_params_,oo_,options_);
case 'posterior_mean'
parameters = get_posterior_parameters('mean',M_,estim_params_,oo_,options_);
case 'posterior_median'
parameters = get_posterior_parameters('median',M_,estim_params_,oo_,options_);
case 'mle_mode'
parameters = get_posterior_parameters('mode',M_,estim_params_,oo_,options_,'mle_');
case 'prior_mode'
parameters = bayestopt_.p5(:);
case 'prior_mean'
parameters = bayestopt_.p1;
case 'calibration'
if isempty(oo_.dr)
error('You must run ''stoch_simul'' first.');
end
parameters = [];
```Currently, `shock_decomposition` only allows for
```
if isempty(parameter_set)
if isfield(oo_,'posterior_mean')
parameter_set = 'posterior_mean';
elseif isfield(oo_,'mle_mode')
parameter_set = 'mle_mode';
elseif isfield(oo_,'posterior')
parameter_set = 'posterior_mode';
else
error(['shock_decomposition: option parameter_set is not specified ' ...
'and posterior mode is not available'])
end
end
```
but then we call `evaluate_smoother`, where we allow for
```
switch parameters
case 'posterior_mode'
parameters = get_posterior_parameters('mode',M_,estim_params_,oo_,options_);
case 'posterior_mean'
parameters = get_posterior_parameters('mean',M_,estim_params_,oo_,options_);
case 'posterior_median'
parameters = get_posterior_parameters('median',M_,estim_params_,oo_,options_);
case 'mle_mode'
parameters = get_posterior_parameters('mode',M_,estim_params_,oo_,options_,'mle_');
case 'prior_mode'
parameters = bayestopt_.p5(:);
case 'prior_mean'
parameters = bayestopt_.p1;
case 'calibration'
if isempty(oo_.dr)
error('You must run ''stoch_simul'' first.');
end
parameters = [];
```https://git.dynare.org/Dynare/dynare/-/issues/1720lmmcp does not work with purely forward or backward models2020-04-11T19:23:48ZJohannes Pfeifer lmmcp does not work with purely forward or backward modelsIn this case, the MCP-tags are ignored due to `perfect_foresight_solver_core` having checks like `if M_.maximum_endo_lead == 0` and immediately calling `sim1_purely_backward` and `sim1_purely_forward`, which do not account for the constraints. A current workaround is using dummy equations.In this case, the MCP-tags are ignored due to `perfect_foresight_solver_core` having checks like `if M_.maximum_endo_lead == 0` and immediately calling `sim1_purely_backward` and `sim1_purely_forward`, which do not account for the constraints. A current workaround is using dummy equations.4.7https://git.dynare.org/Dynare/dynare/-/issues/1721Get rid of oo_.dr.kstate2020-05-04T16:22:55ZSébastien VillemotGet rid of oo_.dr.kstateIn particular, see the discussion in #1653In particular, see the discussion in #16534.7https://git.dynare.org/Dynare/dynare/-/issues/1722Provide mapping between model local variable names and indices in the T vector2020-05-12T14:16:43ZTom HoldenProvide mapping between model local variable names and indices in the T vectorPer a request from a DynareOBC user, today I started working on making DynareOBC compatible with Dynare 4.6.
This is proving harder than expected due to the changes to preprocessor output.
Previously, DynareOBC relied on the *_static.m and *_dynamic.m files containing lines giving the value of model local variables (MLVs). This is used in multiple places, e.g. for obtaining the steady state of the augmented model, or for generating code for MLV simulation.
Of course, it is not your duty to support DynareOBC, but having this information in the static and dynamic files was generally useful. For example, in code prepared for the Dynare summer school I used to teach, I used this feature to facilitate writing code for a "perturbation plus" type simulation algorithm (i.e. perturbation used for next period values conditional on today's state and future shock, but given this approximation, the full nonlinear equations + cubature were used to derive today's value).
To make things easy again, it would be sufficient if the generated *_tt.m added comments at the end of each line defining a temporary variable (i.e. T(*)) definition with the name of the MLV to which the given element T(*) corresponds. E.g.:
`#dynareOBCMaxFunc1=max(dynareOBCMaxArgA1,dynareOBCMaxArgB1);`
would become:
`T(14) = max(T(12),T(13)); % dynareOBCMaxFunc1`
Alternatively, the optionally generated JSON could contain this information.
However, I guess that for either of these approaches to be viable as a strategy for DynareOBC to support Dynare 4.6, this would need to be added to Dynare fairly quickly (e.g. for 4.6.2), which may not be viable.
If this is not possible, (and in any case), it would be good to have some documentation of what users can safely assume about the elements of the T vector. A few relevant questions follow:
1. Are all MLVs defined in the model block and used somewhere in the model guaranteed to be in the T vector?
2. If MLV A is defined before MLV B in the model block, then will A definitely be before B in the T vector?
3. Are the MLVs guaranteed to be the first elements of the T vector, or could MLVs and generated temporaries be interspersed?Per a request from a DynareOBC user, today I started working on making DynareOBC compatible with Dynare 4.6.
This is proving harder than expected due to the changes to preprocessor output.
Previously, DynareOBC relied on the *_static.m and *_dynamic.m files containing lines giving the value of model local variables (MLVs). This is used in multiple places, e.g. for obtaining the steady state of the augmented model, or for generating code for MLV simulation.
Of course, it is not your duty to support DynareOBC, but having this information in the static and dynamic files was generally useful. For example, in code prepared for the Dynare summer school I used to teach, I used this feature to facilitate writing code for a "perturbation plus" type simulation algorithm (i.e. perturbation used for next period values conditional on today's state and future shock, but given this approximation, the full nonlinear equations + cubature were used to derive today's value).
To make things easy again, it would be sufficient if the generated *_tt.m added comments at the end of each line defining a temporary variable (i.e. T(*)) definition with the name of the MLV to which the given element T(*) corresponds. E.g.:
`#dynareOBCMaxFunc1=max(dynareOBCMaxArgA1,dynareOBCMaxArgB1);`
would become:
`T(14) = max(T(12),T(13)); % dynareOBCMaxFunc1`
Alternatively, the optionally generated JSON could contain this information.
However, I guess that for either of these approaches to be viable as a strategy for DynareOBC to support Dynare 4.6, this would need to be added to Dynare fairly quickly (e.g. for 4.6.2), which may not be viable.
If this is not possible, (and in any case), it would be good to have some documentation of what users can safely assume about the elements of the T vector. A few relevant questions follow:
1. Are all MLVs defined in the model block and used somewhere in the model guaranteed to be in the T vector?
2. If MLV A is defined before MLV B in the model block, then will A definitely be before B in the T vector?
3. Are the MLVs guaranteed to be the first elements of the T vector, or could MLVs and generated temporaries be interspersed?4.7Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1723Equations defining model local variables are not included in generated JSON f...2020-05-12T14:19:03ZTom HoldenEquations defining model local variables are not included in generated JSON filesThis bug came up in conversation with @MichelJuillard .
For example, this model block:
```
model;
#Pi=exp(pi);
#Pi_LEAD=exp(pi(1));
#Pi_STEADY=exp(pi_STEADY);
#kappa=(gamma/2)*(Pi-1)^2;
#kappa_STEADY=(gamma/2)*(Pi_STEADY-1)^2;
#c=log(1-kappa-eta)+y;
#c_LEAD=log(1-(gamma/2)*(Pi_LEAD-1)^2-eta)+y(1);
#h=y-z;
#w=sigma*c+nu*h-log(1-tauw);
#re=-log(beta)-d(1)+pi_STEADY;
#y_STEADY=(1/(sigma+nu))*(log((1-tauw)*((1-beta)*(Pi_STEADY-1)*Pi_STEADY/theta*gamma+1))-sigma*log(1-kappa_STEADY-eta));
#gdp=log(1-kappa)+y;
#gdp_STEADY=log(1-kappa_STEADY)+y_STEADY;
#dynareOBCMaxArgA1=(0);
#dynareOBCMaxArgB1=(re+phi_pi*(pi-pi_STEADY)+phi_y*(gdp-gdp_STEADY));
#dynareOBCMaxFunc1=max(dynareOBCMaxArgA1,dynareOBCMaxArgB1);
r=(dynareOBCMaxFunc1);
1=beta*exp(d(1)+r-pi(1)+sigma*(c-c_LEAD));
(Pi-1)*Pi=theta/gamma*(exp(w-z)-1)+beta*exp(d(1)+sigma*(c-c_LEAD)+y(1)-y)*(Pi_LEAD-1)*Pi_LEAD;
d=rhod*d(-1)+sigmad*epsilond;
z=rhoz*z(-1)+sigmaz*epsilonz;
end;
```
becomes this in the JSON file (with `json=parse`):
```
...
"model":[
{"lhs": "r", "rhs": "dynareOBCMaxFunc1", "line": 37}
, {"lhs": "1", "rhs": "beta*exp(d(1)+r-pi(1)+sigma*(c-c_LEAD))", "line": 38}
, {"lhs": "Pi*(Pi-1)", "rhs": "theta/gamma*(exp(w-z)-1)+Pi_LEAD*(Pi_LEAD-1)*beta*exp(y(1)+d(1)+sigma*(c-c_LEAD)-y)", "line": 39}
, {"lhs": "d", "rhs": "rhod*d(-1)+sigmad*epsilond", "line": 40}
, {"lhs": "z", "rhs": "rhoz*z(-1)+sigmaz*epsilonz", "line": 41}
]
, "xrefs": {"parameters": [], "endogenous": [], "exogenous": [], "exogenous_deterministic": []}
, "abstract_syntax_tree":[
{ "number":0, "line":37, "AST": {"node_type" : "BinaryOpNode", "op" : "=", "arg1" : {"node_type" : "VariableNode", "name" : "r", "type" : "endogenous", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "dynareOBCMaxFunc1", "type" : "modelLocalVariable", "lag" : 0}}}, { "number":1, "line":38, "AST": {"node_type" : "BinaryOpNode", "op" : "=", "arg1" : {"node_type" : "NumConstNode", "value" : 1}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "beta", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "UnaryOpNode", "op" : "exp", "arg" : {"node_type" : "BinaryOpNode", "op" : "+", "arg1" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "BinaryOpNode", "op" : "+", "arg1" : {"node_type" : "VariableNode", "name" : "d", "type" : "endogenous", "lag" : 1}, "arg2" : {"node_type" : "VariableNode", "name" : "r", "type" : "endogenous", "lag" : 0}}, "arg2" : {"node_type" : "VariableNode", "name" : "pi", "type" : "endogenous", "lag" : 1}}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "sigma", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "VariableNode", "name" : "c", "type" : "modelLocalVariable", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "c_LEAD", "type" : "modelLocalVariable", "lag" : 0}}}}}}}}, { "number":2, "line":39, "AST": {"node_type" : "BinaryOpNode", "op" : "=", "arg1" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "Pi", "type" : "modelLocalVariable", "lag" : 0}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "VariableNode", "name" : "Pi", "type" : "modelLocalVariable", "lag" : 0}, "arg2" : {"node_type" : "NumConstNode", "value" : 1}}}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "+", "arg1" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "BinaryOpNode", "op" : "/", "arg1" : {"node_type" : "VariableNode", "name" : "theta", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "gamma", "type" : "parameter", "lag" : 0}}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "UnaryOpNode", "op" : "exp", "arg" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "VariableNode", "name" : "w", "type" : "modelLocalVariable", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "z", "type" : "endogenous", "lag" : 0}}}, "arg2" : {"node_type" : "NumConstNode", "value" : 1}}}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "Pi_LEAD", "type" : "modelLocalVariable", "lag" : 0}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "VariableNode", "name" : "Pi_LEAD", "type" : "modelLocalVariable", "lag" : 0}, "arg2" : {"node_type" : "NumConstNode", "value" : 1}}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "beta", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "UnaryOpNode", "op" : "exp", "arg" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "BinaryOpNode", "op" : "+", "arg1" : {"node_type" : "VariableNode", "name" : "y", "type" : "endogenous", "lag" : 1}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "+", "arg1" : {"node_type" : "VariableNode", "name" : "d", "type" : "endogenous", "lag" : 1}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "sigma", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "VariableNode", "name" : "c", "type" : "modelLocalVariable", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "c_LEAD", "type" : "modelLocalVariable", "lag" : 0}}}}}, "arg2" : {"node_type" : "VariableNode", "name" : "y", "type" : "endogenous", "lag" : 0}}}}}}}}}, { "number":3, "line":40, "AST": {"node_type" : "BinaryOpNode", "op" : "=", "arg1" : {"node_type" : "VariableNode", "name" : "d", "type" : "endogenous", "lag" : 0}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "+", "arg1" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "rhod", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "d", "type" : "endogenous", "lag" : -1}}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "sigmad", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "epsilond", "type" : "exogenous", "lag" : 0}}}}}, { "number":4, "line":41, "AST": {"node_type" : "BinaryOpNode", "op" : "=", "arg1" : {"node_type" : "VariableNode", "name" : "z", "type" : "endogenous", "lag" : 0}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "+", "arg1" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "rhoz", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "z", "type" : "endogenous", "lag" : -1}}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "sigmaz", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "epsilonz", "type" : "exogenous", "lag" : 0}}}}}], "variable_mapping":[
], "statements": [{"statementName": "param_init", "name": "beta", "value": "0.997"},
...
```This bug came up in conversation with @MichelJuillard .
For example, this model block:
```
model;
#Pi=exp(pi);
#Pi_LEAD=exp(pi(1));
#Pi_STEADY=exp(pi_STEADY);
#kappa=(gamma/2)*(Pi-1)^2;
#kappa_STEADY=(gamma/2)*(Pi_STEADY-1)^2;
#c=log(1-kappa-eta)+y;
#c_LEAD=log(1-(gamma/2)*(Pi_LEAD-1)^2-eta)+y(1);
#h=y-z;
#w=sigma*c+nu*h-log(1-tauw);
#re=-log(beta)-d(1)+pi_STEADY;
#y_STEADY=(1/(sigma+nu))*(log((1-tauw)*((1-beta)*(Pi_STEADY-1)*Pi_STEADY/theta*gamma+1))-sigma*log(1-kappa_STEADY-eta));
#gdp=log(1-kappa)+y;
#gdp_STEADY=log(1-kappa_STEADY)+y_STEADY;
#dynareOBCMaxArgA1=(0);
#dynareOBCMaxArgB1=(re+phi_pi*(pi-pi_STEADY)+phi_y*(gdp-gdp_STEADY));
#dynareOBCMaxFunc1=max(dynareOBCMaxArgA1,dynareOBCMaxArgB1);
r=(dynareOBCMaxFunc1);
1=beta*exp(d(1)+r-pi(1)+sigma*(c-c_LEAD));
(Pi-1)*Pi=theta/gamma*(exp(w-z)-1)+beta*exp(d(1)+sigma*(c-c_LEAD)+y(1)-y)*(Pi_LEAD-1)*Pi_LEAD;
d=rhod*d(-1)+sigmad*epsilond;
z=rhoz*z(-1)+sigmaz*epsilonz;
end;
```
becomes this in the JSON file (with `json=parse`):
```
...
"model":[
{"lhs": "r", "rhs": "dynareOBCMaxFunc1", "line": 37}
, {"lhs": "1", "rhs": "beta*exp(d(1)+r-pi(1)+sigma*(c-c_LEAD))", "line": 38}
, {"lhs": "Pi*(Pi-1)", "rhs": "theta/gamma*(exp(w-z)-1)+Pi_LEAD*(Pi_LEAD-1)*beta*exp(y(1)+d(1)+sigma*(c-c_LEAD)-y)", "line": 39}
, {"lhs": "d", "rhs": "rhod*d(-1)+sigmad*epsilond", "line": 40}
, {"lhs": "z", "rhs": "rhoz*z(-1)+sigmaz*epsilonz", "line": 41}
]
, "xrefs": {"parameters": [], "endogenous": [], "exogenous": [], "exogenous_deterministic": []}
, "abstract_syntax_tree":[
{ "number":0, "line":37, "AST": {"node_type" : "BinaryOpNode", "op" : "=", "arg1" : {"node_type" : "VariableNode", "name" : "r", "type" : "endogenous", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "dynareOBCMaxFunc1", "type" : "modelLocalVariable", "lag" : 0}}}, { "number":1, "line":38, "AST": {"node_type" : "BinaryOpNode", "op" : "=", "arg1" : {"node_type" : "NumConstNode", "value" : 1}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "beta", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "UnaryOpNode", "op" : "exp", "arg" : {"node_type" : "BinaryOpNode", "op" : "+", "arg1" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "BinaryOpNode", "op" : "+", "arg1" : {"node_type" : "VariableNode", "name" : "d", "type" : "endogenous", "lag" : 1}, "arg2" : {"node_type" : "VariableNode", "name" : "r", "type" : "endogenous", "lag" : 0}}, "arg2" : {"node_type" : "VariableNode", "name" : "pi", "type" : "endogenous", "lag" : 1}}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "sigma", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "VariableNode", "name" : "c", "type" : "modelLocalVariable", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "c_LEAD", "type" : "modelLocalVariable", "lag" : 0}}}}}}}}, { "number":2, "line":39, "AST": {"node_type" : "BinaryOpNode", "op" : "=", "arg1" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "Pi", "type" : "modelLocalVariable", "lag" : 0}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "VariableNode", "name" : "Pi", "type" : "modelLocalVariable", "lag" : 0}, "arg2" : {"node_type" : "NumConstNode", "value" : 1}}}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "+", "arg1" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "BinaryOpNode", "op" : "/", "arg1" : {"node_type" : "VariableNode", "name" : "theta", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "gamma", "type" : "parameter", "lag" : 0}}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "UnaryOpNode", "op" : "exp", "arg" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "VariableNode", "name" : "w", "type" : "modelLocalVariable", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "z", "type" : "endogenous", "lag" : 0}}}, "arg2" : {"node_type" : "NumConstNode", "value" : 1}}}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "Pi_LEAD", "type" : "modelLocalVariable", "lag" : 0}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "VariableNode", "name" : "Pi_LEAD", "type" : "modelLocalVariable", "lag" : 0}, "arg2" : {"node_type" : "NumConstNode", "value" : 1}}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "beta", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "UnaryOpNode", "op" : "exp", "arg" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "BinaryOpNode", "op" : "+", "arg1" : {"node_type" : "VariableNode", "name" : "y", "type" : "endogenous", "lag" : 1}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "+", "arg1" : {"node_type" : "VariableNode", "name" : "d", "type" : "endogenous", "lag" : 1}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "sigma", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "-", "arg1" : {"node_type" : "VariableNode", "name" : "c", "type" : "modelLocalVariable", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "c_LEAD", "type" : "modelLocalVariable", "lag" : 0}}}}}, "arg2" : {"node_type" : "VariableNode", "name" : "y", "type" : "endogenous", "lag" : 0}}}}}}}}}, { "number":3, "line":40, "AST": {"node_type" : "BinaryOpNode", "op" : "=", "arg1" : {"node_type" : "VariableNode", "name" : "d", "type" : "endogenous", "lag" : 0}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "+", "arg1" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "rhod", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "d", "type" : "endogenous", "lag" : -1}}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "sigmad", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "epsilond", "type" : "exogenous", "lag" : 0}}}}}, { "number":4, "line":41, "AST": {"node_type" : "BinaryOpNode", "op" : "=", "arg1" : {"node_type" : "VariableNode", "name" : "z", "type" : "endogenous", "lag" : 0}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "+", "arg1" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "rhoz", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "z", "type" : "endogenous", "lag" : -1}}, "arg2" : {"node_type" : "BinaryOpNode", "op" : "*", "arg1" : {"node_type" : "VariableNode", "name" : "sigmaz", "type" : "parameter", "lag" : 0}, "arg2" : {"node_type" : "VariableNode", "name" : "epsilonz", "type" : "exogenous", "lag" : 0}}}}}], "variable_mapping":[
], "statements": [{"statementName": "param_init", "name": "beta", "value": "0.997"},
...
```4.7Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1724Method of Moments in Dynare (GMM, SMM, IRF Matching)2020-05-28T06:11:04ZWilli Mutschlerwilli@mutschler.euMethod of Moments in Dynare (GMM, SMM, IRF Matching)Hey,
I am working on a first draft for a toolbox for moment estimation with GMM, SMM and IRF-Matching (I will start with GMM, then SMM, and deal with IRF-matching later) which will work for perturbation (with pruning) up to third-order. I have a couple of questions|proposal for the best interface and call for this and would like your guys take on this.
### Declaring parameters
Here I would simply opt to what we do in a Maximum likelihood estimation and use the same syntax in an `estimated_params` or an `estimated_params_bounds` block:
```
stderr VARIABLE_NAME | corr VARIABLE_NAME_1, VARIABLE_NAME_2 | PARAMETER_NAME, LOWER_BOUND, UPPER_BOUND;
```
### Declaring which moments to use
Here I would propose a block similar to `moment_calibration`, but call it `estimated_moments`:
```
estimated_moments;
y_obs,y_obs; //[unconditional variance]
y_obs,y_obs(-(1:4)); //[some acf]
@#for ilag in -2:2
y_obs,R_obs(@{ilag}); //[ccf]
@#endfor
end;
```
### Invocation
Now the toughest question. How to invoke it? I see two options.
Option A: Add an option to `estimation`, e.g.
```
estimation(moments_estimation='GMM');
```
Option B: Have an own command for this, e.g.:
```
gmm_estimation(OPTIONS);
smm_estimation(OPTIONS);
irf_matching(OPTIONS);
```
which then internally calls a wrapper `dynare_moments_estimation.m` and runs the toolbox.
What do you guys think?Hey,
I am working on a first draft for a toolbox for moment estimation with GMM, SMM and IRF-Matching (I will start with GMM, then SMM, and deal with IRF-matching later) which will work for perturbation (with pruning) up to third-order. I have a couple of questions|proposal for the best interface and call for this and would like your guys take on this.
### Declaring parameters
Here I would simply opt to what we do in a Maximum likelihood estimation and use the same syntax in an `estimated_params` or an `estimated_params_bounds` block:
```
stderr VARIABLE_NAME | corr VARIABLE_NAME_1, VARIABLE_NAME_2 | PARAMETER_NAME, LOWER_BOUND, UPPER_BOUND;
```
### Declaring which moments to use
Here I would propose a block similar to `moment_calibration`, but call it `estimated_moments`:
```
estimated_moments;
y_obs,y_obs; //[unconditional variance]
y_obs,y_obs(-(1:4)); //[some acf]
@#for ilag in -2:2
y_obs,R_obs(@{ilag}); //[ccf]
@#endfor
end;
```
### Invocation
Now the toughest question. How to invoke it? I see two options.
Option A: Add an option to `estimation`, e.g.
```
estimation(moments_estimation='GMM');
```
Option B: Have an own command for this, e.g.:
```
gmm_estimation(OPTIONS);
smm_estimation(OPTIONS);
irf_matching(OPTIONS);
```
which then internally calls a wrapper `dynare_moments_estimation.m` and runs the toolbox.
What do you guys think?4.7https://git.dynare.org/Dynare/dynare/-/issues/1725Better interface for mfs option2020-05-20T10:14:37ZSébastien VillemotBetter interface for mfs optionThe `mfs` option of the `model` keyword, that enables an additional optimization in the block decomposition, has an unfriendly interface. It currently accepts an integer, while it would be more natural to use keywords (the challenge is to choose keywords that reflect the natural ordering of the possible values).
The old integer values would still have to be kept for backward compatibility.
From an implementation point of view, the different values should be stored as an enum class in the preprocessor.The `mfs` option of the `model` keyword, that enables an additional optimization in the block decomposition, has an unfriendly interface. It currently accepts an integer, while it would be more natural to use keywords (the challenge is to choose keywords that reflect the natural ordering of the possible values).
The old integer values would still have to be kept for backward compatibility.
From an implementation point of view, the different values should be stored as an enum class in the preprocessor.4.7Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1726Option mfs=3 gives wrong result2020-05-20T10:26:56ZSébastien VillemotOption mfs=3 gives wrong resultThe `mfs=3` option of the `model` keyword gives wrong results.
This can for example be verified by adding `mfs=3` to `deterministic/lola_solve_one_boundary.mod`.
Once this is fixed, we should add tests that check that all the possible values of `mfs` give the same result on a given model.
The option `mfs` is also broken in version 4.6.1. Several other problems with `mfs` have already be fixed in the 4.6 branch, but the present issue is still unfixed.The `mfs=3` option of the `model` keyword gives wrong results.
This can for example be verified by adding `mfs=3` to `deterministic/lola_solve_one_boundary.mod`.
Once this is fixed, we should add tests that check that all the possible values of `mfs` give the same result on a given model.
The option `mfs` is also broken in version 4.6.1. Several other problems with `mfs` have already be fixed in the 4.6 branch, but the present issue is still unfixed.4.7Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1727Blocks of type "evaluate backward" are not correctly simulated2020-05-26T15:05:02ZSébastien VillemotBlocks of type "evaluate backward" are not correctly simulatedThe testsuite does not currently have a block of this type (which typically appears when there is a purely forward variable).
Tasks:
- [x] Fix the bug in MATLAB mode
- [ ] Fix the bug in bytecode
- [ ] Add a test in the testsuite
The test can simply consist of adding an equation to `block_bytecode/ls2003.mod`, which would read as: `pure_forward = 0.9*pure_forward(+1) + e_pure_forward;`. The `e_pure_forward` variable needs to be shocked, preferably in the end of the simulation sample.The testsuite does not currently have a block of this type (which typically appears when there is a purely forward variable).
Tasks:
- [x] Fix the bug in MATLAB mode
- [ ] Fix the bug in bytecode
- [ ] Add a test in the testsuite
The test can simply consist of adding an equation to `block_bytecode/ls2003.mod`, which would read as: `pure_forward = 0.9*pure_forward(+1) + e_pure_forward;`. The `e_pure_forward` variable needs to be shocked, preferably in the end of the simulation sample.4.7Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/390Check treatment of mh_load in MCMC Diagnostics2013-05-27T12:51:16ZJohannes Pfeifer Check treatment of mh_load in MCMC DiagnosticsSee http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4643
See http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4643
https://git.dynare.org/Dynare/dynare/-/issues/389parallel option for user defined files needed by the DYNARE project2013-05-31T13:09:43ZMarco Rattoparallel option for user defined files needed by the DYNARE projectWe should allow users to declare non standard files needed to run the projects, e.g. subroutines possibly called within the _steadystate file.
In these cases, remote threads crash since the steady state cannot be run (only threads run locally would work).
I have already written a fix to this in masterParallel.m which uses a new field local_files of parallel_info
options_.parallel_info.local_files
we need an interface to fill this field.
We have some options:
1)use the configuration file, but I do not think this would be a great idea since those cases are specific for individual dynare projects and not for general configurations of dynare.
2) use a new option local_files of the dynare command, triggered as follows, assuming a dynare project called mymodel.mod, where the files file1.m, file2.mat, myfolder/file3.txt in the project directory are needed by, e.g., the steady state file:
dynare mymodel parallel local_files=(file1.m)
this would trigger the following entry in options_.parallel_info:
options_.parallel_info.local_files = {'', 'file1.m'};
where the empty element indicates that the file is in the project directory and not in a subdirectory.
Another example:
dynare mymodel parallel local_files=(file1.m, file2.mat, myfolder/file3.txt)
this would trigger the following entry in options_.parallel_info (we need to parse and separate the subfolder from the name of the file)
options_.parallel_info.local_files = {
'', 'file1.m';
'', 'file2.mat';
'myfolder/', 'file3.txt'
};
3) use the option local_files inside, e.g., the estimation command:
estimation(datafile=mydata,mode_compute=0, ..., local_files=(file1.m, file2.mat, myfolder/file3.txt))
which would trigger in the same way the entry in options_.parallel_info.local_files
Which option would be best for you?
We should allow users to declare non standard files needed to run the projects, e.g. subroutines possibly called within the _steadystate file.
In these cases, remote threads crash since the steady state cannot be run (only threads run locally would work).
I have already written a fix to this in masterParallel.m which uses a new field local_files of parallel_info
options_.parallel_info.local_files
we need an interface to fill this field.
We have some options:
1)use the configuration file, but I do not think this would be a great idea since those cases are specific for individual dynare projects and not for general configurations of dynare.
2) use a new option local_files of the dynare command, triggered as follows, assuming a dynare project called mymodel.mod, where the files file1.m, file2.mat, myfolder/file3.txt in the project directory are needed by, e.g., the steady state file:
dynare mymodel parallel local_files=(file1.m)
this would trigger the following entry in options_.parallel_info:
options_.parallel_info.local_files = {'', 'file1.m'};
where the empty element indicates that the file is in the project directory and not in a subdirectory.
Another example:
dynare mymodel parallel local_files=(file1.m, file2.mat, myfolder/file3.txt)
this would trigger the following entry in options_.parallel_info (we need to parse and separate the subfolder from the name of the file)
options_.parallel_info.local_files = {
'', 'file1.m';
'', 'file2.mat';
'myfolder/', 'file3.txt'
};
3) use the option local_files inside, e.g., the estimation command:
estimation(datafile=mydata,mode_compute=0, ..., local_files=(file1.m, file2.mat, myfolder/file3.txt))
which would trigger in the same way the entry in options_.parallel_info.local_files
Which option would be best for you?
4.4Marco RattoMarco Ratto