Real business cycle in emerging countries

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
data and code.zip (26.8 KB)

Could you please explain what you changed?

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.
data_argentina.xls (47 KB)
GarciaCiccoetal2010.mod (11.5 KB)

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

compared to yours

(2).My Trade balance

Compared to yours

(3).My steady_state_model

dbar=ybar*d_share; d=dbar; c =(gbar/r-1)*d +y-s-invest; d=exp(d);

Compared to yours

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

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:

r = RSTAR + PSSI * (exp(d-DBAR) - 1) + exp(mu-1)-1;

[quote=“ZBCPA”]

Please find attached code written by Johannes Pfeifer.[/quote]

Thank you, ZBCPA.

[quote=“jpfeifer”]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:

r = RSTAR + PSSI * (exp(d-DBAR) - 1) + exp(mu-1)-1; [/quote]

Dear Johhanes,

I find in your code it writes resource constraint asy= log(tb) + c + s + invest + phi/2 * (k(+1)/k*g -gbar)^2;
however, according to the original paper appendix, it should be 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
appendix.pdf (99.1 KB)

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

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.

[quote=“jpfeifer”]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

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.[/quote]

Many thanks, Johannes. Your disclaimers in code are all very helpful.

[quote=“jpfeifer”]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

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.[/quote]

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=(dtXt-1 - dt+1Xt)/rt (here rt is gross rate)

However, the TB data Generally does NOT appear Trend, so how can the equation above be altered to

tb=d-d(+1)*g/r Do you mean TBt/Xt-1=tbt ?

  1. Since TB in data has negative numbers, to make the steady state all positive (because of loglinear command), you define

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 becomelog(log(tb_y)=log(log(tb))-logy
which is ACTUALLY(here tb_y and tb have no exp any more) log(tb_y)=logtb-logy ?

Best regards,
Huan

See my answer at ["logdata" must be used after "loglinear")