dynare issueshttps://git.dynare.org/Dynare/dynare/-/issues2023-08-30T10:09:35Zhttps://git.dynare.org/Dynare/dynare/-/issues/1897Discuss the expected output of shock_decomposition2023-08-30T10:09:35ZJohannes PfeiferDiscuss the expected output of shock_decompositionThe `shock_decomposition`-command contains a call to `evaluate_smoother`, which will overwrite all previous computations from the smoother. My understanding is that this is unexpected behavior. See https://forum.dynare.org/t/oo-smoothedv...The `shock_decomposition`-command contains a call to `evaluate_smoother`, which will overwrite all previous computations from the smoother. My understanding is that this is unexpected behavior. See https://forum.dynare.org/t/oo-smoothedvariables-with-shock-decomposition/22883/3. @rattoma What do you think?https://git.dynare.org/Dynare/dynare/-/issues/1891stoch_simul: deal with zero variance2023-07-11T22:10:32ZWilli Mutschlerwilli@mutschler.eustoch_simul: deal with zero varianceWe add a very small number to the covariance matrix to compute irfs:
```matlab
SS(M_.exo_names_orig_ord,M_.exo_names_orig_ord)=M_.Sigma_e+1e-14*eye(M_.exo_nbr);
cs = transpose(chol(SS));
```
The reason: If a shock has 0 variance,...We add a very small number to the covariance matrix to compute irfs:
```matlab
SS(M_.exo_names_orig_ord,M_.exo_names_orig_ord)=M_.Sigma_e+1e-14*eye(M_.exo_nbr);
cs = transpose(chol(SS));
```
The reason: If a shock has 0 variance, the matrix isn't definite positive and chol() can't be computed. The small positive amount on the diagonal insure that the matrix is nevertheless positive definite in this case.
It would be better to add this epsilon only on zero diagonal elements, to avoid changing the covariance matrix in the usual case; and possibly also providing a warning or error.Johannes PfeiferJohannes Pfeiferhttps://git.dynare.org/Dynare/dynare/-/issues/1889Gracefully exit after problem in block_trust_region.mex2023-09-26T20:01:23ZJohannes PfeiferGracefully exit after problem in block_trust_region.mexThe attached file crashes Matlab on Windows, presumably due to a Lapack issue in `block_trust_region`.
[example.mod](/uploads/a41c52dff0aac34aeadf7901fa6aa0a7/example.mod)The attached file crashes Matlab on Windows, presumably due to a Lapack issue in `block_trust_region`.
[example.mod](/uploads/a41c52dff0aac34aeadf7901fa6aa0a7/example.mod)Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1887Allow for Windows paths in config.ini to contain space by placing quotes2023-06-01T08:29:26ZJohannes PfeiferAllow for Windows paths in config.ini to contain space by placing quotesSee https://forum.dynare.org/t/save-draws-from-multiple-chains-run-in-parallele/22183/10See https://forum.dynare.org/t/save-draws-from-multiple-chains-run-in-parallele/22183/10Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1886Model information routine2023-03-24T13:50:09ZUgo DuboisModel information routineThis function takes as input (< option >,< variable_name >).
Its ouput is a print in the command window with the expressions of all the equations < variable_name > enters in.
If < option > == 1, parameters names get replaced by their...This function takes as input (< option >,< variable_name >).
Its ouput is a print in the command window with the expressions of all the equations < variable_name > enters in.
If < option > == 1, parameters names get replaced by their values in the output. If < option > == 0, then the parameters names are left as names.Stéphane Adjemianstepan@adjemian.euStéphane Adjemianstepan@adjemian.eu2023-02-16https://git.dynare.org/Dynare/dynare/-/issues/1885load_results_after_load_mh results file not found2023-02-07T16:05:09ZWilliam Gattload_results_after_load_mh results file not foundI have an estimated model with `mh_replic=0`, and both `load_mh_file` and `load_results_after_load_mh` are switched on, but I get the following warning:
`dynare_estimation_init:: You specified the load_results_after_load_mh, but no _res...I have an estimated model with `mh_replic=0`, and both `load_mh_file` and `load_results_after_load_mh` are switched on, but I get the following warning:
`dynare_estimation_init:: You specified the load_results_after_load_mh, but no _results.mat-file`
`dynare_estimation_init:: was found. Results will be recomputed.`
If I navigate to _modfilename/Output/modfilename_results.mat_ and copy it to the main folder then it works. Is this intended behaviour or is Dynare not looking in the right path? Using v5.3.
Thanks,
Williamhttps://git.dynare.org/Dynare/dynare/-/issues/1884Investigate why det_cond_forecast does not distinguish between surprise and a...2024-02-29T12:53:15ZJohannes PfeiferInvestigate why det_cond_forecast does not distinguish between surprise and anticipated shocksSee [simulation_det_cond.mod](/uploads/f162f70fa8cd7a060919c6902e6ca1da/simulation_det_cond.mod)See [simulation_det_cond.mod](/uploads/f162f70fa8cd7a060919c6902e6ca1da/simulation_det_cond.mod)Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1883perfect_foresight_with_expectation_errors single shocks block performs wrong ...2023-01-28T20:25:39ZWilli Mutschlerwilli@mutschler.euperfect_foresight_with_expectation_errors single shocks block performs wrong size assignment if more than one shockI added another shock `y` to the baseline test mod file and have only one single shocks block for `x` with `learnt_in=2`:
```
var c k; varexo x y;
parameters alph gam delt bet aa;
alph=0.5; gam=0.5; delt=0.02; bet=0.05; aa=0.5;
model;
...I added another shock `y` to the baseline test mod file and have only one single shocks block for `x` with `learnt_in=2`:
```
var c k; varexo x y;
parameters alph gam delt bet aa;
alph=0.5; gam=0.5; delt=0.02; bet=0.05; aa=0.5;
model;
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1) +y;
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
y=0;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k;
end;
steady;
check;
shocks(learnt_in=2);
var x;
periods 2:3;
values 1.2;
end;
perfect_foresight_with_expectation_errors_setup(periods = 7);
perfect_foresight_with_expectation_errors_solver;
rplot c;
```
I get the following error:
```
Unable to perform assignment because the size of the left side is 2-by-7 and the size of the right side is 2-by-1.
Error in perfect_foresight_with_expectation_errors_setup (line 72)
oo_.pfwee.shocks_info(:, :, 1) = oo_.exo_steady_state;
```
So there is a bug here, because if I remove y, the simulation runs.Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1882misleading warning on missing shocks(learnt_in=1) block2023-01-20T10:17:01ZWilli Mutschlerwilli@mutschler.eumisleading warning on missing shocks(learnt_in=1) blockAccording to the manual `a shocks(learnt_in=1) block is equivalent to a regular shocks block`; however, if I use the below mod file, I get a warning `Warning: perfect_foresight_with_expectation_errors_setup: there is no shocks(learnt_in=...According to the manual `a shocks(learnt_in=1) block is equivalent to a regular shocks block`; however, if I use the below mod file, I get a warning `Warning: perfect_foresight_with_expectation_errors_setup: there is no shocks(learnt_in=...) or endval(learnt_in=...) block, and you did not pass the datafile option, so there is no point in using this command`.
I find the warning a bit unlucky in this case, even though indeed there is no point in using this command instead of the regular perfect_foresight ones.
```
var c k; varexo x;
parameters alph gam delt bet aa;
alph=0.5; gam=0.5; delt=0.02; bet=0.05; aa=0.5;
model;
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1));
c = aa*k^alph-delt*k;
end;
steady;
check;
shocks(learnt_in = 1);
var x;
periods 2:3;
values 1.2;
end;
perfect_foresight_with_expectation_errors_setup(periods = 7);
perfect_foresight_with_expectation_errors_solver;
rplot c;
```https://git.dynare.org/Dynare/dynare/-/issues/1881Problems with exogenous variables with a lead2022-12-28T08:11:55ZMichelJuillardProblems with exogenous variables with a leadIn `dynamic_set_auxiliary_series.m`, exogenous variables with lead are set at the wrong period.
If `A` is an exogenous variable and appears as `A(+1)` in the model, `dynamic_set_auxiliary_series.m` contains the following line:
```
ds.AUX...In `dynamic_set_auxiliary_series.m`, exogenous variables with lead are set at the wrong period.
If `A` is an exogenous variable and appears as `A(+1)` in the model, `dynamic_set_auxiliary_series.m` contains the following line:
```
ds.AUX_EXO_LEAD_18=ds.A;
```
when it should be
```
ds.AUX_EXO_LEAD_18=lag(ds.A, -1);
```
However, this solution raises another issue as `lag(ds.A, -1)` is unknown at the time of evaluation of `dynamic_set_auxiliary_series` in `driver.m`.
`M_.histval_endo` should be initialized with `M_.orig_maximum_lag_with_diffs_expanded + M_.orig_maximum_lead`, initialized with the steady state of endogenous, exogenous and exogenous_det variables, and the shocks.
This can be investigated with [neoclassical1.mod](/uploads/1b0ad089ff78d77a54fdf454470e2e93/neoclassical1.mod)
The timing used in row 33 of `+neoclassical1/dynamic_resid.m` looks suspicious as well, I believe that one should use the row `it_+1` rather than `it_`https://git.dynare.org/Dynare/dynare/-/issues/1879Fix error handling in PKF smoother2023-02-07T14:23:56ZJohannes PfeiferFix error handling in PKF smootherProblems in solving will crash Dynare:
[extract_smoothed.mod](/uploads/c48ed387f69907ac2f5ca5eaba1a8182/extract_smoothed.mod)
[data_final2.xlsx](/uploads/65048686824c779ec84cd3bb3ce5b9a5/data_final2.xlsx)Problems in solving will crash Dynare:
[extract_smoothed.mod](/uploads/c48ed387f69907ac2f5ca5eaba1a8182/extract_smoothed.mod)
[data_final2.xlsx](/uploads/65048686824c779ec84cd3bb3ce5b9a5/data_final2.xlsx)https://git.dynare.org/Dynare/dynare/-/issues/1878X-13ARIMA-SEATS routines can crash depending on the current directory2023-09-06T10:53:18ZPierre AldamaX-13ARIMA-SEATS routines can crash depending on the current directoryWhile working on building our dataset (in our case, for seasonal adjustment), we observed that X-13ARIMA-SEATS routines can crash when the current directory is different from the path of the Matlab script where we call the X13 routines. ...While working on building our dataset (in our case, for seasonal adjustment), we observed that X-13ARIMA-SEATS routines can crash when the current directory is different from the path of the Matlab script where we call the X13 routines. This behavior seems to be eratic: it occurs while we loop over a loop of variables and it does not always crash on the same variable.
In the attached example, I replicate this crash with random data on which I want to do seasonal adjustment. I loop over an arbitrary number of variables (N=30). To trigger the crash, one needs to change the current directory of Matlab to any subfolder.
```
%% Create a subfodler
mkdir SomeFolder
addpath('./SomeFolder')
%% To trigger the bug set bug = true
bug = true ;
if bug
cd('./SomeFolder')
else
cd(cwd)
end
```
In this case, the loop will eventually stop. Sometimes, it can stop for the first variable, sometimes it can iterate until a higher number of variable, for a reason we cannot explain.
```
Variable 7
ans is a dseries object:
| d11
1999Q1 | 0.39353
1999Q2 | 0.91905
1999Q3 | 0.6416
1999Q4 | 0.721
2000Q1 | 0.92627
2000Q2 | 0.42445
2000Q3 | 0.51803
2000Q4 | 0.3232
2001Q1 | 0.32554
2001Q2 | 0.3497
|
2021Q2 | 1.1398
2021Q3 | 0.5587
2021Q4 | 0.23827
2022Q1 | 0.53768
2022Q2 | 0.46911
2022Q3 | 0.77198
2022Q4 | 0.35521
2023Q1 | 0.4205
2023Q2 | 0.61482
2023Q3 | 0.21813
2023Q4 | 1.1208
Variable 8
Reference to non-existent field 'd11'.
Error in x13/subsref (line 88)
o = builtin('subsref', o.(S(1).subs), S(2));
Error in BugX13 (line 50)
o.results.d11
```
[BugX13.7z](/uploads/db69ed042bccb75ffc89e986c79dd8d2/BugX13.7z)Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1877Document Windows restrictions on passing quoted strings at command line2022-12-08T11:12:15ZJohannes PfeiferDocument Windows restrictions on passing quoted strings at command lineFor example, under Windows the invocation
```
dynare sw2007nw_dsge -Ddatafile_name='"data94q1.mat"'
```
is cut down to
```
Calling Dynare with arguments: -Ddatafile_name="data94q1.mat"
```
i.e. the second layer of quoted strings is lost....For example, under Windows the invocation
```
dynare sw2007nw_dsge -Ddatafile_name='"data94q1.mat"'
```
is cut down to
```
Calling Dynare with arguments: -Ddatafile_name="data94q1.mat"
```
i.e. the second layer of quoted strings is lost. The most robust workaround is to handle the strings at the mod-file level, e.g.
```
estimation(datafile='@{datafile_name}')
```
instead of trying to have the quote in the `datafile_name`.https://git.dynare.org/Dynare/dynare/-/issues/1875Cannot use algorithms 12 and 14 despite having specified json=compute option2022-12-15T15:21:01ZPierre AldamaCannot use algorithms 12 and 14 despite having specified json=compute optionWhen trying to solve a model under perfect foresight using algorithms 12 ou 14, Dynare requires the json output of the model. In the attached example, I try to simulate a backward-looking model with algorithm 14 and the json=compute opti...When trying to solve a model under perfect foresight using algorithms 12 ou 14, Dynare requires the json output of the model. In the attached example, I try to simulate a backward-looking model with algorithm 14 and the json=compute option is specified at the top of the mod file.
Dynare actually _produces json files_ but cannot apparently use them and returns an error :
```
Error using sim1_purely_backward (line 30)
Algorithms solve_algo={12,14} require json output of the model (use json=compute option)
```
If ones actually tries to read the json files by running :
```
jsonfile = fileread(sprintf('%s/model/json/modfile-original.json', M_.fname));
json = jsondecode(jsonfile);
```
it gets :
```
Error using jsondecode
JSON syntax error at line 33, column 72 (character 4353): expected value but found 'dates'.
```
The problems seems to be related to initval_file() :
```
{"statementName": "initval_file", "options": {"firstsimulationperiod": dates(database.lastobservedperiod+1), "lastsimulationperiod": dates(database.lastobservedperiod+len-1), "series": "database"}},
```
[BugJson.7z](/uploads/ba0c2578d0ee38ebd2dbab9126ef46a7/BugJson.7z)Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1872Implement conditional likelihood at order=12023-09-06T10:52:12ZJohannes PfeiferImplement conditional likelihood at order=1@stepan-a already has an implementation.@stepan-a already has an implementation.https://git.dynare.org/Dynare/dynare/-/issues/1866Fix or document interaction of steady_state_model-block and initval and endval2022-10-14T10:00:45ZJohannes PfeiferFix or document interaction of steady_state_model-block and initval and endval`make_y` translates the contents of `initval` and `endval` to `oo_.endo_simul`. The last block's contents are stored in `oo_.steady_state`. But if there is a `steady_state_model`-block or a `_steadystate`-file, we execute in `make_y`
```...`make_y` translates the contents of `initval` and `endval` to `oo_.endo_simul`. The last block's contents are stored in `oo_.steady_state`. But if there is a `steady_state_model`-block or a `_steadystate`-file, we execute in `make_y`
```
if options_.steadystate_flag
[oo_.steady_state,M_.params,~] = ...
evaluate_steady_state_file(oo_.steady_state,oo_.exo_steady_state,M_, ...
options_,~options_.steadystate.nocheck);
end
```
This part will overwrite the contents of the block by a computed steady state. This behavior has been in Dynare for at least 10 years, but is clearly wrong. @MichelJuillard @stepan-a Do you know what the purpose of that automatic call to the steady state file is?https://git.dynare.org/Dynare/dynare/-/issues/1865Fix x13 on Mac2022-11-16T17:06:56ZJohannes PfeiferFix x13 on MacA user at https://forum.dynare.org/t/x13-seasonal-adjustedment-does-not-work-on-mac/20898 reports an issue with compiling x13, which seems to be due to a conflicting GCC versions. The fix to
> Library not loaded: '/usr/local/opt/gcc/lib/...A user at https://forum.dynare.org/t/x13-seasonal-adjustedment-does-not-work-on-mac/20898 reports an issue with compiling x13, which seems to be due to a conflicting GCC versions. The fix to
> Library not loaded: '/usr/local/opt/gcc/lib/gcc/11/libgfortran.5.dylib'
is most likely to statically link `libgfortran`Sébastien VillemotSébastien Villemothttps://git.dynare.org/Dynare/dynare/-/issues/1863Filter out non-convergence in PKF2022-11-17T09:58:19ZJohannes PfeiferFilter out non-convergence in PKFUpon non-convergence, we seem to save the invalid results from the last iteration. See https://forum.dynare.org/t/occbin-estimation-bk-conditions-are-not-satisfied/20721/20Upon non-convergence, we seem to save the invalid results from the last iteration. See https://forum.dynare.org/t/occbin-estimation-bk-conditions-are-not-satisfied/20721/20https://git.dynare.org/Dynare/dynare/-/issues/1862PKF: fix smoother_redux with state_uncertainty2022-07-26T17:57:17ZJohannes PfeiferPKF: fix smoother_redux with state_uncertaintyIn this case, matrix dimensions are not conformable: [NKM.mod](/uploads/f8e167b20fac119e10c371c249a5e18a/NKM.mod)In this case, matrix dimensions are not conformable: [NKM.mod](/uploads/f8e167b20fac119e10c371c249a5e18a/NKM.mod)https://git.dynare.org/Dynare/dynare/-/issues/1861Occbin: correctly set options_.nk2022-08-03T11:59:14ZJohannes PfeiferOccbin: correctly set options_.nkSee the report at https://forum.dynare.org/t/occbin-smoother-fails-after-successful-estimation/20789 which reports a crash with
```
Unable to perform assignment because the size of the left side is 0-by-17-by-0 and the size of the right ...See the report at https://forum.dynare.org/t/occbin-smoother-fails-after-successful-estimation/20789 which reports a crash with
```
Unable to perform assignment because the size of the left side is 0-by-17-by-0 and the size of the right side is 1-by-17-by-2.
Error in DsgeSmoother (line 455)
aaa(:,oo_.dr.restrict_var_list,:)=aK;
Error in occbin.DSGE_smoother (line 120)
[alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK,T0,R0,P,PK,decomp,Trend,state_uncertainty,M_,oo_,bayestopt_] = DsgeSmoother(xparam1,gend,Y,data_index,missing_value,M_,oo_,options_,bayestopt_,estim_params_,occbin_options);%
T1=TT;
```
and elaborates
> UPDATE: Part of the issue is that “options_.nk” is unset and is empty, for some reason. Manually setting options_.nk = 1 before running the smoother helps. However, there is still an error because the dimensions of aK are completely wrong - aK is of size (1, 17, 2), when it is expected to be (1, 17, 69) (as I have 68 observations).
>
> UPDATE 2: setting nk>1 fixes the problem. For example, setting nk=2 leads to aK have the dimensions 2 17 70. This seems to be caused by line 436 in “missing_DiffuseKalmanSmootherH3_Z.m”, which generates Occbin output only if nk> 1 (and otherwise does not invoke Occbin correctly).