Skip to content
Snippets Groups Projects
Select Git revision
  • c5b95e932890ce3670a1fc641e0ffa3e9e898e17
  • master default
  • nlf-fixes
  • newton-quadratic-equation-solver
  • nlf-fixes-r
  • nls-fixes
  • sep-fixes
  • sep
  • use-dprior
  • ep-sparse
  • rebase-1
  • parfor
  • reset-seed-in-unit-tests
  • remove-persistent-variables
  • nonlinear-filter-fixes
  • pac-mce-with-composite-target
  • 6.x
  • dprior
  • covariance-quadratic-approximation
  • benchmark-ec
  • kalman_mex
  • 5.5
  • 5.4
  • 5.3
  • 5.2
  • 5.1
  • 5.0
  • 5.0-rc1
  • 4.7-beta3
  • 4.7-beta2
  • 4.7-beta1
  • 4.6.4
  • 4.6.3
  • 4.6.2
  • 4.6.1
  • 4.6.0
  • 4.6.0-rc2
  • 4.6.0-rc1
  • 4.6-beta1
  • 4.5.7
  • 4.5.6
41 results

disp.m

Blame
  • Forked from Dynare / dynare
    Source project has a limited visibility.
    metropolis_hastings_initialization.m 16.13 KiB
    function [ ix2, ilogpo2, ModelName, MhDirectoryName, fblck, fline, npar, nblck, nruns, NewFile, MAX_nruns, d ] = ...
        metropolis_hastings_initialization(TargetFun, xparam1, vv, mh_bounds,dataset_,options_,M_,estim_params_,bayestopt_,oo_)
    %function [ ix2, ilogpo2, ModelName, MhDirectoryName, fblck, fline, npar, nblck, nruns, NewFile, MAX_nruns, d ] = 
    %    metropolis_hastings_initialization(TargetFun, xparam1, vv, mh_bounds, dataset_,options_,M_,estim_params_,bayestopt_,oo_)
    % Metropolis-Hastings initialization.
    % 
    % INPUTS 
    %   o TargetFun  [char]     string specifying the name of the objective
    %                           function (posterior kernel).
    %   o xparam1    [double]   (p*1) vector of parameters to be estimated (initial values).
    %   o vv         [double]   (p*p) matrix, posterior covariance matrix (at the mode).
    %   o mh_bounds  [double]   (p*2) matrix defining lower and upper bounds for the parameters. 
    %   o dataset_              data structure
    %   o options_              options structure
    %   o M_                    model structure
    %   o estim_params_         estimated parameters structure
    %   o bayestopt_            estimation options structure
    %   o oo_                   outputs structure
    %  
    % OUTPUTS 
    %   None  
    %
    % SPECIAL REQUIREMENTS
    %   None.
    
    % Copyright (C) 2006-2011 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 <http://www.gnu.org/licenses/>.
    
    ix2 = [];
    ilogpo2 = [];
    ModelName = []; 
    MhDirectoryName = [];
    fblck = [];
    fline = [];
    npar = [];
    nblck = [];
    nruns = [];
    NewFile = [];
    MAX_nruns = [];
    d = [];
    
    ModelName = M_.fname;
    
    if ~isempty(M_.bvar)
        ModelName = [M_.fname '_bvar'];
    end
    
    MhDirectoryName = CheckPath('metropolis',M_.dname);
    
    nblck = options_.mh_nblck;
    nruns = ones(nblck,1)*options_.mh_replic;
    npar  = length(xparam1);
    MAX_nruns = ceil(options_.MaxNumberOfBytes/(npar+2)/8);
    d = chol(vv);
    
    if ~options_.load_mh_file && ~options_.mh_recover