* Added number of particles (10;-) when calling monte_carlo_gaussian_particle_filter from particle/DsgeLiklihood.
* Cosmetic changes. git-svn-id: https://www.dynare.org/svn/dynare/trunk@3233 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
b8db5a23a1
commit
90f5ab741b
|
@ -255,7 +255,7 @@ function [fval,cost_flag,ys,trend_coeff,info] = DsgeLikelihood(xparam1,gend,data
|
|||
rfm.measurement.H = H;
|
||||
number_of_particles = 10;
|
||||
|
||||
LIK = monte_carlo_gaussian_particle_filter(rfm,Y);
|
||||
LIK = monte_carlo_gaussian_particle_filter(rfm,Y,[],number_of_particles);
|
||||
|
||||
|
||||
% ------------------------------------------------------------------------------
|
||||
|
|
|
@ -16,8 +16,7 @@ function y = local_state_space_iteration_2(yhat,epsilon,ghx,ghu,constant,half_gh
|
|||
% constant [double] m*1 vector (steady state + second order correction).
|
||||
% half_ghxx [double] m*n² matrix, subset of .5*dr.ghxx.
|
||||
% half_ghuu [double] m*q² matrix, subset of .5*dr.ghuu.
|
||||
% ghxu [double] m*nq matrix, subset of dr.ghxu.
|
||||
% index [integer]
|
||||
% ghxu [double] m*nq matrix, subset of dr.ghxu.
|
||||
%
|
||||
% OUTPUTS
|
||||
% y [double] stochastic simulations results
|
||||
|
|
|
@ -39,7 +39,7 @@ function [LIK,lik] = monte_carlo_gaussian_particle_filter(reduced_form_model,Y,s
|
|||
% 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_ bayestopt_
|
||||
global M_ bayestopt_ oo_
|
||||
persistent init_flag
|
||||
persistent restrict_variables_idx observed_variables_idx state_variables_idx mf0 mf1
|
||||
persistent sample_size number_of_state_variables number_of_observed_variables number_of_structural_innovations
|
||||
|
@ -63,7 +63,7 @@ if isempty(init_flag)
|
|||
restrict_variables_idx = bayestopt_.restrict_var_list;
|
||||
observed_variables_idx = restrict_variables_idx(mf1);
|
||||
state_variables_idx = restrict_variables_idx(mf0);
|
||||
sample_size = size(Y,2);
|
||||
sample_size = size(Y,2);
|
||||
number_of_state_variables = length(mf0);
|
||||
number_of_observed_variables = length(mf1);
|
||||
number_of_structural_innovations = length(Q);
|
||||
|
@ -85,12 +85,8 @@ StateVectorVariance = lyapunov_symm(ghx(mf0,:),ghu(mf0,:)*Q*ghu(mf0,:)',1e-12,1e
|
|||
StateVectorVarianceSquareRoot = reduced_rank_cholesky(StateVectorVariance)';
|
||||
state_variance_rank = size(StateVectorVarianceSquareRoot,2);
|
||||
|
||||
%state_idx = 1:state_variance_rank;
|
||||
%innovation_idx = 1+state_variance_rank:state_variance_rank+number_of_structural_innovations;
|
||||
|
||||
Q_lower_triangular_cholesky = chol(Q)';
|
||||
|
||||
|
||||
% Set seed for randn().
|
||||
seed = [ 362436069 ; 521288629 ];
|
||||
randn('state',seed);
|
||||
|
@ -98,7 +94,6 @@ randn('state',seed);
|
|||
const_lik = log(2*pi)*number_of_observed_variables;
|
||||
lik = NaN(sample_size,1);
|
||||
|
||||
|
||||
for t=1:sample_size
|
||||
PredictedStateMean = zeros(number_of_state_variables,1);
|
||||
PredictedObservedMean = zeros(number_of_observed_variables,1);
|
||||
|
|
Loading…
Reference in New Issue