Real business cycle in emerging countries

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.

Real business cycle in emerging countries

Postby ZBCPA » Wed Sep 23, 2015 3:57 am

Dear Johhanes,

Based on your dynare code of "Real business cycle in emerging countries", I change a little of the domestic interest rate function. Then I match the new code with another country's data. Using dynare 2015-08-16 edition,I think the estimation results look fine, except the following issues after mode finding:

Warning: Matrix is singular to working precision.
> In lyapunov_symm (line 151)
In dsge_likelihood (line 379)
In mode_check (line 143)
In dynare_estimation_1 (line 365)
In dynare_estimation (line 92)
In au (line 303)
In dynare (line 223)
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND
= NaN.
> In kalman_filter (line 182)
In dsge_likelihood (line 651)
In mode_check (line 143)
In dynare_estimation_1 (line 365)
In dynare_estimation (line 92)
In au (line 303)
In dynare (line 223)

Could help give me some advise to solve this problem?
Please find attached data and code files if you need.

Best regards,
Huan
Attachments
data and code.zip
data and code
(26.8 KiB) Downloaded 244 times
ZBCPA
 
Posts: 101
Joined: Sat May 16, 2015 4:15 am

Re: Real business cycle in emerging countries

Postby jpfeifer » Wed Sep 23, 2015 8:13 pm

Could you please explain what you changed?
------------
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: Real business cycle in emerging countries

Postby sfking » Thu Sep 24, 2015 8:17 am

Dear jpfeifer, I am from China, and could not access to your website, will you post your uribe2010AER code here? Thank you.
sfking
 
Posts: 6
Joined: Thu Nov 13, 2014 7:04 am

Re: Real business cycle in emerging countries

Postby ZBCPA » Sat Sep 26, 2015 5:04 am

sfking wrote:Dear jpfeifer, I am from China, and could not access to your website, will you post your uribe2010AER code here? Thank you.


Please find attached code written by Johannes Pfeifer.
Attachments
data_argentina.xls
(47 KiB) Downloaded 210 times
GarciaCiccoetal2010.mod
(11.47 KiB) Downloaded 206 times
ZBCPA
 
Posts: 101
Joined: Sat May 16, 2015 4:15 am

Re: Real business cycle in emerging countries

Postby ZBCPA » Sat Sep 26, 2015 9:54 am

jpfeifer wrote:Could you please explain what you changed?


Dear Johhanes,

I will try my best to explain it and hope will not make you feel confused due to my poor English.What I change to your original code is mainly the interest rate equation(financial friction model) and debt.

1. The orignal paper define interest rate in model : rt=rstar+psi*(exp(Dt+1/Xt-dbar)-1)+exp(mu-1)-1 , and Dt+1/Xt should be equal to dt+1,however the authers make Dt+1/Xt=dt in stead of dt+1 in their appendix. I guess this might be a typo,since Uribe and Schmitt-Grohe write a textbook "Open economy macroeconomics" which has not been published yet and in this text book Chapter 5, they correct the interest rate equation to make Dt+1/Xt=dt+1.

2. I do not know why they calibrate d=0.007. According to the original AER paper, it writes "We set the parameter dbar to induce a small steady-state trade balance to output ratio of about 0.25%, as observed on average in Argentina over the period 1900-2005" . I think the value of dbar is calculated from budget constraint at steady state.Howeve,budget constrain has tbbar and dbar at steady state, if both sides divided by ybar, we can get dbar/ybar is a function of tbbar/ybar,which might match the data TB/Y, here "bar"mean steady state value). So I put ybar in the interest rate equation .
At same time , I suppose tbbar/ybar(steady state of detrended TB/ steady state of detrended Y) equal to average TB/Y data value. Is this right? Otherwise we won't know the value of tbbar/ybar. In their textbook chapter 5 section 4 ,they use rt=rstar+psi*(exp((Dt+1/Xt-dbar)/ybar)-1) . And it seems that they also calibrate tbbar/ybar=average TB/Y data value.Since in my own data,trade blance to output raito on average is negative, then dbar/ybar (denote it to be d_share)would be negative, so I calibrate it to be d_share=-0.66(calculated from budget constraint)

So I write my code like the following(related to dbar part):
(1). My Interest Rate
Code: Select all
r = RSTAR + psi*(exp((log(d(+1))/ybar)-(dbar/ybar)) - 1)+exp(mu-1)-1;


compared to yours
Code: Select all
r = RSTAR + psi*(exp(d-dbar) - 1)+exp(mu-1)-1;


(2).My Trade balance
Code: Select all
log(tb)= log(d) - log(d(+1))*g/r;


Compared to yours
Code: Select all
log(tb)= d - d(+1)*g/r;


(3).My steady_state_model
Code: Select all
dbar=ybar*d_share;
d=dbar;
c =(gbar/r-1)*d +y-s-invest;
d=exp(d);


Compared to yours
Code: Select all
d = dbar;
c =(gbar/r-1)*d +y-s-invest;


Do you think there is some problem if I change the code like the above?

Best regards,
Huan
ZBCPA
 
Posts: 101
Joined: Sat May 16, 2015 4:15 am

Re: Real business cycle in emerging countries

Postby jpfeifer » Mon Sep 28, 2015 9:11 pm

You can adjust your model however you deem sensible. I can only tell you that for your first point, the replication code at the AER clearly shows they used the timing with d_t:
Code: Select all
r = RSTAR + PSSI * (exp(d-DBAR) - 1) + exp(mu-1)-1;
------------
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: Real business cycle in emerging countries

Postby sfking » Thu Oct 01, 2015 9:12 am

ZBCPA wrote:
sfking wrote:Dear jpfeifer, I am from China, and could not access to your website, will you post your uribe2010AER code here? Thank you.


Please find attached code written by Johannes Pfeifer.


Thank you, ZBCPA.
sfking
 
Posts: 6
Joined: Thu Nov 13, 2014 7:04 am

Re: Real business cycle in emerging countries

Postby ZBCPA » Sat Oct 03, 2015 7:45 am

jpfeifer wrote:You can adjust your model however you deem sensible. I can only tell you that for your first point, the replication code at the AER clearly shows they used the timing with d_t:
Code: Select all
r = RSTAR + PSSI * (exp(d-DBAR) - 1) + exp(mu-1)-1;



Dear Johhanes,

I find in your code it writes resource constraint as
Code: Select all
y= log(tb) + c + s + invest + phi/2 * (k(+1)/k*g -gbar)^2;

however, according to the original paper appendix, it should be
Code: Select all
y= log(tb) + c + s + invest + phi/2 * (k(+1)/k*g -gbar)^2*k;
.

Is it a typo of your code?

Please find attached appendix to Real business cycle in emerging countries.

Best regards,
Huan
Attachments
appendix.pdf
(99.15 KiB) Downloaded 230 times
ZBCPA
 
Posts: 101
Joined: Sat May 16, 2015 4:15 am

Re: Real business cycle in emerging countries

Postby jpfeifer » Sat Oct 03, 2015 3:20 pm

Dear Huan, the answer is yes and no. My code currently follows the replication codes at the AER one to one. And there, the trade balance is defined as
Code: Select all
tb = yy - c - s - ivv - PHI/2 * (kp/k*g -G)^2;

But you are correct in that there is a k missing in that equation. However, this is inconsequential as this term is 0 up to first order.
I will add a disclaimer to my code.
------------
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: Real business cycle in emerging countries

Postby ZBCPA » Sun Oct 04, 2015 9:39 am

jpfeifer wrote:Dear Huan, the answer is yes and no. My code currently follows the replication codes at the AER one to one. And there, the trade balance is defined as
Code: Select all
tb = yy - c - s - ivv - PHI/2 * (kp/k*g -G)^2;

But you are correct in that there is a k missing in that equation. However, this is inconsequential as this term is 0 up to first order.
I will add a disclaimer to my code.


Many thanks, Johannes. Your disclaimers in code are all very helpful.
ZBCPA
 
Posts: 101
Joined: Sat May 16, 2015 4:15 am

Re: Real business cycle in emerging countries

Postby ZBCPA » Wed Oct 07, 2015 3:57 am

jpfeifer wrote:Dear Huan, the answer is yes and no. My code currently follows the replication codes at the AER one to one. And there, the trade balance is defined as
Code: Select all
tb = yy - c - s - ivv - PHI/2 * (kp/k*g -G)^2;

But you are correct in that there is a k missing in that equation. However, this is inconsequential as this term is 0 up to first order.
I will add a disclaimer to my code.



Dear Johhanes,

Could I ask two more questions about trade-balance in your code?

1. Actually, the definition of trade-balance BEFORE detrending is
TBt=Dt-Dt+1*/rt=(dt*Xt-1 - dt+1*Xt)/rt (here rt is gross rate)

However, the TB data Generally does NOT appear Trend, so how can the equation above be altered to
Code: Select all
tb=d-d(+1)*g/r
Do you mean TBt/Xt-1=tbt ?


2. Since TB in data has negative numbers, to make the steady state all positive (because of loglinear command), you define
Code: Select all
tb=exp(tb);
tb_y=exp(tb_y);


I am just wondering how to write the original measurement equation of the observable TBt/Yt(Since I am loglinearing the whole model using pencil and paper instead of loglinear command to do it again).

By the way, the definition trade-balance to output ratio
log(tb_y)=log(tb)/y;
After the "loglinear" command, does it become
Code: Select all
log(log(tb_y)=log(log(tb))-logy

which is ACTUALLY(here tb_y and tb have no exp any more)
Code: Select all
log(tb_y)=logtb-logy
?


Best regards,
Huan
ZBCPA
 
Posts: 101
Joined: Sat May 16, 2015 4:15 am

Re: Real business cycle in emerging countries

Postby jpfeifer » Sat Oct 10, 2015 7:31 am

------------
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 3 guests

cron