SGU_2003.mod-The steady state is complex

Hello Johannes Pfeifer ,

I am using your codes for [SGU_2003.mod]. I am thankful to you for that. When I use delta = 0.03; %depreciation rate instead of 0.10 as in Schmitt-Grohé and Uribe (2003). I am assuming the case for the quarterly data. Others values are also adjusted according as in the literature. however,I am getting the following error. I tried all all but could not fix it .While, in the matlab codes of Martin Uribe we don’t have such problem. Here is Dynare output.

Residuals of the static equations:

Equation number 1 : 0
Equation number 2 : 0
Equation number 3 : 0
Equation number 4 : 0
Equation number 5 : -0.25208
Equation number 6 : 0.82188
Equation number 7 : 0.37684
Equation number 8 : 0
Equation number 9 : 0
Equation number 10 : 0
Equation number 11 : 0
Equation number 12 : 0
Equation number 13 : 0
Equation number 14 : 0

Error using print_info (line 88)
The steady state is complex

Error in check (line 76)
print_info(info, 0, options);

Error in SOE (line 201)
oo_.dr.eigval = check(M_,options_,oo_);

Error in dynare (line 235)
evalin(‘base’,fname) ;

Please let me know Is there way to fix it.

Best Regards,

Sorry I forgot to specify that it is the case only for Endogenous discount factor.

I had a deeper look into this. The issue is the differing calibration strategy. I my code, psi_1 is adjusted to get a particular value of d_bar. In the SGU code, psi_1 is fixed and debt in steady state is adjusted. The former leads to the multiplier eta being negative in steady state. Thus, it cannot be put in exp(). I changed my codes accordingly. Now it should work.

Thank you so much professor Pfeifer. It works perfectly now.
I have one more question.
I used dynare codes of Ambrogio Cesa-Bianchi, July 2012 for external debt elastic model. And add your SGU_2003 codes (for finding standard deviation, correlation). In your codes it works find with “periods” how when I used “periods” with Ambrogio Cesa-Bianchi codes I get the following error. Reference to non-existent field ‘gamma_y’.

Error in SU03n (line 252)
*fprintf(‘corr(c_t,y_t): \t %3.2f \n’,oo_.gamma_y{1}(c_pos,y_pos)/sqrt(oo_.var(c_pos,c_pos)oo_.var(y_pos,y_pos)))

Error in dynare (line 235)
evalin(‘base’,fname) ;

% Schmitt-Grohe and Uribe (2003, JIE)
% Ambrogio Cesa-Bianchi, July 2012
% If you find any bugs when using this file or want to give me comments 
% and suggestions you can email me at

var  d, c, h, y, i, k, a, lambda,  tb, ca, riskpremium, r ;  

varexo e;                                    
parameters  gamma, omega, rho, sigmae, delta, psi, alpha, phi, beta, r_w, d_bar;
	alpha  = 0.32;
        rho    = 0.42;
          phi    = 0.0282;
          r_w    = 0.04;		
         gamma  = 2.6;
	omega  = 1.455;
	psi    = 0.00242;
          delta  = 0.10;
	sigmae = 0.0186;
	beta   = 1/(1+r_w);
	h_ss   = ((1-alpha)*(alpha/(r_w+delta))^(alpha/(1-alpha)))^(1/(omega-1)); 
	k_ss   = h_ss/(((r_w+delta)/alpha)^(1/(1-alpha)));
       	  i_ss   = delta*k_ss;                                                     
	y_ss   = (k_ss^alpha)*(h_ss^(1-alpha));                                   
	d_bar  = 0.7442;
        d_ss   = d_bar;                                                        
	c_ss   = y_ss-i_ss-r_w*d_ss;
	tb_ss  = y_ss-c_ss-i_ss;
    d = (1+exp(r(-1)))*d(-1)- exp(y)+exp(c)+exp(i)+(phi/2)*(exp(k)-exp(k(-1)))^2;
    exp(y) = exp(a)*(exp(k(-1))^alpha)*(exp(h)^(1-alpha));
    exp(k) = exp(i)+(1-delta)*exp(k(-1)); 
    exp(lambda)= beta*(1+exp(r))*exp(lambda(+1)); 
    (exp(c)-((exp(h)^omega)/omega))^(-gamma)   = exp(lambda);  
    ((exp(c)-((exp(h)^omega)/omega))^(-gamma))*(exp(h)^omega)  = exp(lambda)*(1-alpha)*exp(y); 
    exp(lambda)*(1+phi*(exp(k)-exp(k(-1)))) = beta*exp(lambda(+1))*(alpha*exp(y(+1))/exp(k)+1-delta+phi*(exp(i(+1))-delta*exp(k))); 
    a = rho*a(-1)+e; 
    tb = 1-((exp(c)+exp(i))/exp(y));
    ca = (1/exp(y))*(d-d(-1));                                   
    riskpremium = psi*(exp(d-d_bar)-1);
    exp(r) = r_w+riskpremium;

    r     = log((1-beta)/beta);
    d     = d_ss;
    h     = log(h_ss);
    k     = log(k_ss);
    y     = log(y_ss);
    c     = log(c_ss);
    i     = log(i_ss);
    tb    = 1-((exp(c)+exp(i))/exp(y));
    lambda= log((exp(c)-((exp(h)^omega)/omega))^(-gamma));


    var e; stderr sigmae;

stoch_simul(order=1, irf=50, graph, periods =1000  );

//Report results from Table 3
 riskpremium_pos=strmatch(' riskpremium',M_.endo_names,'exact');

fprintf('\nstd(y):              \t %2.1f \n',sqrt(oo_.var(y_pos,y_pos))*100)
fprintf('std(c):                \t %2.1f \n',sqrt(oo_.var(c_pos,c_pos))*100)
fprintf('std(i):                \t %2.1f \n',sqrt(oo_.var(i_pos,i_pos))*100)
fprintf('std(d):                \t %2.1f \n',sqrt(oo_.var(d_pos,d_pos))*100)
fprintf('std(r):                \t %2.1f \n',sqrt(oo_.var(d_pos,r_pos))*100)
fprintf('std(h):                \t %2.1f \n',sqrt(oo_.var(h_pos,h_pos))*100)
fprintf('std(tb/y):             \t %2.1f \n',sqrt(oo_.var(tb_y_pos,tb_y_pos))*100)
if ~isempty(ca_y_pos)
fprintf('std(ca/y):             \t %2.1f \n',sqrt(oo_.var(ca_y_pos,ca_y_pos))*100)
else %complete markets case
fprintf('std(ca/y):             \t %2.1f \n',sqrt(oo_.var(ca_y_pos,ca_y_pos))*100)
fprintf('corr(y_t,y_t-1):       \t %3.2f \n',oo_.autocorr{1}(y_pos,y_pos))
fprintf('corr(c_t,c_t-1):       \t %3.2f \n',oo_.autocorr{1}(c_pos,c_pos))
fprintf('corr(i_t,i_t-1):       \t %4.3f \n',oo_.autocorr{1}(i_pos,i_pos))
fprintf('corr(h_t,h_t-1):       \t %3.2f \n',oo_.autocorr{1}(h_pos,h_pos))
fprintf('corr(tb/y_t,tb/y_t-1): \t %3.2f \n',oo_.autocorr{1}(tb_y_pos,tb_y_pos))
if ~isempty(ca_y_pos)
fprintf('corr(ca/y_t,ca/y_t-1): \t %3.2f \n',oo_.autocorr{1}(ca_y_pos,ca_y_pos))
else %complete markets case
fprintf('corr(ca/y_t,ca/y_t-1): \t %3.2f \n',NaN)

fprintf('corr(c_t,y_t):         \t %3.2f \n',oo_.gamma_y{1}(c_pos,y_pos)/sqrt(oo_.var(c_pos,c_pos)*oo_.var(y_pos,y_pos)))
fprintf('corr(i_t,y_t):         \t %3.2f \n',oo_.gamma_y{1}(i_pos,y_pos)/sqrt(oo_.var(i_pos,i_pos)*oo_.var(y_pos,y_pos)))
fprintf('corr(r_t,y_t):         \t %3.2f \n',oo_.gamma_y{1}(r_pos,y_pos)/sqrt(oo_.var(r_pos,r_pos)*oo_.var(y_pos,y_pos)))
fprintf('corr(d_t,y_t):         \t %3.2f \n',oo_.gamma_y{1}(d_pos,y_pos)/sqrt(oo_.var(d_pos,d_pos)*oo_.var(y_pos,y_pos)))
fprintf('corr(d_t,c_t):         \t %3.2f \n',oo_.gamma_y{1}(d_pos,c_pos)/sqrt(oo_.var(d_pos,d_pos)*oo_.var(c_pos,c_pos)))
fprintf('corr(r_t,c_t):         \t %3.2f \n',oo_.gamma_y{1}(r_pos,c_pos)/sqrt(oo_.var(r_pos,r_pos)*oo_.var(c_pos,c_pos)))
fprintf('corr(h_t,y_t):         \t %2.1f \n',oo_.gamma_y{1}(h_pos,y_pos)/sqrt(oo_.var(h_pos,h_pos)*oo_.var(y_pos,y_pos)))
fprintf('corr(tb/y_t,y_t):      \t %4.3f \n',oo_.gamma_y{1}(tb_y_pos,y_pos)/sqrt(oo_.var(tb_y_pos,tb_y_pos)*oo_.var(y_pos,y_pos)))
if ~isempty(ca_y_pos)
fprintf('corr(ca/y_t,y_t):      \t %4.3f \n',oo_.gamma_y{1}(ca_y_pos,y_pos)/sqrt(oo_.var(ca_y_pos,ca_y_pos)*oo_.var(y_pos,y_pos)))
else %complete markets case
fprintf('corr(ca/y_t,y_t):      \t %4.3f \n',NaN)

Thanks I found the solution. It was simple just to put periods command at the very end of everything.