Skip to content
This repository has been archived by the owner. It is now read-only.

Fix selected_variables_only option #1161

Closed
JohannesPfeifer opened this issue Apr 10, 2016 · 7 comments

Comments

Projects
None yet
2 participants
@JohannesPfeifer
Copy link
Contributor

commented Apr 10, 2016

In Dynare 4.4.3, we have in dynare_estimation_1

    for i=bayestopt_.smoother_saved_var_list'
        i1 = dr.order_var(bayestopt_.smoother_var_list(i));
        eval(['oo_.SmoothedVariables.' deblank(M_.endo_names(i1,:)) ' = ' ...
                            'atT(i,:)'';']);

But bayestopt_.smoother_saved_var_list only saves the index of the variable in bayestopt_.smoother_var_list, not in the decision rules themselves. Therefore, we have to select atT(bayestopt_.smoother_var_list(i),:) instead of atT(i,:) if bayestopt_.smoother_var_list is not equal to bayestopt_.smoother_saved_var_list, which happens with selected_variables_only
In master the same problem has been ported to write_smoother_results

@MichelJuillard @stepan-a Should we try to fix this or should we get rid of the selected_variables_only option?

JohannesPfeifer added a commit to JohannesPfeifer/dynare that referenced this issue Apr 10, 2016

Fix variable sorting in with ML without selected_variables_only, whic…
…h was erroneously in decision rule order

Also fixes wrong output when selected_variables_only was used (closes DynareTeam#1161)
@MichelJuillard

This comment has been minimized.

Copy link
Member

commented Apr 11, 2016

The ability of selecting variables is important for large models. We want to keep the feature and fix it

@JohannesPfeifer

This comment has been minimized.

Copy link
Contributor Author

commented Apr 11, 2016

@MichelJuillard But are large models ever estimated with ML? Regardless, I think I have fixed the issue in the above mentioned commit, but I still have to test it more.

@MichelJuillard

This comment has been minimized.

Copy link
Member

commented Apr 11, 2016

@JohannesPfeifer some parameters of a large model can be estimated, computing posterior mode and even posterior distribution with MH. SmoothedVariables and forecast are routinely computed for large calibrated models.

@JohannesPfeifer

This comment has been minimized.

Copy link
Contributor Author

commented Apr 11, 2016

@MichelJuillard Ok. I missed the calibrated smoother part. MH is not affected by the selected_variables_only option.

@MichelJuillard

This comment has been minimized.

Copy link
Member

commented Apr 11, 2016

Computing the posterior distribution of smoothed variables (and friends) can generate memory problems for large models. It is very important to be able to limit the number of variables for which we compute and store the smoothed values.

@JohannesPfeifer

This comment has been minimized.

Copy link
Contributor Author

commented Apr 11, 2016

@MichelJuillard To clarify. The manual says for selected_variables_only:

Only run the classical smoother on the variables listed just after the estimation
command. This option is incompatible with requesting classical frequentist forecasts
and will be overridden in this case. When using Bayesian estimation, the
smoother is by default only run on the declared endogenous variables.
@JohannesPfeifer

This comment has been minimized.

Copy link
Contributor Author

commented Apr 11, 2016

There seems to be a second bug. In DsgeSmoother, we select the observables via a matrix Z that relies on bayestopt_.mf = bayestopt_.smoother_mf
But bayestopt_.smoother_mf only stores the indices of the observed and requested variables within bayestopt_.smoother_var_list, not within the actual state vector. Thus, it should be
bayestopt_.mf = bayestopt_.smoother_var_list(bayestopt_.smoother_mf)
as otherwise the selected observables change when the selected_variables_only option is used

JohannesPfeifer added a commit to JohannesPfeifer/dynare that referenced this issue Apr 11, 2016

JohannesPfeifer added a commit to JohannesPfeifer/dynare that referenced this issue Apr 12, 2016

JohannesPfeifer added a commit to JohannesPfeifer/dynare that referenced this issue Apr 12, 2016

MichelJuillard added a commit to MichelJuillard/dynare that referenced this issue May 18, 2016

MichelJuillard added a commit to MichelJuillard/dynare that referenced this issue May 18, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.