Expectation of function,vs,function of expectations

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.

Expectation of function,vs,function of expectations

Postby hewei2004 » Thu Feb 09, 2012 1:32 am

Hi,

I am using dynare++ 4.2.4, however I am confused as to how dynare++ handle the expectations of functions.
This is not a deterministic model and I wish to use order 3.

Suppose that I have the following:
Et[Mt+1*Rt+1]=1
let mt+1=log(Mt+1), rt+1=log(rt+1)
Then we have: Et[exp([mt+1]+[rt+1])=1

Question A , how do I write the above equation in dynare++?
If I write in model statement that 1=exp(m(+1)+r(+1)), how do I know if dynare++ will interpret it as
Et[exp{[mt+1]+[rt+1]}=1, versus, exp{Et[mt+1]+Et[rt+1]=1

Question B, a related question is, in general, how do I unambiguously tell dynare++ , that for a function of variable xt+1, I want f(Et(xt+1))=1 and not Et(f(xt+1))=1

Thank you.
hewei2004
 
Posts: 40
Joined: Thu Feb 09, 2012 1:07 am

Re: Expectation of function,vs,function of expectations

Postby jpfeifer » Thu Feb 09, 2012 9:40 am

As far as I know, Dynare always has an implicit conditional expectations operator at the beginning of each equation, i.e. E_t(f(x_{t+1}))=E_t(1). If you want a function of an expectations operator, i.e. f(E_t(x_{t+1}))=1 , you need to add an auxiliary variable:
http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=3417
------------
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: Expectation of function,vs,function of expectations

Postby hewei2004 » Fri Feb 10, 2012 6:28 am

The auxiliary variable is not needed except if you want to have the expectation of x_{t+1}^y inside a non linear function. For instance if in your model
you have something like

u(E_t[x_{t+1}^y]) = 0;

where u is a non linear function, then you just need to defin the auxiliary variable z as you propose and to rewrite the equation as

u(z(1)) = 0;

Best,
Stéphane.



Thank you for your link.
As Stéphane pointed out, no need for aux variable unless u is non linear, and in this case u(E_t[x_{t+1}^y]) = 0 is to be written as u(z(1)) = 0, with an aux variable z.

I now have a feeling of what is going on, but I still yearn for a very explict rule, can you please resolve directly how to write following?
1.Et[f(x(t+1))]
2.f(Et[(x(t+1))])
where f is non-linear
and
3.If I understand correctly, the starting point is the steady state in non-stochastic-case, but the final result is in steady state of stochastic-case. Will either 1 or 2 or both 1and2 make the approximation 'bad' around steady state in stochastic case? I use order=3 in models with exogenous shocks in dynare++ 4.2.4.

Thanks
hewei2004
 
Posts: 40
Joined: Thu Feb 09, 2012 1:07 am

Re: Expectation of function,vs,function of expectations

Postby jpfeifer » Fri Feb 10, 2012 8:13 am

The point of Stephane is that the expectations operator is a linear operator. Hence, if the function u is a linear function,
u(E_t[x_{t+1}^y]) = 0 is equal to E_t(u(x_{t+1}^y))=0.
But as he said, only if u is linear. E.g. say u(z)= alpha+betta*z. Then u(x_{t+1}^y)=alpha+betta*x_{t+1}^y. Thus,
E_t (alpha+betta*x_{t+1}^y)= alpha+betta*E_t(x_{t+1}^y).
But if u is non-linear, you cannot pull the expectations inside and need an auxiliary variable.
1. would be written as f(x(1)).
2. would be written as f(z) with an auxiliary variable z=x(1)^y

By the way, note that Stéphane's answer has the wrong timing for z. Due to the conditional expectations at time t, z belongs to the information set at time t.

Regarding 3: if f is non-linear, only the second version will deliver a correct approximation at order 2 or higher. The reason is that with 1 you ignore Jensen's Inequality and get a linear approximation.
------------
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: Expectation of function,vs,function of expectations

Postby hewei2004 » Fri Feb 10, 2012 9:41 am

How to enter Jensen's term correctly
by findoc » Fri Feb 11, 2011 6:16 am

Hello,

I am working with Epstein-Zin utilities, and I would like to have a term of the form

(E_t(X_{t+1}^alpha))^(beta)

Is the correct way to define Y_t = E_t(X_{t+1}^alpha) and then use Y_t^beta?

Thanks for all the help.

Re: How to enter Jensen's term correctly
by ian_db » Tue Feb 15, 2011 4:57 pm

That's one way to do it. Rudebusch and Swanson in the papers on bond pricing use this method. To be honest, I don't really trust this setup. If you use Dynare's approximation to try to get the SDF, it gives pretty poor results. The problem is that you're approximating around the nonstochastic steady state, but for the risk-adjusted continuation value, you really need to be at a different point. I usually use other methods, e.g. projection. I'm currently getting nice results using the generalized stochastic simulation algorithm proposed in judd, maliar, and maliar (2010).



Thank you jpfeifer, for the brilliant reply. However Ian's quote points out that dynare is not good at handling equation 2. that is, to write out the theoretical model f(Et[(x(t+1))]) as f(z) with z=x(1)^y.
Does Ian's quote points out that dynare++ (stochastic, order >2) cannot handle the scenario of f(Et[(x(t+1))]) very well?
hewei2004
 
Posts: 40
Joined: Thu Feb 09, 2012 1:07 am

Re: Expectation of function,vs,function of expectations

Postby jpfeifer » Fri Feb 10, 2012 9:49 am

I don't agree with Ian's statement. Using Dynare (and by extension Dynare++), I am able to essentially replicate the findings in
http://ideas.repec.org/p/nbr/nberwo/15026.html, suggesting that it works perfectly well.
------------
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 5 guests