Code to replicate Garcıa-Cicco, Pancrazi and Uribe (2010)

Dear all,
I wrote a code trying to replicate the financial friction SOE model in Garcıa-Cicco, Pancrazi and Uribe (2010),
but the rank condition isn’t verified.

There are 5 eigenvalue(s) larger than 1 in modulus
for 4 forward-looking variable(s)

The rank condition ISN’T verified!

I check the timing for the capital stock and it looks all right, could you tell me why?
CH_data_1981_2011.m (1.65 KB)
three.mod (4.49 KB)

You can find a replication file for the model on my homepage at sites.google.com/site/pfeiferecon/dynare

Dear Pfeifer,
I try to replicate your code “GarciaCiccoetal2010.mod”. However, it gives this error. May I learn in which version of the dynare your code runs? Would you make any other suggestion?
“Starting Dynare (version 4.4.3).
Starting preprocessing of the model file …
ERROR: GarciaCiccoetal2010(1).mod: line 324, cols 9-15: syntax error, unexpected NAME

Error using dynare (line 174)
DYNARE: preprocessing failed”

this line 324 corresponds to 3 rd row this
estimation(datafile=data_argentina,
xls_range=G2:J107,
logdata, //data is already logged, loglinear option would otherwise log the data
mode_check,
mode_compute=6,
moments_varendo,
mh_nblocks=1,
mh_replic=2000000
);
Your help would be greatly appreciated.

Best regards,

1 Like

It runs in the unstable version. The logdata command is new there. Alternatively, you can use 4.4.3 by deleting that statement and taking exp() of the data.

Thank you very much for your reply. I just downloaded and reinstalled the unstable version of Dynare, and now it works. But it gives this error in the estimation part.

COEFFICIENTS OF AUTOCORRELATION

Order 1 2 3 4 5
g_y 0.0382 0.0341 0.0260 0.0179 0.0109
g_c -0.0175 -0.0124 -0.0107 -0.0104 -0.0106
g_invest -0.0732 -0.0486 -0.0345 -0.0262 -0.0212
tb_y 0.5157 0.2655 0.1365 0.0704 0.0369
g_y g_c g_inv TB/Y
Standard Deviations: 6.2378 8.5158 17.8438 5.0296
Correlation with g_y: 1.0000 0.7646 0.3333 -0.0151
First Order Autocorr.: 0.0382 -0.0175 -0.0732 0.5157
Second Order Autocorr.: 0.0341 -0.0124 -0.0486 0.2655
Third Order Autocorr.: 0.0260 -0.0107 -0.0345 0.1365
Fourth Order Autocorr.: 0.0179 -0.0104 -0.0262 0.0704
Correlation with TB/Y: -0.0151 -0.3011 -0.2096 1.0000

Error using dynare_estimation
Too many output arguments.
Error in GarciaCiccoetal2010 (line 321)
oo_recursive_=dynare_estimation(var_list_);
Error in dynare (line 185)
evalin(‘base’,fname) ;

That is bad timing, because you downloaded the unstable version while a change was underway. You can either use tomorrow’s unstable version or simply replace the file in your dynare/matlab folder with the attached one. Sorry for the hassle.
dynare_estimation.m (7.38 KB)

As you suggested, I replaced the file in my dynare/matlab folder with the attached one. Now it works. Thank you very much. I really appreciate your help.

Dear Pfeifer,

In the code financial friction part works very well, but when I change the rbc=1 for RBC model, it gives this error. The reason may stem from the dynareestimation1 code or not?

Thank you very much.

Choose one of the following options:

[1] Consider all the endogenous variables.
[2] Consider all the observed endogenous variables.
[3] Stop Dynare and change the mod file.

options [default is 1] = 1

Error using check_prior_bounds (line 39)
Initial value(s) of SE_EOBS_g_y, SE_EOBS_tb_y are outside parameter bounds. Potentially,
you should set prior_trunc=0. If you used the mode_file-option, check whether your
mode-file is consistent with the priors.
Error in dynare_estimation_init (line 302)
check_prior_bounds(xparam1,bounds,M_,estim_params_,options_,bayestopt_)
Error in dynare_estimation_1 (line 102)
[dataset_, dataset_info, xparam1, hh, M_, options_, oo_, estim_params_, bayestopt_, bounds]
= …
Error in dynare_estimation (line 91)
dynare_estimation_1(var_list,dname);
Error in GarciaCiccoetal2010 (line 297)
oo_recursive_=dynare_estimation(var_list_);
Error in dynare (line 185)
evalin(‘base’,fname) ;

Sorry. That was my mistake. I should have checked this. The reason is that due to rounding the reported posterior mean in the paper coincides with the lower bound of the prior. I uploaded an updated file that adds an epsilon to the initial values.

Thank you so much for your kind care.

Best wishes.

Dear Pfeifer,

I run your code and try to obtain the same results for table 4. In your code you stated that results of Table 4 can be found in oo_.PosteriorTheoreticalMoments.dsge.correlation and covariance. But, there are many numbers which are very different from the table in the paper. I could not understand whether the numbers refer correlation with gy or serial correlation. However, there is no problem with variance decompositions, they are the same. Could you help me?

Thank you very much,

Best wishes.

Bahar.

Dear Bahar,
the oo_.PosteriorTheoreticalMoments.dsge.correlation directly stores the serial correlation. These are the numbers that should be identical (the first entry which is the first order serial correlation). In oo_.PosteriorTheoreticalMoments.dsge.covariance you have the covariances and variances. But Garcia-Cicco report correlations. Thus, you still have to use these fields to compute the correlations reported in the table, using the fact that the correlation is the covariance between two variables, divided by the corresponding standard deviations.

Thank you very much. I really appreciated your help.

Best wishes.

Bahar.

Dear Pfeifer,

I have one more question related to your code. After running the code, I obtained estimated shocks from oo_.SmoothedShocks. When I calculate the correlation matrix of estimated shocks for 20000 draws, I obtained this correlation matrix. Trend shock and transitory technology shocks are highly correlated (0,86) even if we impose no correlation among shocks.
How can I solve this problem? Is there any way to obtain orthogonal shocks after estimation?
Correlation matrix
e_a e_g e_nu e_mu e_s
e_a 1.000 0.862 -0.155 -0.156 -0.038
e_g 0.862 1.000 -0.210 -0.112 -0.275
e_nu -0.155 -0.210 1.000 0.066 0.086
e_mu -0.156 -0.112 0.066 1.000 -0.103
e_s -0.038 -0.275 0.086 -0.103 1.000

Thank you very much.

Best regards,

Bahar.

Are you talking about results with their data? If yes, this indicates model misspecification. The smoothed shocks should approximately follow the assumed distribution. There is no way to strictly impose them to be uncorrelated, but the likelihood function should punish such deviations from the assumption.

Thank you for your kind reply. Yes. I run the code with their data. I also checked whether subtracting a preference shock affects results, in that case correlation matrix is the following. It seems strange, does not it? I understand when the correlation is less than 0.5, but the numbers(0,86,-0,81 ) are so high. May I miss something ?

e_a	e_g	  e_mu	e_s

e_a 1.00 -0.81 0.46 0.16
e_g -0.81 1.00 -0.35 -0.36
e_mu 0.46 -0.35 1.00 0.04
e_s 0.16 -0.36 0.04 1.00

Bahar.

Thank you for your kind reply. Yes. I run the code with their data. I also checked whether subtracting a preference shock affects results, in that case correlation matrix is the following. It seems strange, does not it? I understand when the correlation is less than 0.5, but the numbers(0,86,-0,81 ) are so high. May I miss something ?

e_a e_g e_mu e_s
e_a 1.00 -0.81 0.46 0.16
e_g -0.81 1.00 -0.35 -0.36
e_mu 0.46 -0.35 1.00 0.04
e_s 0.16 -0.36 0.04 1.00

Bahar.

This is hard to tell. But it is well-known that many smoothed economic shocks violate the i.i.d assumption.

Hello jpfeifer,

I’m trying to run GarciaCicco_et_al_2010.mod, with the same code and data in:
github.com/JohannesPfeifer/DSGE … et_al_2010,
I’m using the dynare unstable version 2016-05-01, my matlab version is 7.8.0 (R2009a), I’m using 32-bit preprocessor and I’m obtain this error:

??? Reference to non-existent field ‘g_y’.

Error in ==> GarciaCicco_et_al_2010 at 310
fprintf(’%30s \t %5.4f \t %5.4f \t %5.4f \t %5.4f\n’,‘Correlation with
g_y:’,oo_.PosteriorTheoreticalMoments.dsge.covariance.Mean.g_y.g_y/(sqrt(oo_.PosteriorTheoreticalMoments.dsge.covariance.Mean.
Error in ==> dynare at 223
evalin(‘base’,fname) ;

I start to run the code the code with:
addpath c:\dynare\2016-05-01\matlab
dynare GarciaCicco_et_al_2010.mod

I read your reply in this forum about dynare_estimacion.m but I can’t found the .m file in it’s last version.
¿Could you help me? :frowning: Or somebody else?

This was a mistake in the mod-file. I updated it. Could you please try with the new version?