Policy Function: Forward- and Backward-Looking Variables

Hi there,

I have a question about oo_.dr

Consider Schmidt-Grohe & Uribe (2004, JEDC) paper. Now consider a variable that is both forward- and backward-looking as opposed to purely forward-looking (i.e. jumper) or a purely backward-looking (i.e. state). If the model contains such variables, then what is the state-space representation of the first-order approximation to the model?

The easiest example of the code is the SGU(2003) “Closing Small Open Economy Models”, which is replicated by Johannes Pfeifer on GitHub (see below for a cleaned up version of 1/5 models in the code). Because of the capital adjustment costs, capital stock is not just a state variable, but also a control variable. I’m confused about how the partial derivatives are computed for such mixed variables.

Specifically, usually 1st-order approximation looks like this:

f_y’ * y(+1) + f_y * y + f_x’ x(+1) * f_x * x = 0,

where y is a vector of static or jumper variables, while x is a vector of endogenous and exogenous state variables. If the code contains k, k(+1), and k(+2), then does k(+1) enter x(+1) or simply y?

d % (1) net international investment position (NIIP)
r % (2) real rate of interest
k % (3) capital stock at date t
i % (4) investment
y % (5) output
w % (6) real wage
z % (7) rental rate of capital
c % (8) real consumption expenditure
lambda % (9) marginal utility of consumption
tb % (10) trade balance / output
ca % (11) current account / output
a % (12) total factor productivity (TFP)
h % (13) hours of labour



d_0 % (1) initial NIIP
beta % (2) time preference
delta % (3) capital depreciation rate
gamma % (4) external debt-elasticity of interest rate (EDEIR)
alpha % (5) capital share of income
rho % (6) persistence of TFP shocks
sigma % (7) std. of TFP shocks
varsigma % (8) elasticity of inter-temporal substitution
varphi % (9) Frisch elasticity of labour supply
chi % (10) convexity of quadratic capital adjustment costs

d_0 = 0.7442;
beta = 1/1.04;
alpha = 0.32;
delta = 0.1;
gamma = 0.000742;
rho = 0.42;
sigma = 0.0129;
varsigma = 0.5;
varphi = 1.455;
chi = 0.028;

1 = ( exp(z(+1)) + 1 - delta + chi * (exp(k(+2))-exp(k(+1))) ) / ( (1 + exp(r(+1))) * (1 + chi * (exp(k(+1))-exp(k))) );
exp(lambda) = beta * (1+exp(r(+1))) * exp(lambda(+1));
exp(lambda) = (exp( c )-((exp(h)^varphi)/varphi))^(-1/varsigma);
exp(w) = exp(h)^(varphi-1);
exp(w) = (1-alpha) * exp(y) / exp(h);
exp(z) = alpha * exp(y) / exp(k);
exp(i) = exp(k(+1))-(1-delta) * exp(k);
exp(y) = exp(a) * (exp(k)^alpha) * (exp(h)^(1-alpha));
exp(r(+1)) = 1/beta - 1 + gamma * (exp(d(+1)-d_0)-1);
d(+1) = ( 1 + exp( r ) ) * d - exp(y) + exp( c ) + exp(i) + (chi/2) * (exp(k(+1)) - exp(k))^2;
tb = 1-((exp( c )+exp(i)+(chi/2) * (exp(k(+1))-exp(k))^2)/exp(y));
ca = (1/exp(y)) * (d-d(+1));
a = rho * a(-1)+sigma *eps;

d = d_0;
r = log(1/beta - 1);
h = log(((1-alpha) * (alpha/(1/beta-1+delta))^(alpha/(1-alpha)))^(1/(varphi-1)));
k = log(exp(h) / (((1/beta-1+delta)/alpha)^(1/(1-alpha))));
y = log((exp(k)^alpha) * (exp(h)^(1-alpha)));
z = log(alpha * exp(y) / exp(k));
w = log((1-alpha) * exp(y) / exp(h));
i = log(delta * exp(k));
c = log(exp(y)-exp(i)-exp( r ) * d);
tb = 1-((exp( c )+exp(i))/exp(y));
lambda = log((exp( c )-((exp(h)^varphi)/varphi))^(-1/varsigma));
a = 0;
ca = 0;


var eps; stderr 1;

stoch_simul(order=1, irf=0, noprint, nograph);

% Report results from Table 3

fprintf(’\nstd(y): \t %2.1f \n’,sqrt(oo_.var(y_pos,y_pos))*100)
fprintf(‘std©: \t %2.1f \n’,sqrt(oo_.var(c_pos,c_pos))*100)
fprintf(‘std(i): \t %2.1f \n’,sqrt(oo_.var(i_pos,i_pos))*100)
fprintf(‘std(h): \t %2.1f \n’,sqrt(oo_.var(h_pos,h_pos))*100)
fprintf(‘std(tb/y): \t %2.1f \n’,sqrt(oo_.var(tb_y_pos,tb_y_pos))*100)
if ~isempty(ca_y_pos)
fprintf(‘std(ca/y): \t %2.1f \n’,sqrt(oo_.var(ca_y_pos,ca_y_pos))*100)
else %complete markets case
fprintf(‘std(ca/y): \t %2.1f \n’,sqrt(oo_.var(ca_y_pos,ca_y_pos))*100)
fprintf(‘corr(y_t,y_t-1): \t %3.2f \n’,oo_.autocorr{1}(y_pos,y_pos))
fprintf(‘corr(c_t,c_t-1): \t %3.2f \n’,oo_.autocorr{1}(c_pos,c_pos))
fprintf(‘corr(i_t,i_t-1): \t %4.3f \n’,oo_.autocorr{1}(i_pos,i_pos))
fprintf(‘corr(h_t,h_t-1): \t %3.2f \n’,oo_.autocorr{1}(h_pos,h_pos))
fprintf(‘corr(tb/y_t,tb/y_t-1): \t %3.2f \n’,oo_.autocorr{1}(tb_y_pos,tb_y_pos))
if ~isempty(ca_y_pos)
fprintf(‘corr(ca/y_t,ca/y_t-1): \t %3.2f \n’,oo_.autocorr{1}(ca_y_pos,ca_y_pos))
else %complete markets case
fprintf(‘corr(ca/y_t,ca/y_t-1): \t %3.2f \n’,NaN)
fprintf(‘corr(c_t,y_t): \t %3.2f \n’,oo_.gamma_y{1}(c_pos,y_pos)/sqrt(oo_.var(c_pos,c_pos)*oo_.var(y_pos,y_pos)))
fprintf(‘corr(i_t,y_t): \t %3.2f \n’,oo_.gamma_y{1}(i_pos,y_pos)/sqrt(oo_.var(i_pos,i_pos)*oo_.var(y_pos,y_pos)))
fprintf(‘corr(h_t,y_t): \t %2.1f \n’,oo_.gamma_y{1}(h_pos,y_pos)/sqrt(oo_.var(h_pos,h_pos)*oo_.var(y_pos,y_pos)))
fprintf(‘corr(tb/y_t,y_t): \t %4.3f \n’,oo_.gamma_y{1}(tb_y_pos,y_pos)/sqrt(oo_.var(tb_y_pos,tb_y_pos)*oo_.var(y_pos,y_pos)))
if ~isempty(ca_y_pos)
fprintf(‘corr(ca/y_t,y_t): \t %4.3f \n’,oo_.gamma_y{1}(ca_y_pos,y_pos)/sqrt(oo_.var(ca_y_pos,ca_y_pos)*oo_.var(y_pos,y_pos)))
else %complete markets case
fprintf(‘corr(ca/y_t,y_t): \t %4.3f \n’,NaN)

% generate impulse response functions in fig. 1
var eps; stderr 1/sigma; % normalize to 1 percent shock

stoch_simul(order=1, irf=10, nograph);

I am not sure I understand the question, but if you are facing a model with mixed variable types and you want to write down the model in the form of a state space system with exactly one lead/lag for each variable, then you need to introduce auxiliary variables.

Thanks for a prompt reply! Yes, you are correct, that is exactly what I’m looking for. Is there a reference or any notes that I could have a look at, which would explain how exactly are such auxiliary variables introduced? Many thanks.


The state space representation will still be the solution to the linear(ized) system of expectational difference equations which describe the temporary equilibrium of the economy at a point in time. So it will still have the form

\begin{align} x_{t+1}&=h_{x}x_{t} + \eta\varepsilon_{t+1}\\ y_{t}&=g_{x}x_{t} \end{align}


In any given time period a variable is either a state or a control. But the same variable at different time periods can be either. The capital stock is a good example regardless of whether there are capital adjustment costs. With “end of period notation” (default in Dynare) we usually have K_{t-1} as an endogenous state variable and K_{t} as an endogenous control variable in period t. Other common examples would include e.g. consumption with habit formation, investment with investment adjustment costs, and many more.

The code you posted specifies the predetermined variables to be consistent with how many authors have chosen to write such variables with “beginning of period notation” in which case K_{t} is predetermined in period t and K_{t+1} is determined within period t.


Assuming these k are the capital stock at the beginning of period t then k=K_{t}, k(+1)=K_{t+1}, and k(+2)=K_{t+2}, then K_{t} is a state variable in period t while K_{t+1} is a control; K_{t+1} is a state variable in period t+1 while K_{t+2} is a control.

SGU define y_{t} as “a vector collecting the time t control variables” which are “endogenous variables that are determined in period t”. They define x_{t}=[x^{1'}_{t}\ x^{2'}_{t}]' as a “vector of state variables” where x^{1'}_{t} are “endogenous state variables in period t” which are “endogenous variables determined before period t”.

Stringing this together it should be the case that K_{t}\in x_{t} and K_{t+1}\in y_{t}, which further implies K_{t+1}\in X_{t+1} and K_{t+2}\in y_{t+1}. Again, this is regardless of whether there are capital adjustment costs or not, which matters for the elements of the matrices f_{y},f_{y'},f_{x} and f_{x'} which collectively describe the temporary equilibrium since in that case K_{t+2} will enter time t behavioral rules directly.


You might find Chris Sims’ documentation for solving linear RE models http://sims.princeton.edu/yftp/gensys/LINRE3A.pdf useful for thinking about incorporating auxiliary variables in general. The example given on pages 2 and the subsequent discussion on pages 3 and 4 will be particularly helpful in thinking about the SGU and Dynare approaches which require separately designating the jumpers and states.

Thank you so much, Brian! This is very helpful.

My main confusion was related to point (3). I was not sure how to assign k_{t+1} to either x_{t+1} or y_t, but it appears that it’s actually both. And it seems to be consistent with the usual state-space representation that you’ve outlined, so long as we add another equation \mathbb{E}[k_{t+1}]=k_{t+1}. I did look at the original SGU code prior to posting here, and I did see that they have such an “auxiliary equation”, but at the time I didn’t really understand it’s purpose (see equation (14) in SGU code). I’m now looking at Christopher Sims’ notes and see that this is perhaps what Johannes meant by auxiliary variables.

It makes more sense now, thanks!

Exactly. You need to have one variable storing k being a control and one variable for it being a state. That makes two define variables for k. To get as many equations as unknowns, you need an additional equation linking the two variables