From 3853604e852d9863c0139e07995d79596b857595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3ra=20Kocsis?= <dora@dynare.org> Date: Tue, 10 Mar 2020 17:12:38 +0100 Subject: [PATCH] add missing options to calib. smoother, closes Dynare/matlab-gui#12 --- src/gui_calib_smoother.m | 165 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 161 insertions(+), 4 deletions(-) diff --git a/src/gui_calib_smoother.m b/src/gui_calib_smoother.m index 31cff0c..9734564 100644 --- a/src/gui_calib_smoother.m +++ b/src/gui_calib_smoother.m @@ -183,6 +183,23 @@ handles.pushbuttonCloseAll = uicontrol( ... 'HorizontalAlignment', 'left',... 'Callback', {@checkCommOption_Callback,'filter_step_ahead'}); + num = num+1; + uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Tag', 'text7', ... + 'Style', 'text', 'BackgroundColor', bg_color,... + 'Units','normalized','Position',[spc*2 top-num*dheight dwidth*1.5 dheight/2],... + 'String', 'prefilter:', ... + 'HorizontalAlignment', 'left'); + + handles.prefilter = uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Style', 'edit', 'BackgroundColor', bg_color,... + 'Units','normalized','Position',[spc*3+dwidth*1.5 top-num*dheight dwidth*1.5 dheight/2],... + 'TooltipString','A value of 1 means that the estimation procedure will demean each data series by its empirical mean. Default: 0, i.e. no prefiltering.',... + 'HorizontalAlignment', 'left',... + 'Callback', {@checkCommOption_Callback,'prefilter'}); + num = num+1; uicontrol( ... 'Parent', handles.uipanelResults, ... @@ -203,6 +220,122 @@ handles.pushbuttonCloseAll = uicontrol( ... model_settings.calib_smoother.parameter_set = 'calibration'; + num = num+1; + uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Tag', 'text7', ... + 'Style', 'text', 'BackgroundColor', bg_color,... + 'Units','normalized','Position',[spc*2 top-num*dheight dwidth*1.5 dheight/2],... + 'String', 'loglinear:', ... + 'HorizontalAlignment', 'left'); + + handles.loglinear = uicontrol(... + 'Parent', handles.uipanelResults, ... + 'Style','checkbox',... + 'Units','normalized','Position',[spc*3+dwidth*1.5 top-num*dheight dwidth dheight/2],... + 'TooltipString','Triggers the computation of a log-linear approximation of the model instead of a linear approximation.',... + 'Callback', {@checkCommOption_Callback,'loglinear'}); + + num = num+1; + uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Tag', 'text7', ... + 'Style', 'text', 'BackgroundColor', bg_color,... + 'Units','normalized','Position',[spc*2 top-num*dheight dwidth*1.5 dheight/2],... + 'String', 'first_obs:', ... + 'HorizontalAlignment', 'left'); + + handles.first_obs = uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Style', 'edit', 'BackgroundColor', bg_color,... + 'Units','normalized','Position',[spc*3+dwidth*1.5 top-num*dheight dwidth*1.5 dheight/2],... + 'TooltipString','The number of the first observation to be used. In case of estimating a DSGE-VAR, first_obs needs to be larger than the number of lags. Default: 1.',... + 'HorizontalAlignment', 'left',... + 'Callback', {@checkCommOption_Callback,'first_obs'}); + + num = num+1; + uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Tag', 'text7', ... + 'Style', 'text', 'BackgroundColor', bg_color,... + 'Units','normalized','Position',[spc*2 top-num*dheight dwidth*1.5 dheight/2],... + 'String', 'filter_decomposition:', ... + 'HorizontalAlignment', 'left'); + + handles.filter_decomposition = uicontrol(... + 'Parent', handles.uipanelResults, ... + 'Style','checkbox',... + 'Units','normalized','Position',[spc*3+dwidth*1.5 top-num*dheight dwidth dheight/2],... + 'TooltipString','Triggers the computation of the shock decomposition of the above k-step ahead filtered values.',... + 'Callback', {@checkCommOption_Callback,'filter_decomposition'}); + + num = num+1; + uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Tag', 'text7', ... + 'Style', 'text', 'BackgroundColor', bg_color,... + 'Units','normalized','Position',[spc*2 top-num*dheight dwidth*1.5 dheight/2],... + 'String', 'diffuse_filter:', ... + 'HorizontalAlignment', 'left'); + + handles.diffuse_filter = uicontrol(... + 'Parent', handles.uipanelResults, ... + 'Style','checkbox',... + 'Units','normalized','Position',[spc*3+dwidth*1.5 top-num*dheight dwidth dheight/2],... + 'TooltipString','Uses the diffuse Kalman filter (as described in Durbin and Koopman (2012) and Koopman and Durbin (2003) for the multivariate and Koopman and Durbin (2000) for the univariate filter) to estimate models with non-stationary observed variables.',... + 'Callback', {@checkCommOption_Callback,'diffuse_filter'}); + + num = num+1; + uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Tag', 'text7', ... + 'Style', 'text', 'BackgroundColor', bg_color,... + 'Units','normalized','Position',[spc*2 top-num*dheight dwidth*1.5 dheight/2],... + 'String', 'diffuse_kalman_tol:', ... + 'HorizontalAlignment', 'left'); + + handles.diffuse_kalman_tol = uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Style', 'edit', 'BackgroundColor', bg_color,... + 'Units','normalized','Position',[spc*3+dwidth*1.5 top-num*dheight dwidth*1.5 dheight/2],... + 'TooltipString','Numerical tolerance for determining the singularity of the covariance matrix of the prediction errors (F∞) and the rank of the covariance matrix of the non-stationary state variables (P∞) during the Diffuse Kalman filter. Default value is 1e-6.',... + 'HorizontalAlignment', 'left',... + 'Callback', {@checkCommOption_Callback,'diffuse_kalman_tol'}); + + num = num+1; + uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Tag', 'text7', ... + 'Style', 'text', 'BackgroundColor', bg_color,... + 'Units','normalized','Position',[spc*2 top-num*dheight dwidth*1.5 dheight/2],... + 'String', 'xls_sheet:', ... + 'HorizontalAlignment', 'left'); + + handles.xls_sheet = uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Style', 'edit', 'BackgroundColor', bg_color,... + 'Units','normalized','Position',[spc*3+dwidth*1.5 top-num*dheight dwidth*1.5 dheight/2],... + 'TooltipString','The name of the sheet with the data in an Excel file.',... + 'HorizontalAlignment', 'left',... + 'Callback', {@checkCommOption_Callback,'xls_sheet'}); + + num = num+1; + uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Tag', 'text7', ... + 'Style', 'text', 'BackgroundColor', bg_color,... + 'Units','normalized','Position',[spc*2 top-num*dheight dwidth*1.5 dheight/2],... + 'String', 'xls_range:', ... + 'HorizontalAlignment', 'left'); + + handles.xls_range = uicontrol( ... + 'Parent', handles.uipanelResults, ... + 'Style', 'edit', 'BackgroundColor', bg_color,... + 'Units','normalized','Position',[spc*3+dwidth*1.5 top-num*dheight dwidth*1.5 dheight/2],... + 'TooltipString','The range with the data in an Excel file. For example, xls_range=B2:D200.',... + 'HorizontalAlignment', 'left',... + 'Callback', {@checkCommOption_Callback,'xls_range'}); + num = num+2; uicontrol( ... 'Parent', handles.uipanelResults, ... @@ -242,6 +375,8 @@ handles.pushbuttonCloseAll = uicontrol( ... end switch option_name + case 'filtered_vars' + comm_options.filtered_vars = value; case 'filter_step_ahead' if ~isempty(value) num_value = str2num(value); @@ -261,8 +396,24 @@ handles.pushbuttonCloseAll = uicontrol( ... comm_options = rmfield(comm_options,'filter_step_ahead'); end end - case 'filtered_vars' - comm_options.filtered_vars = value; + case 'prefilter' + comm_options.prefilter = value; + case 'parameter_set' + comm_options.parameter_set = hObject.String{value}; + case 'loglinear' + comm_options.loglinear = value; + case 'first_obs' + comm_options.first_obs = value; + case 'filter_decomposition' + comm_options.filter_decomposition = value; + case 'diffuse_filter' + comm_options.diffuse_filter = value; + case 'diffuse_kalman_tol' + comm_options.diffuse_kalman_tol = value; + case 'xls_sheet' + comm_options.xls_sheet = value; + case 'xls_range' + comm_options.xls_range = value; case 'select_all_vars' if value handles.consider_only_observed.Value = false; @@ -273,8 +424,6 @@ handles.pushbuttonCloseAll = uicontrol( ... handles.select_all_vars.Value = false; end select_only_observed(value); - case 'parameter_set' - comm_options.parameter_set = hObject.String{value}; end comm_str = gui_tools.command_string('calib_smoother', comm_options); handles.calib_smoother.String = comm_str; @@ -354,7 +503,15 @@ handles.pushbuttonCloseAll = uicontrol( ... handles.endoTable.Data(:,1) = {false}; handles.filtered_vars.Value = 0; handles.filter_step_ahead.String = ''; + handles.prefilter.Value = 0; handles.parameter_set.Value = 1; + handles.loglinear.Value = 0; + handles.first_obs.Value = 1; + handles.filter_decomposition.Value = 0; + handles.diffuse_filter.Value = 0; + handles.diffuse_kalman_tol.Value = 0; + handles.xls_sheet.String = ''; + handles.xls_range.String = ''; handles.select_all_vars.Value =0; handles.consider_only_observed.Value = 0; model_settings.calib_smoother = struct(); -- GitLab