From 4d0854c265ddfef7afc8eb0a5f1171c178ee1e81 Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Tue, 7 May 2019 15:02:48 +0200 Subject: [PATCH] add forecast starting point --- src/+gui_tabs/create_endo_vars.m | 18 ++++++++++++------ src/gui_forecast.m | 3 +++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/+gui_tabs/create_endo_vars.m b/src/+gui_tabs/create_endo_vars.m index 45a8c70..1c77eb8 100644 --- a/src/+gui_tabs/create_endo_vars.m +++ b/src/+gui_tabs/create_endo_vars.m @@ -45,6 +45,8 @@ switch command column_names = {'Active', 'Name', 'Initial Condition'}; case 'calib_smoother' column_names = {'Active', 'Name', 'Long Name'}; + case 'forecast' + column_names = {'Active', 'Name', 'Initial Condition', 'New Value'}; end editable = true(1, size(column_names, 2)); editable(2) = false; @@ -52,17 +54,21 @@ data = cell(nvars, size(column_names, 2)); data(:, 1) = {false}; data(:, 2) = model_settings.variables(varidxs, 1); -if strcmp(command, 'perfect_foresight') || strcmp(command, 'stoch_simul') +if strcmp(command, 'stoch_simul') || strcmp(command, 'forecast') data(:, 3) = num2cell(oo_.steady_state(varidxs)); -elseif strcmp(command, 'calib_smoother') - data(:, 3) = model_settings.variables(varidxs, 3); - editable(3) = false; -end -if strcmp(command, 'perfect_foresight') + if strcmp(command, 'forecast') + data(:, 4) = num2cell(oo_.steady_state(varidxs)); + editable(3) = false; + editable(4) = true; + end +elseif strcmp(command, 'perfect_foresight') if ~isempty(ys0_) data(:, 3) = num2cell(ys0_(varidxs)); end data(:, 4) = num2cell(oo_.steady_state(varidxs)); +elseif strcmp(command, 'calib_smoother') + data(:, 3) = model_settings.variables(varidxs, 3); + editable(3) = false; end tabTitle = 'All'; % fix this later if we still want to support it diff --git a/src/gui_forecast.m b/src/gui_forecast.m index cf1df88..3027658 100644 --- a/src/gui_forecast.m +++ b/src/gui_forecast.m @@ -104,6 +104,9 @@ handles.pushbuttonForecast = uicontrol( ... options_.nodisplay = 0; options_.periods = str2double(handles.periods.String); + M_.endo_histval = [handles.endoTable.Data{:,4}]'; + M_.exo_histval = zeros(size(M_.exo_names)); + oo_.forecast = dyn_forecast(model_settings.varlist_.forecast, M_, options_, oo_, 'simul'); jObj.stop; -- GitLab