Verified Commit 3ad654b9 authored by MichelJuillard's avatar MichelJuillard Committed by Stéphane Adjemian

Allowing for different number of periods in conditional_forecast_path.

Updated preprocessor submodule.
parent 39110b30
......@@ -8208,6 +8208,14 @@ variables between the first and last specified period. If an intermediate period
is not specified, a value of 0 is assumed. That is, if you specify only
values for periods 1 and 3, the values for period 2 will be 0. Currently, it is not
possible to have uncontrolled intermediate periods.
It is however possible to
have different number of controlled periods for different variables. In that
case, the order of declaration of endogenenous controlled variables and of
controlled_varexo matters: if the second endogenous variable is controlled for
less periods than the first one, the second controlled_varexo isn't set for
the last periods.
In case of the presence of @code{observation_trends}, the specified controlled path for
these variables needs to include the trend component. When using the @ref{loglinear} option,
it is necessary to specify the logarithm of the controlled variables.
......
......@@ -27,6 +27,10 @@ function [forcs, e]= mcforecast3(cL,H,mcValue,shocks,forcs,T,R,mv,mu)
% This is then solved to get:
% shocks_controlled_t=(y_t(controlled_vars_index)-(T*y_{t-1}(controlled_vars_index)+R(controlled_vars_index,uncontrolled_shocks_index)*shocks_uncontrolled_t)/R(controlled_vars_index,controlled_shocks_index)
%
% Variable number of controlled vars are allowed in different
% periods. Missing control information are indicated by NaN in
% y_t(controlled_vars_index).
%
% After obtaining the shocks, and for uncontrolled periods, the state-space representation
% y_t=T*y_{t-1}+R*shocks(:,t)
% is used for forecasting
......@@ -51,8 +55,10 @@ function [forcs, e]= mcforecast3(cL,H,mcValue,shocks,forcs,T,R,mv,mu)
if cL
e = zeros(size(mcValue,1),cL);
for t = 1:cL
e(:,t) = inv(mv*R*mu)*(mcValue(:,t)-mv*T*forcs(:,t)-mv*R*shocks(:,t));
forcs(:,t+1) = T*forcs(:,t)+R*(mu*e(:,t)+shocks(:,t));
% missing conditional values are indicated by NaN
k = find(isfinite(mcValue(:,t)));
e(k,t) = inv(mv(k,:)*R*mu(:,k))*(mcValue(k,t)-mv(k,:)*T*forcs(:,t)-mv(k,:)*R*shocks(:,t));
forcs(:,t+1) = T*forcs(:,t)+R*(mu(:,k)*e(k,t)+shocks(:,t));
end
end
for t = cL+1:H
......
Subproject commit fbeae9619ab9603410a11a11af92a7dfeea0af81
Subproject commit 680fb72d0dcb15ea4831fc9dd71acb04661d9519
Markdown is supported
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