Commit 13f1e62d authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Deleted trailing white spaces.

parent 859335b3
...@@ -101,7 +101,7 @@ function [fval,exit_flag,ys,trend_coeff,info,Model,DynareOptions,BayesInfo,Dynar ...@@ -101,7 +101,7 @@ function [fval,exit_flag,ys,trend_coeff,info,Model,DynareOptions,BayesInfo,Dynar
%! @end deftypefn %! @end deftypefn
%@eod: %@eod:
% Copyright (C) 2010-2011 Dynare Team % Copyright (C) 2010, 2011, 2012 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -197,8 +197,8 @@ if EstimatedParameters_.ncx ...@@ -197,8 +197,8 @@ if EstimatedParameters_.ncx
end end
% Try to compute the cholesky decomposition of Q (possible iff Q is positive definite) % Try to compute the cholesky decomposition of Q (possible iff Q is positive definite)
[CholQ,testQ] = chol(Q); [CholQ,testQ] = chol(Q);
if testQ if testQ
% The variance-covariance matrix of the structural innovations is not definite positive. We have to compute the eigenvalues of this matrix in order to build the endogenous penalty. % The variance-covariance matrix of the structural innovations is not definite positive. We have to compute the eigenvalues of this matrix in order to build the endogenous penalty.
a = diag(eig(Q)); a = diag(eig(Q));
k = find(a < 0); k = find(a < 0);
if k > 0 if k > 0
...@@ -212,7 +212,7 @@ if EstimatedParameters_.ncx ...@@ -212,7 +212,7 @@ if EstimatedParameters_.ncx
end end
% Get the off-diagonal elements of the covariance matrix for the measurement errors. Test if H is positive definite. % Get the off-diagonal elements of the covariance matrix for the measurement errors. Test if H is positive definite.
if EstimatedParameters_.ncn if EstimatedParameters_.ncn
for i=1:EstimatedParameters_.ncn for i=1:EstimatedParameters_.ncn
k1 = DynareOptions.lgyidx2varobs(EstimatedParameters_.corrn(i,1)); k1 = DynareOptions.lgyidx2varobs(EstimatedParameters_.corrn(i,1));
k2 = DynareOptions.lgyidx2varobs(EstimatedParameters_.corrn(i,2)); k2 = DynareOptions.lgyidx2varobs(EstimatedParameters_.corrn(i,2));
...@@ -266,8 +266,8 @@ BayesInfo.mf = BayesInfo.mf1; ...@@ -266,8 +266,8 @@ BayesInfo.mf = BayesInfo.mf1;
% Define the deterministic linear trend of the measurement equation. % Define the deterministic linear trend of the measurement equation.
if DynareOptions.noconstant if DynareOptions.noconstant
constant = zeros(nvobs,1); constant = zeros(nvobs,1);
else else
if DynareOptions.loglinear if DynareOptions.loglinear
constant = log(SteadyState(BayesInfo.mfys)); constant = log(SteadyState(BayesInfo.mfys));
else else
...@@ -332,7 +332,7 @@ ReducedForm.mf1 = mf1; ...@@ -332,7 +332,7 @@ ReducedForm.mf1 = mf1;
% Set initial condition. % Set initial condition.
switch DynareOptions.particle.initialization switch DynareOptions.particle.initialization
case 1% Initial state vector covariance is the ergodic variance associated to the first order Taylor-approximation of the model. case 1% Initial state vector covariance is the ergodic variance associated to the first order Taylor-approximation of the model.
StateVectorMean = ReducedForm.constant(mf0); StateVectorMean = ReducedForm.constant(mf0);
StateVectorVariance = lyapunov_symm(ReducedForm.ghx(mf0,:),ReducedForm.ghu(mf0,:)*ReducedForm.Q*ReducedForm.ghu(mf0,:)',1e-12,1e-12); StateVectorVariance = lyapunov_symm(ReducedForm.ghx(mf0,:),ReducedForm.ghu(mf0,:)*ReducedForm.Q*ReducedForm.ghu(mf0,:)',1e-12,1e-12);
case 2% Initial state vector covariance is a monte-carlo based estimate of the ergodic variance (consistent with a k-order Taylor-approximation of the model). case 2% Initial state vector covariance is a monte-carlo based estimate of the ergodic variance (consistent with a k-order Taylor-approximation of the model).
......
...@@ -5,7 +5,7 @@ function [LIK,lik] = sequential_importance_particle_filter(ReducedForm,Y,start,D ...@@ -5,7 +5,7 @@ function [LIK,lik] = sequential_importance_particle_filter(ReducedForm,Y,start,D
%! @deftypefn {Function File} {@var{y}, @var{y_} =} sequential_importance_particle_filter (@var{ReducedForm},@var{Y}, @var{start}, @var{DynareOptions}) %! @deftypefn {Function File} {@var{y}, @var{y_} =} sequential_importance_particle_filter (@var{ReducedForm},@var{Y}, @var{start}, @var{DynareOptions})
%! @anchor{particle/sequential_importance_particle_filter} %! @anchor{particle/sequential_importance_particle_filter}
%! @sp 1 %! @sp 1
%! Evaluates the likelihood of a nonlinear model with a particle filter (optionally with resampling). %! Evaluates the likelihood of a nonlinear model with a particle filter (optionally with resampling).
%! %!
%! @sp 2 %! @sp 2
%! @strong{Inputs} %! @strong{Inputs}
...@@ -14,7 +14,7 @@ function [LIK,lik] = sequential_importance_particle_filter(ReducedForm,Y,start,D ...@@ -14,7 +14,7 @@ function [LIK,lik] = sequential_importance_particle_filter(ReducedForm,Y,start,D
%! @item ReducedForm %! @item ReducedForm
%! Structure describing the state space model (built in @ref{non_linear_dsge_likelihood}). %! Structure describing the state space model (built in @ref{non_linear_dsge_likelihood}).
%! @item Y %! @item Y
%! p*smpl matrix of doubles (p is the number of observed variables), the (detrended) data. %! p*smpl matrix of doubles (p is the number of observed variables), the (detrended) data.
%! @item start %! @item start
%! Integer scalar, likelihood evaluation starts at observation 'start'. %! Integer scalar, likelihood evaluation starts at observation 'start'.
%! @item DynareOptions %! @item DynareOptions
...@@ -38,7 +38,7 @@ function [LIK,lik] = sequential_importance_particle_filter(ReducedForm,Y,start,D ...@@ -38,7 +38,7 @@ function [LIK,lik] = sequential_importance_particle_filter(ReducedForm,Y,start,D
%! @end deftypefn %! @end deftypefn
%@eod: %@eod:
% Copyright (C) 2011 Dynare Team % Copyright (C) 2011, 2012 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -56,10 +56,10 @@ function [LIK,lik] = sequential_importance_particle_filter(ReducedForm,Y,start,D ...@@ -56,10 +56,10 @@ function [LIK,lik] = sequential_importance_particle_filter(ReducedForm,Y,start,D
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% AUTHOR(S) frederic DOT karame AT univ DASH evry DOT fr % AUTHOR(S) frederic DOT karame AT univ DASH evry DOT fr
% stephane DOT adjemian AT univ DASH lemans DOT fr % stephane DOT adjemian AT univ DASH lemans DOT fr
persistent init_flag persistent init_flag
persistent mf0 mf1 persistent mf0 mf1
persistent number_of_particles persistent number_of_particles
persistent sample_size number_of_observed_variables number_of_structural_innovations persistent sample_size number_of_observed_variables number_of_structural_innovations
...@@ -73,13 +73,13 @@ steadystate = ReducedForm.steadystate; ...@@ -73,13 +73,13 @@ steadystate = ReducedForm.steadystate;
constant = ReducedForm.constant; constant = ReducedForm.constant;
state_variables_steady_state = ReducedForm.state_variables_steady_state; state_variables_steady_state = ReducedForm.state_variables_steady_state;
% Set persistent variables. % Set persistent variables (if needed).
if isempty(init_flag) if isempty(init_flag)
mf0 = ReducedForm.mf0; mf0 = ReducedForm.mf0;
mf1 = ReducedForm.mf1; mf1 = ReducedForm.mf1;
sample_size = size(Y,2); sample_size = size(Y,2);
number_of_observed_variables = length(mf1); number_of_observed_variables = length(mf1);
number_of_structural_innovations = length(ReducedForm.Q); number_of_structural_innovations = length(ReducedForm.Q);
number_of_particles = DynareOptions.particle.number_of_particles; number_of_particles = DynareOptions.particle.number_of_particles;
init_flag = 1; init_flag = 1;
end end
...@@ -93,7 +93,7 @@ ghxx = ReducedForm.ghxx; ...@@ -93,7 +93,7 @@ ghxx = ReducedForm.ghxx;
ghuu = ReducedForm.ghuu; ghuu = ReducedForm.ghuu;
ghxu = ReducedForm.ghxu; ghxu = ReducedForm.ghxu;
% Get covariance matrices % Get covariance matrices.
Q = ReducedForm.Q; Q = ReducedForm.Q;
H = ReducedForm.H; H = ReducedForm.H;
if isempty(H) if isempty(H)
...@@ -111,7 +111,7 @@ stream=RandStream('mt19937ar','Seed',1); ...@@ -111,7 +111,7 @@ stream=RandStream('mt19937ar','Seed',1);
RandStream.setDefaultStream(stream); RandStream.setDefaultStream(stream);
% Initialization of the likelihood. % Initialization of the likelihood.
const_lik = log(2*pi)*number_of_observed_variables; const_lik = log(2*pi)*number_of_observed_variables;
lik = NaN(sample_size,1); lik = NaN(sample_size,1);
% Initialization of the weights across particles. % Initialization of the weights across particles.
...@@ -138,7 +138,7 @@ for t=1:sample_size ...@@ -138,7 +138,7 @@ for t=1:sample_size
weights = ones(1,number_of_particles) ; weights = ones(1,number_of_particles) ;
elseif ~isempty(strmatch(DynareOptions.particle_filter.resampling,'none','exact')) elseif ~isempty(strmatch(DynareOptions.particle_filter.resampling,'none','exact'))
StateVectors = tmp(mf0,:); StateVectors = tmp(mf0,:);
weights = number_of_particles*weights ; weights = number_of_particles*weights;
end end
end end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment