Gerali et al Credit and banking


Has anyone worked in the Gerali, Neri, Sessa, Signoretti JMCB 2010 paper “Credit and banking in a DSGE model of the Euro Area”? Any idea from where to get the source code?


Send an email to the authors

Yes, I already did that but there was no answer. In any case thanks for the idea!

Look here , maybe youc could find this post usefull

Thanks that is very useful!!

anyway Gerali’s model is in the new version of the macro model database

1 Like


I’m trying to replicate Gerali et al (2010).

I found the code in the new version of the macro model database and
I’m trying to estimate endogenous variables with data rather than loading median of posterior (dummy way).

However, I encountered the following error message.

(minus) the hessian matrix at the “mode” is not positive definite!
=> posterior variance of the estimated parameters are not positive.
You should try to change the initial values of the parameters using
the estimated_params_init block, or use another optimization routine.”

I think it’s because of using different data. I used data with period of “20051Q~20161Q” rather than “1998Q1-2009Q1”, which is the period of the Gerali et al (2010). Moreover, some data sources may be different.
(I transformed real variables as log deviations from the HP-filter trend and interest rate and inflation rates are expressed in absolute deviations from the sample mean following p.123 of Gerali et al.(2010))

Thus, I guess that I need to change initial values or priors of parameters, but I don’t have good idea now.

I’d really appreciate it if anyone can give me advice on this problem.

Thank you in advance.
Gerali_estimation.mod (25.3 KB)
dataGerali.m (5.39 KB)

You currently cannot use the macro model database files for estimation as their mod-files do not correctly handle parameter dependence. You need to invest a lot of work into getting a functioning file. See Pfeifer(2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models” for details on how to do this.

P.S.: Although Gerali et al do so, you are not supposed to use the HP-filter in the context of estimating DSGE models.

Dear Johannes

Thank you for your helpful advice.

Following your help, I changed my observation equations as following:

dc = 100*(0.0018916 + C - C(-1)); % dc: consumption growth rate in percentage terms, constant: average of consumption growth
dinv = 100*(0.0007868 + I - I(-1)); % dinv: investment growth rate in percentage terms
infobs = 100*(0.0038802 + pie); % infobs: inflation in percentage terms
wages = 100*(0.0057283 + PIW); % wages: real wage growth rate in percentage terms
hp = 100*(-0.0010362 + q_h - q_h(-1)); % hp: house price increasing rate in percentage terms
loansH = 100*(0.00399205 + BH - BH(-1)); %loansH: growth rate of loans to household in percentage terms
loansF = 100*(0.00552665 + BE - BE(-1)); %loansF: growth rate of loans to firm in percentage terms
deposits = 100*(0.00625248 + D - D(-1)); %deposits: growth rate of deposits in percentage terms
interestPol = 100exp(r_ib); % interestPol: quarterly policy rate in percentage terms
interestH = 100
exp(r_bh); % interestH: quarterly loans rate to households in percentage terms
interestF = 100exp(r_be); % interstF: quarterly loans rate to firms in percentage terms
interestDep = 100
exp(r_d); % interestDep : quarterly deposit rate in percentage terms

However, I still encountered same error message, so I used mode_compute=6 and I got an estimation result.
( I used same priors and the scales of shocks in Gerali et al.(2010) and the replicate file of macroeconomic model data base)

My further questions are

  1. How can I check whether I got a reliable result? If I got close estimated posterior values to Gerali et al.(2010), is it a good sign for right estimation? Can you tell me how to read diagnostic statistics from dynare(e.g. MCMC univariate convergence diagnostics)?
    (please refer to the attached diagnostic files)

  2. If I want to get impulse responses of some endogenous variables to a shock, is it enough to use median values of estimated parameters and use stoch_simul command such as the case of macroeconomic model database’s replicate file?

Thank you again for your help.

Seungcheol (307 KB)

Please provide the updated mod-file and the data.

A quick reply

a) Gerali’s model is calibrated on quarterly data
If the interest rates are expressed in annualized percentage (If you download the data from the ecb website they are expressed in this form), then the observable equations of the interest rates shouldn’t be multiplied by 400 ?

Dear all

I upload updated mod file and data file. I didn’t upload them because it took about 2 hours to estimate.

I used quarterly interest data (divided by 4) in my data file.

Thank you again!

Gerali_estimation.mod (25.5 KB)
dataGerali.m (5.09 KB)

You still do not handle parameter dependence. See Remark 4 (Parameter dependence and the use of model-local variables) in my Guide. Things like

r_k_ss = -(1-deltak)-m_e_ss*(1-deltak)*piss/beta_e*(1/(1+r_be_ss)-beta_e/piss)+1/beta_e; % steady state rental rate of capital
do not belong before the model block.

1 Like

I think that the definition of r_k_ss is correct
None of the parameters are estimated in the model block since Gerali et al estimated only the parameters related to the dynamic and not to the steady state

for Seungcheol Lee
I tried to modify the initial values of your estimation. Look at the file in attachment
Gerali_estimation.mod (25.5 KB)

Dear Johannes

Thank you always for your quick reply!

Then is it enough to use r_k_ss = 0.0469 (for example) instead of “-(1-deltak)-m_e_ss*(1-deltak)piss/beta_e(1/(1+r_be_ss)-beta_e/piss)+1/beta_e”? (I mean eliminating all other parameter dependence and use exact numerical values)

I had thought that using parameter dependence isn’t problematic because all elements (deltak, m_e_ss, piss, beta_e, and r_be_ss in calculating r_k_ss) are not estimated
but exactly specified (in case of deltak, piss, beta_e) in the params-statement.

I’d also appreciate it if you can tell me other problems in my mod file.


Dear Federico

Did you change some of the initial values? or do you suggest me to change some of the values?

I couldn’t find any change in initial values from your attached mod file.

Thank you again!


As long as you are not estimating parameters that create a dependency, you should be fine. It is nevertheless recommended to not program a mod-file like this, because you often forget to properly keep track of which parameters can be estimated and which cannot.

Hi Seungcheol/Johannes,

I am also currently trying to estimate the Gerali model for other countries. The source code I am using is the one from Macromodel database. I am just wondering the way you stated the observables as:

dc = 100*(0.0018916 + C - C(-1)); % dc: consumption growth rate in percentage terms, constant

Did you mean C as level or log? And where is this number 0.0018916 coming from? Apologies for my trivial questions but I am new to estimation and I find it really hard to transform observables to fit the model.

I would appreciate your reply.


dc is the growth rate of consumption. So C is log consumption as the log difference is the growth rate. However, in a stationary model the mean growth rate is 0. So 100*0.0018916 captures the mean growth rate in the data.

Thank you, Johannes.

Very much appreciated.