Page 1 of 1

How to find average of future expected consumptions?

PostPosted: Thu Mar 19, 2015 10:18 am
by leolee
Dear DSGE experts,

Below is my simple dynare code for RBC.
--------
Code: Select all
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

Re: How to find average of future expected consumptions?

PostPosted: Thu Mar 19, 2015 1:07 pm
by jpfeifer
Why can't you use a new variable
Code: Select all
av_c=1/4*(c+c(+1)+c(+2)+c(+3))

?

Re: How to find average of future expected consumptions?

PostPosted: Fri Mar 27, 2015 7:22 pm
by leolee
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.

Code: Select all
for i=1:40
tv_c = tv_c + c(+i);
end
av_c = tv_c/40;


Regards,

Yong O Kwon

Re: How to find average of future expected consumptions?

PostPosted: Sat Mar 28, 2015 7:47 am
by jpfeifer
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

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