Compute value function in Dynare

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.

Compute value function in Dynare

Postby Thisisusername » Mon Feb 17, 2014 7:42 pm

Hi All,

I'd like to ask is it possible compute the value function in Dynare? Say,
Value = log(C) + beta*Value(+1);

Of course with the FOC for C.

Thanks You!
Thisisusername
 
Posts: 4
Joined: Mon Feb 17, 2014 5:58 am

Re: Compute value function in Dynare

Postby jpfeifer » Tue Feb 18, 2014 6:26 am

Yes. When you have a running model with all FOCs, just enter this equation, which is a recursive definition of the value function. Dynare will then compute the approximated solution.

You should just be aware that this has nothing to do with the global solution technique of value function iteration.
------------
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: Compute value function in Dynare

Postby Thisisusername » Tue Feb 25, 2014 8:22 pm

Got it. Thanks a lot!
Thisisusername
 
Posts: 4
Joined: Mon Feb 17, 2014 5:58 am

Re: Compute value function in Dynare

Postby suxijian » Tue Jun 03, 2014 12:21 pm

Hi,Jpfeifer, I also have a similar problem with value function in Dynare. I release a new topic in the forum,could you look at my problem and give some instructions? Many thanks.

As you told Thisisusername, it seems that what I need to do is just write down the value function following the FOCs in the Dynare code? I input the code

Code: Select all
value=log(c)-theta*(h^(1+phi))/(1+phi)+beta*value(+1)


but the code is fail to run and the feedback is
[img]Starting Dynare (version 4.4.2).
Starting preprocessing of the model file ...
ERROR: sample.mod: line 23, cols 1-5: Unknown symbol: value

??? Error using ==> dynare at 174
DYNARE: preprocessing failed[/img]

I am not sure whether I have understand what you tell Thisisusername. Please take a look at it if you have the time.
suxijian
 
Posts: 6
Joined: Mon Jun 02, 2014 9:37 am

Re: Compute value function in Dynare

Postby Daniel Bendel » Wed Jun 04, 2014 4:15 pm

You have to declare a new variable in the var command which you call value in your case.

example:

value=log(c)-theta*(h^(1+phi))/(1+phi)+beta*value(+1)

then:
var value;

Otherwise dynare does not know your varibale "value" as indicated by the error message.
Germany, Cologne
Daniel Bendel
 
Posts: 134
Joined: Tue Nov 15, 2011 1:06 pm
Location: Cologne, Germany

Re: Compute value function in Dynare

Postby suxijian » Thu Jun 05, 2014 12:17 pm

Many thanks for you instructions. I have modified the code according to your suggestions, and I get the result. However, I still have confusions for the question.

When I run the code and get the results showed as below, do the results show that the value function is equal to -107.826288? It seems unreasonable. Can you look at the results and point out how to find the value? Here are the code and parts of the results:

POLICY AND TRANSITION FUNCTIONS
y c k a h b value
Constant 1.080953 0.803479 11.083988 0 0.291870 0 -107.826288
(correction) 0.000270 -0.000113 0.000383 0 0.000114 0 0.108131
k(-1) 0.005358 0.038542 0.941817 0 -0.012547 0 1.256982
a(-1) 1.836717 0.424583 1.419062 0.950000 0.341715 0.025000 29.193035
b(-1) 0.837086 -0.318740 1.419062 0.025000 0.341715 0.950000 18.213807
e 1.911522 0.456074 1.455448 1.000000 0.350477 0 30.245919
u 0.830840 -0.347518 1.455448 0 0.350477 1.000000 18.376483
k(-1),k(-1) -0.000693 -0.000620 -0.000072 0 0.000640 0 -0.032006
a(-1),k(-1) 0.031013 0.011201 0.018983 0 -0.005454 0 -0.620228
a(-1),a(-1) 1.354840 0.198327 1.191903 0 0.113219 0 5.826632
b(-1),k(-1) 0.026057 -0.024450 0.018983 0 -0.005454 0 -0.620228
b(-1),a(-1) 1.010716 0.003915 2.383805 0 0.226438 0 11.653263
b(-1),b(-1) 0.118206 0.149375 1.191903 0 0.113219 0 5.826632
e,e 1.473867 0.220058 1.253809 0 0.119100 0 6.129264
u,e 1.036212 -0.015958 2.507619 0 0.238199 0 12.258528
u,u 0.102686 0.165780 1.253809 0 0.119100 0 6.129264
k(-1),e 0.031946 0.012476 0.019470 0 -0.005594 0 -0.636131
k(-1),u 0.026588 -0.026065 0.019470 0 -0.005594 0 -0.636131
a(-1),e 2.826253 0.417711 2.444928 0 0.232244 0 11.952065
a(-1),u 0.989536 -0.006871 2.444928 0 0.232244 0 11.952065
b(-1),e 1.058095 -0.004158 2.444928 0 0.232244 0 11.952065
b(-1),u 0.221009 0.314583 2.444928 0 0.232244 0 11.952065


APROXIMATED THEORETICAL MOMENTS

VARIABLE MEAN STD. DEV. VARIANCE
y 1.0847 0.0897 0.0080
c 0.8065 0.0529 0.0028
k 11.1870 1.2603 1.5883
a -0.0000 0.0340 0.0012
h 0.2917 0.0119 0.0001
b -0.0000 0.0340 0.0012
value -107.7649 2.9169 8.5081
Attachments
sample.mod
(751 Bytes) Downloaded 56 times
suxijian
 
Posts: 6
Joined: Mon Jun 02, 2014 9:37 am

Re: Compute value function in Dynare

Postby Daniel Bendel » Thu Jun 05, 2014 3:25 pm

a negative value for the value is not unplausible and comes from the fact that you use a log-function for your utlity of consumption. Thus taking the log of a number smaller than 1 will result into a value that is negative.
Germany, Cologne
Daniel Bendel
 
Posts: 134
Joined: Tue Nov 15, 2011 1:06 pm
Location: Cologne, Germany

Re: Compute value function in Dynare

Postby suxijian » Sat Jun 07, 2014 7:05 am

Thank you for your explanation, and I will check about it.
suxijian
 
Posts: 6
Joined: Mon Jun 02, 2014 9:37 am


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 5 guests