v4.1: header + reindent
git-svn-id: https://www.dynare.org/svn/dynare/trunk@2684 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
d0c00a740b
commit
10f712268e
|
@ -17,7 +17,7 @@ function info = forecast(var_list,task)
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none
|
% none
|
||||||
|
|
||||||
% Copyright (C) 2003-2008 Dynare Team
|
% Copyright (C) 2003-2009 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -62,45 +62,45 @@ function info = forecast(var_list,task)
|
||||||
trend = 0;
|
trend = 0;
|
||||||
switch task
|
switch task
|
||||||
case 'simul'
|
case 'simul'
|
||||||
horizon = options_.periods;
|
horizon = options_.periods;
|
||||||
if horizon == 0
|
if horizon == 0
|
||||||
horizon = 5;
|
horizon = 5;
|
||||||
end
|
end
|
||||||
if size(oo_.endo_simul,2) < maximum_lag
|
if size(oo_.endo_simul,2) < maximum_lag
|
||||||
y0 = repmat(oo_.steady_state,1,maximum_lag);
|
y0 = repmat(oo_.steady_state,1,maximum_lag);
|
||||||
else
|
else
|
||||||
y0 = oo_.endo_simul(:,1:maximum_lag);
|
y0 = oo_.endo_simul(:,1:maximum_lag);
|
||||||
end
|
end
|
||||||
case 'smoother'
|
case 'smoother'
|
||||||
horizon = options_.forecast;
|
horizon = options_.forecast;
|
||||||
y_smoothed = oo_.SmoothedVariables;
|
y_smoothed = oo_.SmoothedVariables;
|
||||||
y0 = zeros(M_.endo_nbr,maximum_lag);
|
y0 = zeros(M_.endo_nbr,maximum_lag);
|
||||||
for i = 1:M_.endo_nbr
|
for i = 1:M_.endo_nbr
|
||||||
v_name = deblank(M_.endo_names(i,:));
|
v_name = deblank(M_.endo_names(i,:));
|
||||||
y0(i,:) = y_smoothed.(v_name)(end-maximum_lag+1:end)+oo_.dr.ys(i);
|
y0(i,:) = y_smoothed.(v_name)(end-maximum_lag+1:end)+oo_.dr.ys(i);
|
||||||
end
|
end
|
||||||
gend = options_.nobs;
|
gend = options_.nobs;
|
||||||
if isfield(oo_.Smoother,'TrendCoeffs')
|
if isfield(oo_.Smoother,'TrendCoeffs')
|
||||||
var_obs = options_.varobs;
|
var_obs = options_.varobs;
|
||||||
endo_names = M_.endo_names;
|
endo_names = M_.endo_names;
|
||||||
order_var = oo_.dr.order_var;
|
order_var = oo_.dr.order_var;
|
||||||
i_var_obs = [];
|
i_var_obs = [];
|
||||||
trend_coeffs = [];
|
trend_coeffs = [];
|
||||||
for i=1:size(var_obs,1)
|
for i=1:size(var_obs,1)
|
||||||
tmp = strmatch(var_obs(i,:),endo_names(i_var,:),'exact');
|
tmp = strmatch(var_obs(i,:),endo_names(i_var,:),'exact');
|
||||||
if ~isempty(tmp)
|
if ~isempty(tmp)
|
||||||
i_var_obs = [ i_var_obs; tmp];
|
i_var_obs = [ i_var_obs; tmp];
|
||||||
trend_coeffs = [trend_coeffs; oo_.Smoother.TrendCoeffs(i)];
|
trend_coeffs = [trend_coeffs; oo_.Smoother.TrendCoeffs(i)];
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
trend = trend_coeffs*(gend+(1-M_.maximum_lag:horizon));
|
trend = trend_coeffs*(gend+(1-M_.maximum_lag:horizon));
|
||||||
end
|
end
|
||||||
global bayestopt_
|
global bayestopt_
|
||||||
if isfield(bayestopt_,'mean_varobs')
|
if isfield(bayestopt_,'mean_varobs')
|
||||||
trend = trend + repmat(bayestopt_.mean_varobs,1,horizon+M_.maximum_lag);
|
trend = trend + repmat(bayestopt_.mean_varobs,1,horizon+M_.maximum_lag);
|
||||||
end
|
end
|
||||||
otherwise
|
otherwise
|
||||||
error('Wrong flag value')
|
error('Wrong flag value')
|
||||||
end
|
end
|
||||||
|
|
||||||
if M_.exo_det_nbr == 0
|
if M_.exo_det_nbr == 0
|
||||||
|
@ -110,9 +110,9 @@ function info = forecast(var_list,task)
|
||||||
if horizon > exo_det_length
|
if horizon > exo_det_length
|
||||||
ex = zeros(horizon,M_.exo_nbr);
|
ex = zeros(horizon,M_.exo_nbr);
|
||||||
oo_.exo_det_simul = [ oo_.exo_det_simul;...
|
oo_.exo_det_simul = [ oo_.exo_det_simul;...
|
||||||
repmat(oo_.exo_det_steady_state',...
|
repmat(oo_.exo_det_steady_state',...
|
||||||
horizon- ...
|
horizon- ...
|
||||||
exo_det_length,1)];
|
exo_det_length,1)];
|
||||||
%ex_det_length,1),1)];
|
%ex_det_length,1),1)];
|
||||||
elseif horizon < exo_det_length
|
elseif horizon < exo_det_length
|
||||||
ex = zeros(exo_det_length,M_.exo_nbr);
|
ex = zeros(exo_det_length,M_.exo_nbr);
|
||||||
|
|
Loading…
Reference in New Issue