How to find average of future expected consumptions?

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

How to find average of future expected consumptions?

Postby leolee » Thu Mar 19, 2015 10:18 am

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
leolee
 
Posts: 30
Joined: Thu Mar 19, 2015 9:54 am

Re: How to find average of future expected consumptions?

Postby jpfeifer » Thu Mar 19, 2015 1:07 pm

Why can't you use a new variable
Code: Select all
av_c=1/4*(c+c(+1)+c(+2)+c(+3))

?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: How to find average of future expected consumptions?

Postby leolee » Fri Mar 27, 2015 7:22 pm

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
leolee
 
Posts: 30
Joined: Thu Mar 19, 2015 9:54 am

Re: How to find average of future expected consumptions?

Postby jpfeifer » Sat Mar 28, 2015 7:47 am

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;
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 10 guests