E(XY) vs E(X)*E(Y) 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.

E(XY) vs E(X)*E(Y) in dynare?

Postby leolee » Wed Oct 19, 2016 11:30 am

Dear members,

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.

Code: Select all
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,

Code: Select all
 sdf = beta*mu/mu(-1);
sdf_test = 1/ (sdf(+1) * (1/pi(+1));


I expected
Code: Select all
rbn0_1
and
Code: Select all
sdf_test
gives the same result, but they didn't. (They have different theoretical mean provided by the dynare.)

I really hope someone let me know what I have done wrong.

** I attached the full code.

Best,
Leo
Attachments
DPSW_WP_1.mod
(13.19 KiB) Downloaded 75 times
leolee
 
Posts: 30
Joined: Thu Mar 19, 2015 9:54 am

Re: E(XY) vs E(X)*E(Y) in dynare?

Postby jpfeifer » Wed Oct 19, 2016 3:19 pm

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
Code: Select all
test_sdf   = 1/(sdf(+1)/pi(+1));

which in Dynare means
Code: Select all
test_sdf   =E_t [ 1/(sdf(+1)/pi(+1))];

because there is a conditional expectation around every equation. You also have
Code: Select all
vbn0_1= (bet*mu(+1)/mu)*(1/pi(+1));
rbn0_1= vbn0_1^(-1);

which is
Code: Select all
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
Code: Select all
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.
------------
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: E(XY) vs E(X)*E(Y) in dynare?

Postby leolee » Wed Oct 19, 2016 3:32 pm

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

Leo.

jpfeifer wrote: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
Code: Select all
test_sdf   = 1/(sdf(+1)/pi(+1));

which in Dynare means
Code: Select all
test_sdf   =E_t [ 1/(sdf(+1)/pi(+1))];

because there is a conditional expectation around every equation. You also have
Code: Select all
vbn0_1= (bet*mu(+1)/mu)*(1/pi(+1));
rbn0_1= vbn0_1^(-1);

which is
Code: Select all
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
Code: Select all
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.
leolee
 
Posts: 30
Joined: Thu Mar 19, 2015 9:54 am


Return to Dynare help

Who is online

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