Skip to content
Snippets Groups Projects
Verified Commit c01bcb09 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

update posterior distribution tab

parent 3c269cf6
Branches
No related tags found
No related merge requests found
......@@ -110,8 +110,8 @@ switch oid
case 'epilogue'
handles.post_processing_epilogue.Enable = status;
case 'prior_posterior'
handles.post_processing_prior_posterior.Enable = status;
case 'posterior'
handles.post_processing_posterior.Enable = status;
otherwise
error(['menu option: ' oid ' not handled']);
......
......@@ -355,8 +355,8 @@ function post_processing_epilogue_Callback(hObject, ~, handles)
gui_epilogue(addTab(hObject, 'Epilogue', handles));
end
function post_processing_prior_posterior_Callback(hObject, ~, handles)
gui_prior_posterior_distribution(addTab(hObject, 'Prior/Posterior distribution', handles));
function post_processing_posterior_Callback(hObject, ~, handles)
gui_posterior_distribution(addTab(hObject, 'Posterior distribution', handles));
end
% --------------------------------------------------------------------
function help_product_help_Callback(~, ~, ~)
......@@ -940,14 +940,14 @@ uimenu(...
'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
appdata = [];
appdata.lastValidTag = 'post_processing_prior_posterior';
appdata.lastValidTag = 'post_processing_posterior';
uimenu(...
'Parent', h33, ...
'Enable', 'off', ...
'Callback', @(hObject,eventdata)dynare_gui('post_processing_prior_posterior_Callback',hObject,eventdata,guidata(hObject)),...
'Label', 'Prior/Posterior distribution',...
'Tag', 'post_processing_prior_posterior',...
'Callback', @(hObject,eventdata)dynare_gui('post_processing_posterior_Callback',hObject,eventdata,guidata(hObject)),...
'Label', 'Posterior distribution',...
'Tag', 'post_processing_posterior',...
'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
appdata = [];
......
function gui_prior_posterior_distribution(tabId)
% function gui_prior_posterior_distribution(tabId)
function gui_posterior_distribution(tabId)
% function gui_posterior_distribution(tabId)
%
% INPUTS
% tabId: GUI tab element which displays epilogue command interface
......@@ -27,9 +27,8 @@ function gui_prior_posterior_distribution(tabId)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global M_
global model_settings
bg_color = char(getappdata(0, 'bg_color'));
special_color = char(getappdata(0, 'special_color'));
handles = [];
......@@ -37,88 +36,176 @@ gui_size = gui_tools.get_gui_elements_size(tabId);
% --- PANELS -------------------------------------
handles.uipanelShocks = uipanel( ...
'Parent', tabId, ...
'Tag', 'uipanelShocks', ...
'BackgroundColor', special_color, ...
'Units', 'normalized', ...
'Position', [0.65 0.18 0.3 0.7], ...
'Title', '', ...
'BorderType', 'none');
radioButtonIRF_Callback;
handles.uipanelVars = uipanel( ...
'Parent', tabId, ...
'Tag', 'uipanelVars', ...
'UserData', zeros(1,0), ...
'BackgroundColor', special_color, ...
'Units', 'normalized', ...
'Position', [0.51 0.18 0.48 0.7], ...
'Position', [0.3 0.18 0.3 0.7], ...
'Title', '', ...
'BorderType', 'none');
handles = gui_tabs.create_endo_vars(handles, 'prior_posterior');
handles = gui_tabs.create_endo_vars(handles, 'posterior');
% --- Radio Buttons -------------------------------------
handles.buttongroup = uibuttongroup( ...
'Parent', tabId, ...
'Position', [0.05 0.88 0.36 0.05], ...
'Position', [0.05 0.2 0.2 0.65], ...
'Units', 'normalized');
uicontrol(handles.buttongroup, ...
'Style', 'radiobutton', ...
'String', 'Prior', ...
'String', 'IRF', ...
'Units', 'normalized', ...
'Position', [0 0.9 1 .1], ...
'Callback', @radioButtonIRF_Callback);
function radioButtonIRF_Callback(~, ~)
data = cell(size(model_settings.shocks, 1), 2);
data(:,1) = {false};
data(:,2) = model_settings.shocks(:,1);
handles.shocksTabGroup = uitabgroup(handles.uipanelShocks, 'Position', [0 0 1 1]);
new_tab = uitab(handles.shocksTabGroup, 'Title', 'Shocks' , 'UserData', 1);
currentPanel = uipanel('Parent', new_tab, 'BackgroundColor', 'white', 'BorderType', 'none');
handles.shocksTable = uitable(currentPanel, ...
'Data', data, ...
'Units', 'normalized', ...
'ColumnName', {'Active','Shock'}, ...
'ColumnEditable', [true false], ...
'RowName', [], ...
'Position', [0 0 1 1]);
handles.uipanelShocks.Visible = true;
end
uicontrol(handles.buttongroup, ...
'Style', 'radiobutton', ...
'String', 'Posterior', ...
'String', 'Covariance', ...
'Units', 'normalized', ...
'Position', [0.1 0 1 1]);
'Position', [0 0.8 1 .1], ...
'Callback', @radioButtonCovariance_Callback);
handles.buttongroup1 = uibuttongroup( ...
'Parent', tabId, ...
'Position', [0.05 0.2 0.4 0.65], ...
'Units', 'normalized');
uicontrol(handles.buttongroup1, ...
'Style', 'radiobutton', ...
'String', 'IRF', ...
'Units', 'normalized', ...
'Position', [0 0.9 1 .1]);
function radioButtonCovariance_Callback(~, ~)
handles.uipanelShocks.Visible = false;
end
uicontrol(handles.buttongroup1, ...
uicontrol(handles.buttongroup, ...
'Style', 'radiobutton', ...
'String', 'Smoother', ...
'Units', 'normalized', ...
'Position', [0 0.8 1 .1]);
'Position', [0 0.7 1 .1], ...
'Callback', @radioButtonSmoother_Callback);
uicontrol(handles.buttongroup1, ...
'Style', 'radiobutton', ...
'String', 'Smoother', ...
'Units', 'normalized', ...
'Position', [0 0.7 1 .1]);
function radioButtonSmoother_Callback(~, ~)
handles.uipanelShocks.Visible = false;
end
uicontrol(handles.buttongroup1, ...
uicontrol(handles.buttongroup, ...
'Style', 'radiobutton', ...
'String', 'Filter', ...
'Units', 'normalized', ...
'Position', [0 0.6 1 .1]);
'Position', [0 0.6 1 .1], ...
'Callback', @radioButtonFilter_Callback);
function radioButtonFilter_Callback(~, ~)
handles.uipanelShocks.Visible = false;
end
uicontrol(handles.buttongroup1, ...
uicontrol(handles.buttongroup, ...
'Style', 'radiobutton', ...
'String', 'Update', ...
'Units', 'normalized', ...
'Position', [0 0.5 1 .1]);
'Position', [0 0.5 1 .1], ...
'Callback', @radioButtonUpdate_Callback);
function radioButtonUpdate_Callback(~, ~)
handles.uipanelShocks.Visible = false;
end
uicontrol(handles.buttongroup1, ...
uicontrol(handles.buttongroup, ...
'Style', 'radiobutton', ...
'String', 'Forecast', ...
'Units', 'normalized', ...
'Position', [0 0.4 1 .1]);
'Position', [0 0.4 1 .1], ...
'Callback', @radioButtonForecast_Callback);
function radioButtonForecast_Callback(~, ~)
handles.uipanelShocks.Visible = false;
end
% --- PUSHBUTTONS -------------------------------------
handles.pushbuttonSimulation = uicontrol( ...
'Parent', tabId, ...
'Tag', 'pushbuttonPriorPosterior', ...
'Tag', 'pushbuttonPosterior', ...
'Style', 'pushbutton', ...
'Units','normalized', ...
'Position', [gui_size.space gui_size.bottom gui_size.button_width_small gui_size.button_height], ...
'String', 'Run prior/posterior', ...
'Callback', @pushbuttonPriorPosterior_Callback);
function pushbuttonPriorPosterior_Callback(~, ~)
'String', 'Run', ...
'Callback', @pushbuttonPosterior_Callback);
function pushbuttonPosterior_Callback(~, ~)
switch handles.buttongroup.SelectedObject.String
case 'IRF'
global posterior_irf
if sum([handles.endoTable.Data{:,1}]) ~= 1 || sum([handles.shocksTable.Data{:,1}]) ~= 1
gui_tools.show_error('For IRF you must choose 1 endogenous and 1 exogenous variable');
end
posterior_irf = get_posterior_irf( ...
handles.endoTable.Data{[handles.endoTable.Data{:,1}],2}, ...
handles.shocksTable.Data{[handles.shocksTable.Data{:,1}],2});
case 'Covariance'
global posterior_covariance
selected = handles.endoTable.Data([handles.endoTable.Data{:,1}], :);
switch size(selected, 1)
case 1
posterior_covariance = get_posterior_covariance(selected{2}, selected{2});
case 2
posterior_covariance = get_posterior_covariance(selected{1,2}, selected{2,2});
otherwise
gui_tools.show_error('For Covariance you must choose 1 or 2 endogenous variables');
end
case 'Smoother'
if sum([handles.endoTable.Data{:,1}]) ~= 1
gui_tools.show_error('For Smoother you must choose 1 endogenous variable');
end
global posterior_smoother
posterior_smoother = get_posterior_timeseries('smoothed', ...
handles.endoTable.Data{[handles.endoTable.Data{:,1}],2});
case 'Filter'
if sum([handles.endoTable.Data{:,1}]) ~= 1
gui_tools.show_error('For Filter you must choose 1 endogenous variable');
end
global posterior_filter
posterior_filter = get_posterior_timeseries('filtered', ...
handles.endoTable.Data{[handles.endoTable.Data{:,1}],2});
case 'Update'
if sum([handles.endoTable.Data{:,1}]) ~= 1
gui_tools.show_error('For Update you must choose 1 endogenous variable');
end
global posterior_update
posterior_update = get_posterior_timeseries('updated', ...
handles.endoTable.Data{[handles.endoTable.Data{:,1}],2});
case 'Forecast'
if sum([handles.endoTable.Data{:,1}]) ~= 1
gui_tools.show_error('For Forecast you must choose 1 endogenous variable');
end
global posterior_forecast
posterior_forecast = get_posterior_timeseries('forecast', ...
handles.endoTable.Data{[handles.endoTable.Data{:,1}],2});
otherwise
gui_tools.show_error('Should not arrive here');
end
end
handles.pushbuttonReset = uicontrol( ...
......@@ -132,6 +219,7 @@ handles.pushbuttonReset = uicontrol( ...
function reset(~, ~)
handles.endoTable.Data(:, 1) = {false};
handles.shocksTable.Data(:, 1) = {false};
end
uicontrol( ...
......
......@@ -40,7 +40,7 @@ gui_tools.menu_options('stochastic','Off');
gui_tools.menu_options('deterministic','Off');
gui_tools.menu_options('sensitivity', 'Off');
gui_tools.menu_options('epilogue', 'Off');
gui_tools.menu_options('prior_posterior', 'Off');
gui_tools.menu_options('posterior', 'Off');
if isempty(model_settings) || isempty(fieldnames(model_settings))
return
......@@ -52,7 +52,7 @@ if enable
return
end
gui_tools.menu_options('epilogue', 'On');
gui_tools.menu_options('prior_posterior', 'On');
gui_tools.menu_options('posterior', 'On');
if project_info.project_model_stochastic
gui_tools.menu_options('estimation', 'On');
gui_tools.menu_options('stochastic', 'On');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment