modifying dynare_resolve() calling sequence

time-shift
Michel Juillard 2011-01-26 13:50:11 +01:00
parent a336799b96
commit bff8de837b
6 changed files with 18 additions and 25 deletions

View File

@ -124,9 +124,8 @@ M_.H = H;
%------------------------------------------------------------------------------
% 2. call model setup & reduction program
%------------------------------------------------------------------------------
[T,R,SteadyState,info] = dynare_resolve(bayestopt_.restrict_var_list,...
bayestopt_.restrict_columns,...
bayestopt_.restrict_aux);
[T,R,SteadyState,info] = dynare_resolve('restrict');
if info(1) == 1 || info(1) == 2 || info(1) == 5
fval = bayestopt_.penalty+1;
cost_flag = 0;

View File

@ -125,9 +125,7 @@ function [fval,llik,cost_flag,ys,trend_coeff,info] = DsgeLikelihood(xparam1,gend
%------------------------------------------------------------------------------
% 2. call model setup & reduction program
%------------------------------------------------------------------------------
[T,R,SteadyState,info] = dynare_resolve(bayestopt_.restrict_var_list,...
bayestopt_.restrict_columns,...
bayestopt_.restrict_aux);
[T,R,SteadyState,info] = dynare_resolve('restrict');
if info(1) == 1 || info(1) == 2 || info(1) == 5
fval = bayestopt_.penalty+1;
cost_flag = 0;

View File

@ -67,8 +67,10 @@ set_all_parameters(xparam1);
%------------------------------------------------------------------------------
% 2. call model setup & reduction program
%------------------------------------------------------------------------------
[T,R,SteadyState] = dynare_resolve(bayestopt_.smoother_var_list,...
bayestopt_.smoother_restrict_columns,[]);
oo_.dr.restrict_var_list = bayestopt_.smoother_var_list;
oo_.dr.restrict_columns = bayestopt_.smoother_restrict_columns;
[T,R,SteadyState] = dynare_resolve('restrict');
bayestopt_.mf = bayestopt_.smoother_mf;
if options_.noconstant
constant = zeros(nobs,1);

View File

@ -106,9 +106,8 @@ end
%------------------------------------------------------------------------------
% 2. call model setup & reduction program
%------------------------------------------------------------------------------
[T,R,SteadyState,info] = dynare_resolve(bayestopt_.restrict_var_list,...
bayestopt_.restrict_columns,...
bayestopt_.restrict_aux);
[T,R,SteadyState,info] = dynare_resolve('restrict');
if info(1) == 1 || info(1) == 2 || info(1) == 5
fval = bayestopt_.penalty+1;
cost_flag = 0;

View File

@ -124,9 +124,7 @@ M_.H = H;
%------------------------------------------------------------------------------
% 2. call model setup & reduction program
%------------------------------------------------------------------------------
[T,R,SteadyState,info] = dynare_resolve(bayestopt_.restrict_var_list,...
bayestopt_.restrict_columns,...
bayestopt_.restrict_aux);
[T,R,SteadyState,info] = dynare_resolve('restrict');
if info(1) == 1 | info(1) == 2 | info(1) == 5
fval = bayestopt_.penalty+1;
cost_flag = 0;

View File

@ -1,12 +1,10 @@
function [A,B,ys,info] = dynare_resolve(iv,ic,aux)
% function [A,B,ys,info] = dynare_resolve(iv,ic,aux)
function [A,B,ys,info] = dynare_resolve(mode)
% function [A,B,ys,info] = dynare_resolve(mode)
% Computes the linear approximation and the matrices A and B of the
% transition equation
%
% INPUTS
% iv: selected variables (observed and state variables)
% ic: state variables position in the transition matrix columns
% aux: indices for auxiliary equations
% mode: string 'restrict' returns restricted transition matrices
%
% OUTPUTS
% A: matrix of predetermined variables effects in linear solution (ghx)
@ -61,16 +59,15 @@ if nargin == 0
npred = oo_.dr.npred;
iv = (1:endo_nbr)';
ic = [ nstatic+(1:npred) endo_nbr+(1:size(oo_.dr.ghx,2)-npred) ]';
aux = oo_.dr.transition_auxiliary_variables;
k = find(aux(:,2) > npred);
aux(:,2) = aux(:,2) + nstatic;
aux(k,2) = aux(k,2) + oo_.dr.nfwrd;
else
iv = oo_.dr.restrict_var_list;
ic = oo_.dr.restrict_columns;
end
if nargout==1
A = kalman_transition_matrix(oo_.dr,iv,ic,aux,M_.exo_nbr);
A = kalman_transition_matrix(oo_.dr,iv,ic,M_.exo_nbr);
return
end
[A,B] = kalman_transition_matrix(oo_.dr,iv,ic,aux,M_.exo_nbr);
[A,B] = kalman_transition_matrix(oo_.dr,iv,ic,M_.exo_nbr);
ys = oo_.dr.ys;