Cosmetic improvements in prior_draw.m

time-shift
Johannes Pfeifer 2015-04-04 19:38:26 +02:00
parent f57cf46df9
commit 2620322122
1 changed files with 15 additions and 5 deletions

View File

@ -1,9 +1,17 @@
function pdraw = prior_draw(init,uniform) % --*-- Unitary tests --*-- function pdraw = prior_draw(init,uniform) % --*-- Unitary tests --*--
% This function generate one draw from the joint prior distribution. % This function generate one draw from the joint prior distribution and
% allows sampling uniformly from the prior support (uniform==1 when called with init==1)
% %
% INPUTS % INPUTS
% o init [integer] scalar equal to 1 (first call) or 0. % o init [integer] scalar equal to:
% o uniform [integer] scalar equal to 1 (first call) or 0. % 1: first call to set up persistent variables
% describing the prior
% 0: subsequent call to get prior
% draw
% o uniform [integer] scalar used in initialization (init=1), equal to:
% 1: sample uniformly from prior
% support (overwrites prior shape used for sampling within this function)
% 0: sample from joint prior distribution
% %
% OUTPUTS % OUTPUTS
% o pdraw [double] 1*npar vector, draws from the joint prior density. % o pdraw [double] 1*npar vector, draws from the joint prior density.
@ -14,7 +22,9 @@ function pdraw = prior_draw(init,uniform) % --*-- Unitary tests --*--
% %
% NOTE 1. Input arguments 1 an 2 are only needed for initialization. % NOTE 1. Input arguments 1 an 2 are only needed for initialization.
% NOTE 2. A given draw from the joint prior distribution does not satisfy BK conditions a priori. % NOTE 2. A given draw from the joint prior distribution does not satisfy BK conditions a priori.
% NOTE 3. This code relies on bayestopt_ as created in the base workspace
% by the preprocessor (or as updated in subsequent pieces of code and handed to the base workspace)
%
% Copyright (C) 2006-2015 Dynare Team % Copyright (C) 2006-2015 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
@ -87,7 +97,7 @@ if nargin>0 && init
else else
inverse_gamma_2_draws = 1; inverse_gamma_2_draws = 1;
end end
pdraw = zeros(number_of_estimated_parameters,1); pdraw = NaN(number_of_estimated_parameters,1);
return return
end end