# How to write expectations of products?

Hi everyone,

I would like to clarify something that has bothered me for some time, and that has led to some discussions with colleagues: when I have the expectation of a product of variables, how should I write it in Dynare?
Say, for example, that my model has a condition that reads:

E_t [a_{t+1}*b_{t+1}] + c_t = 0

There are, in principle, two ways to write this condition in Dynare:

(i) Define the product as an auxiliary variable and write it as a forward looking variable

aux = a*b
aux(+1) + c = 0

(ii) Write the product of the forward looking variables

a(+1)*b(+1) + c = 0

I had always assumed that (i) would be the correct way to do it, but not only this seems to generate problems with the Blanchard-Kahn conditions (i.e. typically Dynare complaining that there are more EW’s>1 than fwd-looking variables, since Dynare is only recognizing the auxiliary variables as forward-looking), and most examples that are available (i.e. Jesus Fernandex-Villaverde’s codes) use method (ii).
I understand that (i) and (ii) should be completely equivalent for the purposes of a first-order approximation, but this may not necessarily be the case for higher order, right?

This may be a stupid question, but has left me (and other people) confused, so I would apprecitate if anyone could shed some light on this! Thanks!

The short answer is: because Dynare implicitly has a conditional expectations around each equation and the expectations operator in rational expectations models encloses the whole objective function, use (ii). At first order, it does not matter at. At second order, due to Jensen’s Inequality, using auxiliary variables may matter and is even sometimes desirable (e.g Epstein-Weil-Zin recursive preferences).

The long answer will get a short paper-length treatment in the near future, but I am not there yet.

[Final note: as far as I can see, the two specific cases you present should be perfectly equivalent, because the auxiliary variable is contemporaneous and enters linearly. Thus, it should not affect the BK conditions. Do you have a particular example in mind?]

I apologize, my comment on the BK conditions was inane for the reasons that you mention.

From what I understand from your answer, method (i) is preferable for higher order approximations, while methods (i) and (ii) are equivalent for first order.

I’m working with a stochastic model and running second-order approximations. I have an equation in my model stating that some return, let’s call it RA, which agents use to take a decision at time t, is a non-linear combination of two other future returns, RKH and RKF. On paper, I have something like RA = … E_t(RKH)… E_t(RKF).

jpfeifer wrote

Given the way Dynare handels expectations, if I would write,
RA= … RKH(+1) … RKF(+1)
it would not be the same as in my original equation due to Jensens inequality.

I would have to define instead two auxiliary variables
ERKH=RKH(+1);
ERKF=RKF(+1);
and then define
RA =… ERKH … ERKF;

Is this correct?

Hi,

You are correct. More generally, if you have an equation of the form: \varphi (\mathbb E_t [x_{t+1}]) = 0 and if you consider an order of approximation greater than one, then it would be wrong to write:

phi(x(1)) = 0


in the model block because Dynare will interpret it as \mathbb E_t [\varphi (x_{t+1})] = 0, since it takes the conditional expectation of the whole equation. In this case the correct way of specifying the equation in the model block is to write:

aux_x = x(1) ;
phi(x) = 0;


This kind of situations (with nonlinear transformations of conditional expectations) will arise, for instance, in equity premium models. See Equity Premium in Jermann 1998 and Otherwise.

Best,
Stéphane

Thank you very much!