I encountered a strange (at least to me) problem while calculating bond price using dynare. I hope someone can tell me what I am doing wrong.

rbn0_1 = 1/ (beta*mu(+1)/mu * (1/pi(+1)))

The code above is how I calculate the short-term nominal interest rate using the stochastic discounted factor and tomorrow’s inflation. (nominal SDF = real SDF / tomorrow’s inflation).

I also tried to define SDF explicitly in the dynare and tried the same thing,

What you describe in your post is perfectly equivalent and will return the same results. However, what you do in your mod-file is not what you describe.
You have

test_sdf = 1/(sdf(+1)/pi(+1));
which in Dynare means

test_sdf =E_t 1/(sdf(+1)/pi(+1))];
because there is a conditional expectation around every equation. You also have

vbn0_1= (bet*mu(+1)/mu)*(1/pi(+1));
rbn0_1= vbn0_1^(-1);
which is

vbn0_1= E_t(bet*mu(+1)/mu)*(1/pi(+1))];
rbn0_1= vbn0_1^(-1);
Note that there is no expected value in the last line because everything is dated time t and therefore in the information set. For that reason

rbn0_1= (E_t(bet*mu(+1)/mu)*(1/pi(+1))])^(-1);
As you can clearly see, the conditional expectations is now in the denominator only, while for test_sdf it is around everything.

Thank you for your answer. Now I see what was wrong!

Leo.

[quote=“jpfeifer”]What you describe in your post is perfectly equivalent and will return the same results. However, what you do in your mod-file is not what you describe.
You have

test_sdf = 1/(sdf(+1)/pi(+1));
which in Dynare means

test_sdf =E_t 1/(sdf(+1)/pi(+1))];
because there is a conditional expectation around every equation. You also have

vbn0_1= (bet*mu(+1)/mu)*(1/pi(+1));
rbn0_1= vbn0_1^(-1);
which is

vbn0_1= E_t(bet*mu(+1)/mu)*(1/pi(+1))];
rbn0_1= vbn0_1^(-1);
Note that there is no expected value in the last line because everything is dated time t and therefore in the information set. For that reason

rbn0_1= (E_t(bet*mu(+1)/mu)*(1/pi(+1))])^(-1);
As you can clearly see, the conditional expectations is now in the denominator only, while for test_sdf it is around everything.[/quote]