Replicate Bilbiie, Ghironi, Melitz (2012)

Dear all,

I am running into some trouble trying to replicate the results of Bilbiie, Ghironi, and Melitz (2012), “Endogenous Entry, Product Variety, and Business Cycles”. This is frustrating, because it should be easy – all of the equations are listed on page 316! However, after carefully checking the equations and the parameters that they use, I am still getting the warning that the Blanchard & Kahn conditions are violated.

Has anyone replicate this paper before (or have code for a similar model)? I have attached my (unworking code), as well as the paper.

I have a few theories about why the code isn’t working… it may have something to do with which variables are predetermined. According to the paper, N_t is predetermined at time t, as is v_t, rho_t, and ne_t.

Many thanks in advance,


bgm_jpe_final.pdf (486.4 KB)

test.mod (1.1 KB)

The timing exactly as described in the table seems to work

% bgm_simp.mod
% Non-capital version of bilbiie, ghironi, melitz (2012)

var rhoo d w l ne n v c z  ;

varexo e;

parameters thetta betta fe chii psii phii deltaf r muu;

betta = .99;
deltaf = .025;
thetta = 3.8;
fe = 1;
chii = .924271;
psii = 4;
phii = .979;

r = betta^(-1)-1;

muu = (thetta)/(thetta-1);

% Table 2 equations
% Recall that N is predetermined at time t!

rhoo = muu*w/z;

rhoo = n^(1/(thetta-1));

d = (1-1/muu)*(c/n);

v = w*fe/z;

n = (1-deltaf)*(n(-1) + ne(-1));

chii*l^(1/psii) = w/c;

v = betta*(1-deltaf)*(c/c(+1))*(v(+1)+d(+1));

c + ne*v = w*l + n*d;

% Additional Equations

ln(z) = phii*ln(z(-1)) + e;

% Empirically relevant, log



z = 1;

n = ((1-deltaf)/(chii*(thetta)*(r+deltaf)))*((chii*(thetta)*(r+deltaf))/(thetta*(r+deltaf)-r))^(1/(1+psii))*z/fe;

c = (r+deltaf)*(thetta-1)*fe*n^(thetta/(thetta-1))/(1-deltaf);

rhoo = n^(1/(thetta-1));

w = rhoo*z/muu;

d = (1-1/muu)*(c/n);

v = w*fe/z;

ne = (deltaf/(1-deltaf))*n;

l = ((w/c)/chii)^(psii);



var e = .0072^2;

stoch_simul (order=1,irf=5) l rhoo  ;
1 Like

Hi, if I may ask, when computing the impulse responses, when does the peak of consumption occur? In the paper, consumption peaks at around 4 quarters for CES preferences, whereas I am obtaining a peak at around 10 quarters. I obtain very similar results for most other variables.


consumption_irf.fig (39.1 KB)

Hi, I ran your code modified to include the impulse response of consumption for 20 periods. Please note that consumption peaks after 10 quarters, whereas Figure 1 in the paper has consumption peaking after 5 quarters. Moreover, I attained the same result–consumption peaking after 10 quarters–using both the dolo solution toolkit in Python as well as a projection algorithm I wrote myself.

I therefore suspect the impulse response shown in Figure 1 of the paper is incorrect. Would really like to get thoughts on this.


Hi, I never really tried to replicate the paper. Are you sure your codes implement everything as indicated in the paper? The fact that you get consistent results could simply mean that it is consistently wrong/different.


Thanks for the prompt reply. Just to be clear, I ran your code, where the only change was to declare an impulse response for consumption and to change the length of the irf’s.

So, I am making the same assumptions as you-- and as far as I can tell, the same ones in the paper. This, in turn, matches up with results I obtained using other methods.
,BGM.mod (1.1 KB)
BGM_dyn.m (48 Bytes)



This has never been my code. I only adjusted the timing, but never tried to verify whether everything else like the calibration was correct. Moreover, I never checked whether all equations in the table are correct.

See the full code for the model with both capital and no capital here (Replication codes for papers with equity premia!). Before looking at the IRFs maybe see if the first and second moments are the same. Another difference is that the code uses a second order estimation, whereas BGM may have used a first order one.