diff --git a/doc/manual/source/the-model-file.rst b/doc/manual/source/the-model-file.rst index f3737726cd3297f9c36b4ae342151ee8c9ba9d7b..d3a4e308f5c0a9645464e08e9a35357e56f9d6e9 100644 --- a/doc/manual/source/the-model-file.rst +++ b/doc/manual/source/the-model-file.rst @@ -7686,9 +7686,7 @@ the :comm:`bvar_forecast` command. *Output* - The results are not stored in the ``oo_`` structure but in a - separate structure ``forecasts``, described below, saved to the - hard disk into a file called ``conditional_forecasts.mat.`` + The results are stored in ``oo_.conditional_forecast``, which is described below. *Example* @@ -7713,7 +7711,7 @@ the :comm:`bvar_forecast` command. plot_conditional_forecast(periods = 10) a y; - .. matvar:: forecasts.cond + .. matvar:: oo_.conditional_forecast.cond Variable set by the ``conditional_forecast`` command. It stores the conditional forecasts. Fields are ``periods+1`` by @@ -7721,7 +7719,7 @@ the :comm:`bvar_forecast` command. subsequent ``periods`` forecasts periods. Fields are of the form:: - forecasts.cond.FORECAST_MOMENT.VARIABLE_NAME + oo_.conditional_forecast.cond.FORECAST_MOMENT.VARIABLE_NAME where FORECAST_MOMENT is one of the following: @@ -7735,28 +7733,28 @@ the :comm:`bvar_forecast` command. distribution. The size corresponds to ``conf_sig``. - .. matvar:: forecasts.uncond + .. matvar:: oo_.conditional_forecast.uncond Variable set by the ``conditional_forecast`` command. It stores the unconditional forecasts. Fields are of the form:: - forecasts.uncond.FORECAST_MOMENT.VARIABLE_NAME + oo_.conditional_forecast.uncond.FORECAST_MOMENT.VARIABLE_NAME - .. matvar:: forecasts.instruments + .. matvar:: oo_.conditional_forecast.instruments Variable set by the ``conditional_forecast command``. Stores the names of the exogenous instruments. - .. matvar:: forecasts.controlled_variables + .. matvar:: oo_.conditional_forecast.controlled_variables Variable set by the ``conditional_forecast`` command. Stores the position of the constrained endogenous variables in declaration order. - .. matvar:: forecasts.controlled_exo_variables + .. matvar:: oo_.conditional_forecast.controlled_exo_variables Variable set by the ``conditional_forecast`` command. Stores the values of the controlled exogenous variables underlying @@ -7764,9 +7762,9 @@ the :comm:`bvar_forecast` command. endogenous variables. Fields are ``[number of constrained periods]`` by ``1`` vectors and are of the form:: - forecasts.controlled_exo_variables.FORECAST_MOMENT.SHOCK_NAME + oo_.conditional_forecast.controlled_exo_variables.FORECAST_MOMENT.SHOCK_NAME - .. matvar:: forecasts.graphs + .. matvar:: oo_.conditional_forecast.graphs Variable set by the ``conditional_forecast`` command. Stores the information for generating the conditional forecast plots. diff --git a/matlab/imcforecast.m b/matlab/imcforecast.m index 935c453a56bf26b9447aef3ef04223131a972643..669457bba298e98bb80d148d2879afdb5e160a76 100644 --- a/matlab/imcforecast.m +++ b/matlab/imcforecast.m @@ -25,10 +25,10 @@ function imcforecast(constrained_paths, constrained_vars, options_cond_fcst) % This routine has to be called after an estimation statement or an estimated_params block. % % REMARKS -% [1] Results are stored in a structure which is saved in a mat file called conditional_forecasts.mat. +% [1] Results are stored in oo_.conditional_forecast. % [2] Use the function plot_icforecast to plot the results. -% Copyright (C) 2006-2018 Dynare Team +% Copyright (C) 2006-2019 Dynare Team % % This file is part of Dynare. % @@ -310,5 +310,4 @@ forecasts.graph.fname = M_.fname; %reset qz_criterium options_.qz_criterium=qz_criterium_old; - -save('conditional_forecasts.mat','forecasts'); +oo_.conditional_forecast = forecasts; \ No newline at end of file diff --git a/matlab/plot_icforecast.m b/matlab/plot_icforecast.m index 862a101cd0c7da62f38f1deace7c4447b67b875e..b2388498c57d89f7bb611ea89b5a1ebac52f860b 100644 --- a/matlab/plot_icforecast.m +++ b/matlab/plot_icforecast.m @@ -2,7 +2,9 @@ function plot_icforecast(Variables,periods,options_) % Build plots for the conditional forecasts. % % INPUTS -% o Variables [cell] names of the endogenous variables to be plotted. +% o Variables [cell] Names of the endogenous variables to be plotted. +% o periods [int] Number of periods to be plotted. +% o options_ [structure] Options. % % OUTPUTS % None. @@ -10,7 +12,7 @@ function plot_icforecast(Variables,periods,options_) % SPECIAL REQUIREMENTS % This routine has to be called after imcforecast.m. -% Copyright (C) 2006-2018 Dynare Team +% Copyright (C) 2006-2019 Dynare Team % % This file is part of Dynare. % @@ -26,8 +28,13 @@ function plot_icforecast(Variables,periods,options_) % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. +global oo_ -load conditional_forecasts; +if ~isfield(oo_, 'conditional_forecast') + error('Can''t find conditional forecasts'); +else + forecasts = oo_.conditional_forecast; +end forecast_periods = length(forecasts.cond.Mean.(Variables{1})); if nargin==1 || isempty(periods) % Set default number of periods.