# How to find average of future expected consumptions?

Dear DSGE experts,

## Below is my simple dynare code for RBC.

``````model(linear);
-c=-c(+1)+beta/lambda*theta*yok*(y(+1)-k);
c+1/(1-hbar)*h=y;
coy*c+lambda/yok*k=y+(1-delta)/yok*k(-1);
y=z+theta*k(-1)+(1-theta)*h;
iok*i=lambda*k-(1-delta)*k(-1);
z=rho*z(-1)+ez;``````

I’d like to add some lines to calculate average of today and future path of consumptions (4 horizon). In other words, I’d like to calculate

1/4*E_t(c_t + c_t+1 + c_t+2 + c_t+3) for all t (given realized innovation at t).

Since solving DSGE model actually means deciding sequence of today and future variables given today’s information, I thought I would easily find how to do this. So I did check dynare user guide and reference, but couldn’t find how to do that, even though it looks quite simple.

Is there any one who can teach me how to do this?

Regards,
Leo

Why can’t you use a new variable

?

Dear Jpfeifer,

Thank you very much. Actually I’d like to average +1 to +40, so I’m wondering whether I may use a loop in the model section as follows.

```for i=1:40 tv_c = tv_c + c(+i); end av_c = tv_c/40;```

Regards,

Yong O Kwon

You need to use the macro-language to program such a loop. See the bkk.mod for an example. It should be something along the lines of

```tv_c=c @# for lead in 1:39 +c@(+@{lead}) @# endfor ; av_c = tv_c/40;```