A Problem of Writting Equations 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.

A Problem of Writting Equations in Dynare

Postby Peter Xiong » Thu Mar 16, 2017 7:08 am

Dear All,

I got a problem when writting equations in dynare. I will show as folows,

#Omega=beta*(C-zeta0*L^(1+zeta)/(1+zeta) )/(C(+1)-zeta0*(L(+1))^(1+zeta)/(1+zeta))*(1-sigma+sigma*psi(+1));
mu=Omega*((rk(+1)+(1-delta)*Q(+1))/Q-(1+tauK)*R(+1));

Here i have two choies, one is writting the ''Omega'' as auxiliary variable and add the sign of ''#'', this is the same with Substituting omega into the next equation. The other choice is writting ''Omega'' as an endogeneous variable.

I found that the simulation result is very different with these two choies.

Please help me with this problem.

Thnak you very much!

Peter
Peter Xiong
 
Posts: 5
Joined: Thu Mar 16, 2017 6:46 am

Re: A Problem of Writting Equations in Dynare

Postby jpfeifer » Thu Mar 16, 2017 7:52 am

I am not really following here. Model-local variable (the ones with #) only exist within the context of the model, because whenever the model-local variable is encountered, the expression for it is substituted. This is exactly what you describe. So there must be something else going on.
------------
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: A Problem of Writting Equations in Dynare

Postby Peter Xiong » Fri Mar 17, 2017 1:39 am

jpfeifer wrote:I am not really following here. Model-local variable (the ones with #) only exist within the context of the model, because whenever the model-local variable is encountered, the expression for it is substituted. This is exactly what you describe. So there must be something else going on.

I mean there is two situations, one is, I write Omega with #, and the other situation is I write Omega without # and regard it as an endogeneous variable and declare it in ''var'' part.

The problem is, I found the result is very different between these two situations.

Can you help me with this problem. Thank you very much !
Peter Xiong
 
Posts: 5
Joined: Thu Mar 16, 2017 6:46 am

Re: A Problem of Writting Equations in Dynare

Postby jpfeifer » Fri Mar 17, 2017 8:02 am

As I said, this should not happen. Please provide the files to replicate the issue.
------------
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: A Problem of Writting Equations in Dynare

Postby Peter Xiong » Fri Mar 17, 2017 8:51 am

jpfeifer wrote:As I said, this should not happen. Please provide the files to replicate the issue.


This is the fle.

Thnak you very much.
Attachments
ABK-copy.zip
(36.21 KiB) Downloaded 40 times
Peter Xiong
 
Posts: 5
Joined: Thu Mar 16, 2017 6:46 am

Re: A Problem of Writting Equations in Dynare

Postby jpfeifer » Fri Mar 17, 2017 9:23 am

I cannot spot any differences. What do you I have to do to see the problem?
------------
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: A Problem of Writting Equations in Dynare

Postby Peter Xiong » Fri Mar 17, 2017 9:35 am

jpfeifer wrote:I cannot spot any differences. What do you I have to do to see the problem?


Change the parameter ''omega_taustar'' (in line 73)form 0 to 0.01, by two different situations, and see the last result,i.e. oo_.mean(26).

With ''#'', ''omega_taustar'' form 0 to 0.01, the oo_.mean(26) decrease. And without ''#'', when ''omega_taustar'' form 0 to 0.01, the oo_.mean(26) increase.
Peter Xiong
 
Posts: 5
Joined: Thu Mar 16, 2017 6:46 am

Re: A Problem of Writting Equations in Dynare

Postby jpfeifer » Mon Mar 20, 2017 10:37 am

There is a good reason for this and it involves i)Jensen's Inequality, ii) auxilary variables, and iii) the convention that there is a conditional expectation around every single equation you enter into Dynare.

What you have in your problem is basically an Euler equation with Omega being the stochastic discount factor. Say the SDF between t and t+1 is given by the standard
Code: Select all
Omega=beta*(C(+1)/C)^(-sigma)

What you want to evaluate is
Code: Select all
mu=E_t(SDF_{t,t+1} R_{t+1});

Note that the SDF depends on things not yet known at time t and that the pricing kernel involves a conditional expectation as of time t around the product of SDF and future return. This implies that at higher order, the covariance between the SDF and the return plays a role for pricing the asset. With your model-local variable, you get exactly the above expression, because whenever the SDF is encountered, it is substituted in. When you have
Code: Select all
#Omega=beta*(C(+1)/C)^(-sigma)
mu=Omega*R(+1)

this is equal to
Code: Select all
mu=E_t(beta*(C(+1)/C)^(-sigma)*R(+1))

where the E_t comes from the Dynare convention that there is a conditional expectation around every line.

Now consider your definition of Omega as a separate auxiliary variable
Code: Select all
Omega=beta*(C(+1)/C)^(-sigma)
mu=Omega*R(+1)

The first line tells Dynare that
Code: Select all
Omega=E_t(beta*(C(+1)/C)^(-sigma))

This means Omega is not an expression anymore, but the conditional expectation of the SDF as of time t, which is not random anymore. Substituting this into the pricing equation gives
Code: Select all
mu=E_t(E_t(beta*(C(+1)/C)^(-sigma))*R(+1))=E_t(beta*(C(+1)/C)^(-sigma))*E_t(R(+1))

which is very different from before, because now Jensen's Inequality does not apply anymore and the covariance drops out.
------------
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: A Problem of Writting Equations in Dynare

Postby Peter Xiong » Mon Mar 20, 2017 11:27 am

jpfeifer wrote:There is a good reason for this and it involves i)Jensen's Inequality, ii) auxilary variables, and iii) the convention that there is a conditional expectation around every single equation you enter into Dynare.

What you have in your problem is basically an Euler equation with Omega being the stochastic discount factor. Say the SDF between t and t+1 is given by the standard
Code: Select all
Omega=beta*(C(+1)/C)^(-sigma)

What you want to evaluate is
Code: Select all
mu=E_t(SDF_{t,t+1} R_{t+1});

Note that the SDF depends on things not yet known at time t and that the pricing kernel involves a conditional expectation as of time t around the product of SDF and future return. This implies that at higher order, the covariance between the SDF and the return plays a role for pricing the asset. With your model-local variable, you get exactly the above expression, because whenever the SDF is encountered, it is substituted in. When you have
Code: Select all
#Omega=beta*(C(+1)/C)^(-sigma)
mu=Omega*R(+1)

this is equal to
Code: Select all
mu=E_t(beta*(C(+1)/C)^(-sigma)*R(+1))

where the E_t comes from the Dynare convention that there is a conditional expectation around every line.

Now consider your definition of Omega as a separate auxiliary variable
Code: Select all
Omega=beta*(C(+1)/C)^(-sigma)
mu=Omega*R(+1)

The first line tells Dynare that
Code: Select all
Omega=E_t(beta*(C(+1)/C)^(-sigma))

This means Omega is not an expression anymore, but the conditional expectation of the SDF as of time t, which is not random anymore. Substituting this into the pricing equation gives
Code: Select all
mu=E_t(E_t(beta*(C(+1)/C)^(-sigma))*R(+1))=E_t(beta*(C(+1)/C)^(-sigma))*E_t(R(+1))

which is very different from before, because now Jensen's Inequality does not apply anymore and the covariance drops out.


I get it. Thank you very much, professor jpfeifer!
Peter Xiong
 
Posts: 5
Joined: Thu Mar 16, 2017 6:46 am


Return to Dynare help

Who is online

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