Skip to content
Snippets Groups Projects
Select Git revision
1 result Searching

CheckPath.m

Blame
  • dynare_sensitivity.m 22.41 KiB
    function x0=dynare_sensitivity(options_gsa)
    % Frontend to the Sensitivity Analysis Toolbox for DYNARE
    %
    % Reference:
    % M. Ratto, Global Sensitivity Analysis for Macroeconomic models, MIMEO, 2006.
    
    % Copyright © 2008-2018 Dynare Team
    %
    % This file is part of Dynare.
    %
    % Dynare is free software: you can redistribute it and/or modify
    % it under the terms of the GNU General Public License as published by
    % the Free Software Foundation, either version 3 of the License, or
    % (at your option) any later version.
    %
    % Dynare is distributed in the hope that it will be useful,
    % but WITHOUT ANY WARRANTY; without even the implied warranty of
    % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % GNU General Public License for more details.
    %
    % You should have received a copy of the GNU General Public License
    % along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
    
    global M_ options_ oo_ bayestopt_ estim_params_
    
    if options_.dsge_var
        error('Identification does not support DSGE-VARs at the current stage')
    end
    
    fname_ = M_.fname;
    lgy_ = M_.endo_names;
    x0=[];
    
    % check user defined options
    if isfield(options_gsa,'neighborhood_width') && options_gsa.neighborhood_width
        if isfield(options_gsa,'pprior') && options_gsa.pprior
            error('sensitivity:: neighborhood_width is incompatible with prior sampling')
        end
        if isfield(options_gsa,'ppost') && options_gsa.ppost
            error('sensitivity:: neighborhood_width is incompatible with posterior sampling')
        end
    end
    
    if isfield(options_gsa,'morris') && options_gsa.morris==1
        if isfield(options_gsa,'identification') && options_gsa.identification==0
            %         options_gsa.redform=1;
        end
        if isfield(options_gsa,'ppost') && options_gsa.ppost
            error('sensitivity:: Morris is incompatible with posterior sampling')
        elseif isfield(options_gsa,'pprior') && options_gsa.pprior==0
            if ~(isfield(options_gsa,'neighborhood_width') && options_gsa.neighborhood_width)
                error('sensitivity:: Morris is incompatible with MC sampling with correlation matrix')
            end
        end
        if isfield(options_gsa,'rmse') && options_gsa.rmse
            error('sensitivity:: Morris is incompatible with rmse analysis')
        end
        if (isfield(options_gsa,'alpha2_stab') && options_gsa.alpha2_stab<1) || ...
                (isfield(options_gsa,'pvalue_ks') && options_gsa.pvalue_ks) || ...
                (isfield(options_gsa,'pvalue_corr') && options_gsa.pvalue_corr)
            error('sensitivity:: Morris is incompatible with Monte Carlo filtering')
        end
    end
    
    % end check user defined options
    options_gsa = set_default_option(options_gsa,'datafile',[]);
    options_gsa = set_default_option(options_gsa,'rmse',0);
    options_gsa = set_default_option(options_gsa,'useautocorr',0);
    
    options_gsa = set_default_option(options_gsa,'moment_calibration',options_.endogenous_prior_restrictions.moment);