dynare issueshttps://git.dynare.org/Dynare/dynare/issues2019-06-19T15:38:08Zhttps://git.dynare.org/Dynare/dynare/issues/655Fix unconditional_forecast values derived from conditional_forecast command2019-06-19T15:38:08ZJohannes Pfeifer Fix unconditional_forecast values derived from conditional_forecast commandThe `unconditional_forecast`-command seems to produce incorrect forecasts when used together with `initval`. This can be seen in the following mod-file where it yields different results than the `forecast`-command (which appear sensible).
```
// See fs2000.mod in the examples/ directory for details on the model
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;
stoch_simul(irf=0);
conditional_forecast_paths;
var gy_obs;
periods 1 2 3:5;
values 0.01 -0.02 0;
var gp_obs;
periods 1:5;
values 0.05;
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;
conditional_forecast(parameter_set=calibration, controlled_varexo=(e_a,e_m));
plot_conditional_forecast(periods=10) gy_obs gp_obs;
forecast(periods=40);
```
The problem seems to come from lines 139-143 of `imcforecast` where the initial values are supposed to be translated into deviations from steady state:
```
else
InitState(:,1) = zeros(M_.endo_nbr,1);
trend = repmat(oo_.steady_state(oo_.dr.order_var),1,options_cond_fcst.periods+1);
graph_title='Calibration';
end
```
However, the initial state is always 0, regardless of the initial values given in initval. Rather the initial values appear in `trend` and are later added to the forecasts. As a result, if started outside of steady state, there is no tendency of forecasts to return to steady state. This is exactly what can be seen in the flat forecasts in `forecasts.uncond.Mean` in the above mod-file. In contrast, the `forecast`-command yields the correct return to steady state.
My reading is that the problem also affects the conditional forecasts.
See also http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5617
The `unconditional_forecast`-command seems to produce incorrect forecasts when used together with `initval`. This can be seen in the following mod-file where it yields different results than the `forecast`-command (which appear sensible).
```
// See fs2000.mod in the examples/ directory for details on the model
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;
stoch_simul(irf=0);
conditional_forecast_paths;
var gy_obs;
periods 1 2 3:5;
values 0.01 -0.02 0;
var gp_obs;
periods 1:5;
values 0.05;
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;
conditional_forecast(parameter_set=calibration, controlled_varexo=(e_a,e_m));
plot_conditional_forecast(periods=10) gy_obs gp_obs;
forecast(periods=40);
```
The problem seems to come from lines 139-143 of `imcforecast` where the initial values are supposed to be translated into deviations from steady state:
```
else
InitState(:,1) = zeros(M_.endo_nbr,1);
trend = repmat(oo_.steady_state(oo_.dr.order_var),1,options_cond_fcst.periods+1);
graph_title='Calibration';
end
```
However, the initial state is always 0, regardless of the initial values given in initval. Rather the initial values appear in `trend` and are later added to the forecasts. As a result, if started outside of steady state, there is no tendency of forecasts to return to steady state. This is exactly what can be seen in the flat forecasts in `forecasts.uncond.Mean` in the above mod-file. In contrast, the `forecast`-command yields the correct return to steady state.
My reading is that the problem also affects the conditional forecasts.
See also http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5617
4.5https://git.dynare.org/Dynare/dynare/issues/656reporting example in manual2019-06-19T15:38:08ZMichelJuillardreporting example in manualThe example under reporting in the manual is not current. Option 'color' is now graphLineColor and the color code must be spelled out
The example under reporting in the manual is not current. Option 'color' is now graphLineColor and the color code must be spelled out
4.5Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/issues/658Restore backward compatibility of mode_file-option2019-06-19T15:38:08ZJohannes Pfeifer Restore backward compatibility of mode_file-optionLine 202 of `dynare_estimation_init.m` reads:
`if isequal(mode_file.parameter_names, bayestopt_.name)`
But it seems that `mode_file.parameter_names` was not set in previous versions of Dynare, leading to crashes and missing backward compatibility. It seems that an additional check whether this field exists is required.
Line 202 of `dynare_estimation_init.m` reads:
`if isequal(mode_file.parameter_names, bayestopt_.name)`
But it seems that `mode_file.parameter_names` was not set in previous versions of Dynare, leading to crashes and missing backward compatibility. It seems that an additional check whether this field exists is required.
https://git.dynare.org/Dynare/dynare/issues/657produce & print original model (without auxiliary variable substitutions)2019-06-19T15:38:08ZHoutan Bastaniproduce & print original model (without auxiliary variable substitutions)For inclusion in reports (or just general interest), produce the original model and be able to print it in latex.
Add option to include calibrated values in parentheses next to variables in the report.
For inclusion in reports (or just general interest), produce the original model and be able to print it in latex.
Add option to include calibrated values in parentheses next to variables in the report.
4.5Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/issues/662Update and fix gsa/set_shocks_param.m2019-06-19T15:38:08ZJohannes Pfeifer Update and fix gsa/set_shocks_param.mApart from an obvious typo (`Sigma_e_` instead `Sigma_e`) it seems as if that file is still missing the update to reflect calibrated covariances (#511).
Apart from an obvious typo (`Sigma_e_` instead `Sigma_e`) it seems as if that file is still missing the update to reflect calibrated covariances (#511).
4.5Marco RattoMarco Rattohttps://git.dynare.org/Dynare/dynare/issues/664Identification and var_exo_det2019-06-19T15:38:08ZJohannes Pfeifer Identification and var_exo_detBoth are not compatible because in calls to the dynamic file the components of `oo_.exo_det_steady_state` neglect x.
Either filter out those cases or make them compatible.
Both are not compatible because in calls to the dynamic file the components of `oo_.exo_det_steady_state` neglect x.
Either filter out those cases or make them compatible.
4.5Marco RattoMarco Rattohttps://git.dynare.org/Dynare/dynare/issues/665support looser syntax for creating dates2019-06-19T15:38:08ZHoutan Bastanisupport looser syntax for creating datesRight now, the following syntax works:
`dates(4, [1990; 1991], [1; 2]);`
but
`dates(4, [1990 1991], [1 2]);`
doesn't. What is important is that the arrays passed be vectors, not that they be column vectors or row vectors. We should ease the syntax to accept both, just checking that they are indeed vectors.
Right now, the following syntax works:
`dates(4, [1990; 1991], [1; 2]);`
but
`dates(4, [1990 1991], [1 2]);`
doesn't. What is important is that the arrays passed be vectors, not that they be column vectors or row vectors. We should ease the syntax to accept both, just checking that they are indeed vectors.
4.5Stéphane Adjemianstepan@dynare.orgStéphane Adjemianstepan@dynare.orghttps://git.dynare.org/Dynare/dynare/issues/667rename hessian.m in dyn_hessian.m2019-06-19T15:38:08ZMichelJuillardrename hessian.m in dyn_hessian.mIn order to avoid name collision with other Matlab program/toolboxe
In order to avoid name collision with other Matlab program/toolboxe
4.5https://git.dynare.org/Dynare/dynare/issues/669fullpage LaTeX package causes compilation to break on Windows (is output by w...2019-06-19T15:38:08ZHoutan Bastanifullpage LaTeX package causes compilation to break on Windows (is output by write_latex_dynamic_model)Try to repeat error and find a work around if indeed it is not distributed with MikTex
Try to repeat error and find a work around if indeed it is not distributed with MikTex
4.5Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/issues/670Fix handling of prefiltering and trends in non_linear_dsge_likelihood2019-06-19T15:38:08ZJohannes Pfeifer Fix handling of prefiltering and trends in non_linear_dsge_likelihood`non_linear_dsge_likelihood` uses
`Y = transpose(DynareDataset.rawdata);`
By accessing `rawdata` instead of data, prefiltering is ignored. Moreover, deterministic trends are not subtracted. I am not sure this is on purpose.
`non_linear_dsge_likelihood` uses
`Y = transpose(DynareDataset.rawdata);`
By accessing `rawdata` instead of data, prefiltering is ignored. Moreover, deterministic trends are not subtracted. I am not sure this is on purpose.
4.5https://git.dynare.org/Dynare/dynare/issues/671misc changes to dates/dseries2019-06-19T15:38:08ZHoutan Bastanimisc changes to dates/dseries- dates: rename `time` field to something more descriptive. Perhaps `data`
- dates: remove `ndat` field. Should have method that provides this information instead
- dseries: remove `nobs` field. Should have method that provides this information instead
- dseries: remove `vobs` field. Should have method that provides this information instead
- dates: rename `time` field to something more descriptive. Perhaps `data`
- dates: remove `ndat` field. Should have method that provides this information instead
- dseries: remove `nobs` field. Should have method that provides this information instead
- dseries: remove `vobs` field. Should have method that provides this information instead
4.5Stéphane Adjemianstepan@dynare.orgStéphane Adjemianstepan@dynare.orghttps://git.dynare.org/Dynare/dynare/issues/672Use pgfplotstable for report tables instead of latex tables2019-06-19T15:38:08ZHoutan BastaniUse pgfplotstable for report tables instead of latex tablesBefore making the change, ensure it's distributed in MikTex
http://pgfplots.sourceforge.net/pgfplotstable.pdf
Before making the change, ensure it's distributed in MikTex
http://pgfplots.sourceforge.net/pgfplotstable.pdf
4.5Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/issues/673when creating a report with only one table, tmpRepDir is not created and it c...2019-06-19T15:38:08ZHoutan Bastaniwhen creating a report with only one table, tmpRepDir is not created and it crashesSee Eleonora's email from 18h30 27/6/2014
See Eleonora's email from 18h30 27/6/2014
4.5Houtan BastaniHoutan Bastanihttps://git.dynare.org/Dynare/dynare/issues/675Fix bug in dsge_likelihood related to analytic_derivation2019-06-19T15:38:08ZJohannes Pfeifer Fix bug in dsge_likelihood related to analytic_derivationSee http://www.dynare.org/pipermail/dev/2014-May/003793.html
See http://www.dynare.org/pipermail/dev/2014-May/003793.html
4.5Marco RattoMarco Rattohttps://git.dynare.org/Dynare/dynare/issues/677Deal with treatment of unit roots in identification2019-06-19T15:38:08ZJohannes Pfeifer Deal with treatment of unit roots in identification```
var y delta_y x z;
varexo eps_x eps_z;
parameters rho sigma_z sigma_x;
// set parameter values
sigma_z=0.001;
sigma_x=0.01;
rho=0.9;
model;
z=rho*z(-1)+sigma_z*eps_z;
x=x(-1)+sigma_x*eps_x;
y=x+z;
delta_y=y-y(-1);
end;
steady_state_model;
x=0;
z=0;
y=0;
delta_y=0;
end;
//set shock variances
shocks;
var eps_z=1;
var eps_x=1;
end;
steady;
check;
varobs y delta_y;
stoch_simul(order=1,irf=0);
estimated_params;
rho, 0.9;
sigma_z, 0.01;
sigma_x, 0.01;
end;
options_.diffuse_filter=1;
identification(lik_init=3,advanced=1);
```
The treatment of unit roots seems unsatisfactory.
First, one needs to specify
`options_.diffuse_filter=1;`
because `options_` used in `dynare_estimation_init` does not inherit the `lik_init` from the `identification` command (used only in `options_ident`) and also does not accept `diffuse_filter`.
Second, some graphs are empty. My guess is because some unconditional moments are infinite.
```
var y delta_y x z;
varexo eps_x eps_z;
parameters rho sigma_z sigma_x;
// set parameter values
sigma_z=0.001;
sigma_x=0.01;
rho=0.9;
model;
z=rho*z(-1)+sigma_z*eps_z;
x=x(-1)+sigma_x*eps_x;
y=x+z;
delta_y=y-y(-1);
end;
steady_state_model;
x=0;
z=0;
y=0;
delta_y=0;
end;
//set shock variances
shocks;
var eps_z=1;
var eps_x=1;
end;
steady;
check;
varobs y delta_y;
stoch_simul(order=1,irf=0);
estimated_params;
rho, 0.9;
sigma_z, 0.01;
sigma_x, 0.01;
end;
options_.diffuse_filter=1;
identification(lik_init=3,advanced=1);
```
The treatment of unit roots seems unsatisfactory.
First, one needs to specify
`options_.diffuse_filter=1;`
because `options_` used in `dynare_estimation_init` does not inherit the `lik_init` from the `identification` command (used only in `options_ident`) and also does not accept `diffuse_filter`.
Second, some graphs are empty. My guess is because some unconditional moments are infinite.
4.5Marco RattoMarco Rattohttps://git.dynare.org/Dynare/dynare/issues/676Fix compatibility of sensitivity and ML estimation2019-06-19T15:38:08ZJohannes Pfeifer Fix compatibility of sensitivity and ML estimationSee http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5681
Email to Marco:
```
There is an obvious bug in set_shocks_param.m. Sigma_e_ should be just Sigma_e. But there seems to be more. In stab_map_.m in
if pprior,
for j=1:nshock,
if opt_gsa.morris~=1,
lpmat0(:,j) = randperm(Nsam)'./(Nsam+1); %latin hypercube
end
if opt_gsa.prior_range
lpmat0(:,j)=lpmat0(:,j).*(bayestopt_.ub(j)-bayestopt_.lb(j))+bayestopt_.lb(j);
end
end
bayestopt_.ub and lb are accessed and they are Inf. lpmat0 then has a bunch of NaNs that should not be there. This seems to be due to ML estimation and should probably be filtered out.
```
See http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5681
Email to Marco:
```
There is an obvious bug in set_shocks_param.m. Sigma_e_ should be just Sigma_e. But there seems to be more. In stab_map_.m in
if pprior,
for j=1:nshock,
if opt_gsa.morris~=1,
lpmat0(:,j) = randperm(Nsam)'./(Nsam+1); %latin hypercube
end
if opt_gsa.prior_range
lpmat0(:,j)=lpmat0(:,j).*(bayestopt_.ub(j)-bayestopt_.lb(j))+bayestopt_.lb(j);
end
end
bayestopt_.ub and lb are accessed and they are Inf. lpmat0 then has a bunch of NaNs that should not be there. This seems to be due to ML estimation and should probably be filtered out.
```
4.5Marco RattoMarco Rattohttps://git.dynare.org/Dynare/dynare/issues/678Use of the derivative of an external function directly in the model crashes t...2019-06-19T15:38:08ZJohannes Pfeifer Use of the derivative of an external function directly in the model crashes the preprocessorSee email to @sebastien-villemot on June 9th, 2014
See email to @sebastien-villemot on June 9th, 2014
4.5Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/issues/680Clarify license of LMMCP2019-06-19T15:38:08ZSébastien VillemotClarify license of LMMCPThe license of `matlab/lmmcp/lmmcp.m` and `matlab/lmmcp/catstruct.m` is unclear.
Once clarified, it should be documented in `license.txt`.
The license of `matlab/lmmcp/lmmcp.m` and `matlab/lmmcp/catstruct.m` is unclear.
Once clarified, it should be documented in `license.txt`.
4.5MichelJuillardMichelJuillardhttps://git.dynare.org/Dynare/dynare/issues/681Improve model_comparison2019-06-19T15:38:06ZJohannes Pfeifer Improve model_comparison1. Currently, the default for the prior odds if not specified is a probability of 1 for all models, which is improper. We should change this to 1/Number of models to be compared. The default should also be more clearly documented in the manual
2. Model_comparison should provide a warning when only ML was used. The manual should also clarify that this is only possible with Bayesian estimation
3. We might want to allow for likelihood ratio tests for nested models in case of ML
1. Currently, the default for the prior odds if not specified is a probability of 1 for all models, which is improper. We should change this to 1/Number of models to be compared. The default should also be more clearly documented in the manual
2. Model_comparison should provide a warning when only ML was used. The manual should also clarify that this is only possible with Bayesian estimation
3. We might want to allow for likelihood ratio tests for nested models in case of ML
https://git.dynare.org/Dynare/dynare/issues/679Fix various bugs related to detrending and prefiltering2019-06-19T15:38:06ZJohannes Pfeifer Fix various bugs related to detrending and prefiltering- `dyn_forecast` adds unlogged steady state if `loglinear` is used
- `dynare_estimation_init` sets the `noconstant` based on the unlogged steady state if `loglinear` is used
- when trends are specified as a function of deep parameters, the values are not correctly updated during estimation due to using the base-workspace parameter values and not the updated local ones
- when using trends with the `prefilter` option, the mean shift due to the trend is not accounted for
- when using `first_obs>1`, the higher trend starting point is not taken into account (leads also to problems in recursive forecasting)
- `dyn_forecast` adds unlogged steady state if `loglinear` is used
- `dynare_estimation_init` sets the `noconstant` based on the unlogged steady state if `loglinear` is used
- when trends are specified as a function of deep parameters, the values are not correctly updated during estimation due to using the base-workspace parameter values and not the updated local ones
- when using trends with the `prefilter` option, the mean shift due to the trend is not accounted for
- when using `first_obs>1`, the higher trend starting point is not taken into account (leads also to problems in recursive forecasting)
4.5Johannes Pfeifer Johannes Pfeifer