From 31f6831b0906268a47f9d7e126773f7001ba8d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 29 May 2012 16:25:52 +0200 Subject: [PATCH] Improve doc and error handling for shock_decomposition on calibrated model --- doc/dynare.texi | 19 ++++++++++++++----- matlab/evaluate_smoother.m | 3 +++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/doc/dynare.texi b/doc/dynare.texi index a921de8b8..81adc9e76 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -4437,6 +4437,10 @@ over @code{alt_model}. This command computes and displays shock decomposition according to the model for a given sample. +Note that this command must come after either @code{estimation} (in case +of an estimated model) or @code{stoch_simul} (in case of a calibrated +model). + @optionshead @table @code @@ -4444,16 +4448,21 @@ the model for a given sample. @item parameter_set = @var{PARAMETER_SET} Specify the parameter set to use for running the smoother. The @var{PARAMETER_SET} can take one of the following five values: -@code{prior_mode}, @code{prior_mean}, @code{posterior_mode}, -@code{posterior_mean}, @code{posterior_median}. Default value: -@code{posterior_mean} if Metropolis has been run, else -@code{posterior_mode}. +@code{calibration}, @code{prior_mode}, @code{prior_mean}, +@code{posterior_mode}, @code{posterior_mean}, +@code{posterior_median}. Default value: @code{posterior_mean} if +Metropolis has been run, else @code{posterior_mode}. @item shocks = (@var{VARIABLE_NAME} [@var{VARIABLE_NAME} @dots{}] [ ; @var{VARIABLE_NAME} [@var{VARIABLE_NAME} @dots{}] @dots{}] ) @dots{} @item labels = ( @var{VARIABLE_NAME} [@var{VARIABLE_NAME} @dots{}] ) @dots{} + +@item datafile = @var{FILENAME} +@xref{datafile}. Useful when computing the shock decomposition on a +calibrated model. + @end table @end deffn @@ -5514,7 +5523,7 @@ If equal to @code{2}, triggers gsa Monte-Carlo sample (@i{i.e.} loads a sample c @item gsa_sample_file = @var{FILENAME} Uses the provided path to a specific user defined sample file. Default: @code{0} -@item parameter_set = @code{prior_mode} | @code{prior_mean} | @code{posterior_mode} | @code{posterior_mean} | @code{posterior_median} +@item parameter_set = @code{calibration} | @code{prior_mode} | @code{prior_mean} | @code{posterior_mode} | @code{posterior_mean} | @code{posterior_median} Specify the parameter set to use. Default: @code{prior_mean} @item lik_init = @var{INTEGER} diff --git a/matlab/evaluate_smoother.m b/matlab/evaluate_smoother.m index 3b345a509..5344cf834 100644 --- a/matlab/evaluate_smoother.m +++ b/matlab/evaluate_smoother.m @@ -63,6 +63,9 @@ if ischar(parameters) case 'prior_mean' parameters = bayestopt_.p1; case 'calibration' + if isempty(oo_.dr) + error('You must run ''stoch_simul'' first.'); + end parameters = []; otherwise disp('evaluate_smoother:: If the input argument is a string, then it has to be equal to:')