# A Problem of Writting Equations in Dynare

Dear All,

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

#Omega=beta*(C-zeta0L^(1+zeta)/(1+zeta) )/(C(+1)-zeta0(L(+1))^(1+zeta)/(1+zeta))(1-sigma+sigmapsi(+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.

Thnak you very much!

Peter

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 ！

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

This is the fle.

Thnak you very much.
ABK-copy.zip (36.2 KB)

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.

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

``Omega=beta*(C(+1)/C)^(-sigma)``

What you want to evaluate is

``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

``````#Omega=beta*(C(+1)/C)^(-sigma)
mu=Omega*R(+1)``````

this is equal to

``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

```Omega=beta*(C(+1)/C)^(-sigma) mu=Omega*R(+1) ```
The first line tells Dynare that

``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

``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！