Page 1 of 1

Schmitt-Grohe Uribe'03 initval; versus steadystate-file

PostPosted: Tue Mar 26, 2013 5:47 pm
by gin
Dear all,

Here (and attached) is a Schmitt-Grohe & Uribe (2003) model whose initval; block allows dynare to solve for the steady state with all residuals being zero:

Code: Select all
var  d, c, h, y, i, k, a, lambdaa,  tb, ca, riskpremium, r ; 

varexo e;                                   
                                             
parameters  gammaa, omegaa, rhoo, sigmae, deltaa, psii, alphaa, phii, betaa, r_w, d_bar;

      alphaa  = 0.32;
      rhoo    = 0.42;
      phii    = 0.028;
      r_w    = 0.04;      
        gammaa  = 2;
      omegaa  = 1.455;
      psii    = 0.000742;
      deltaa  = 0.1;
      sigmae = 0.0129;
      betaa   = 1/(1+r_w);
      h_ss   = ((1-alphaa)*(alphaa/(r_w+deltaa))^(alphaa/(1-alphaa)))^(1/(omegaa-1));
      k_ss   = h_ss/(((r_w+deltaa)/alphaa)^(1/(1-alphaa)));
      i_ss   = deltaa*k_ss;                                                     
      y_ss   = (k_ss^alphaa)*(h_ss^(1-alphaa));                                   
      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;

model;
    d = (1+exp(r(-1)))*d(-1)- exp(y)+exp(c)+exp(i)+(phii/2)*(exp(k)-exp(k(-1)))^2;
    exp(y) = exp(a)*(exp(k(-1))^alphaa)*(exp(h)^(1-alphaa));
    exp(k) = exp(i)+(1-deltaa)*exp(k(-1));
    exp(lambdaa)= betaa*(1+exp(r))*exp(lambdaa(+1));
    (exp(c)-((exp(h)^omegaa)/omegaa))^(-gammaa)   = exp(lambdaa); 
    ((exp(c)-((exp(h)^omegaa)/omegaa))^(-gammaa))*(exp(h)^omegaa)  = exp(lambdaa)*(1-alphaa)*exp(y);
    exp(lambdaa)*(1+phii*(exp(k)-exp(k(-1)))) = betaa*exp(lambdaa(+1))*(alphaa*exp(y(+1))/exp(k)+1-deltaa+phii*(exp(i(+1))-deltaa*exp(k)));
    a = rhoo*a(-1)+e;
    tb = 1-((exp(c)+exp(i))/exp(y));
    ca = (1/exp(y))*(d-d(-1));                                   
    riskpremium = psii*(exp(d-d_bar)-1);
    exp(r) = r_w+riskpremium;
end;

initval;
    r     = log((1-betaa)/betaa);
    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));
    lambdaa= log((exp(c)-((exp(h)^omegaa)/omegaa))^(-gammaa));
end;

shocks;
    var e; stderr sigmae;
end;

resid(1);
steady;
check;


However, when I use the _steadystate.m file with exactly the same initialvalues (also attached):

Code: Select all
%%%% Model equations to be entered here
    alphaa  = 0.32;
      rhoo    = 0.42;
      phii    = 0.028;
      r_w    = 0.04;      
        gammaa  = 2;
      omegaa  = 1.455;
      psii    = 0.000742;
      deltaa  = 0.1;
      sigmae = 0.0129;
      betaa   = 1/(1+r_w);
      h_ss   = ((1-alphaa)*(alphaa/(r_w+deltaa))^(alphaa/(1-alphaa)))^(1/(omegaa-1));
      k_ss   = h_ss/(((r_w+deltaa)/alphaa)^(1/(1-alphaa)));
      i_ss   = deltaa*k_ss;                                                     
      y_ss   = (k_ss^alphaa)*(h_ss^(1-alphaa));                                   
      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;
       
% vars
    d     = d_ss;
    c     = log(c_ss);
    h     = log(h_ss);
    y     = log(y_ss);
    i     = log(i_ss);
    k     = log(k_ss);
    a=0;
    lambdaa= log((exp(c)-((exp(h)^omegaa)/omegaa))^(-gammaa));
    tb    =  1-((exp(c)+exp(i))/exp(y));
    ca=0;
    riskpremium=0;
    r     = log((1-betaa)/betaa);


dynare says it cannot find the steady state (residuals are not zero):

Code: Select all
Residuals of the static equations:
 
Equation number 1 : -148.0734
Equation number 2 : 0
Equation number 3 : -148.0734
Equation number 4 : 0
Equation number 5 : 0
Equation number 6 : 0
Equation number 7 : -22.3611
Equation number 8 : 0
Equation number 9 : 99.613
Equation number 10 : 0
Equation number 11 : 0
Equation number 12 : 0
 
 
Error using print_info (line 55)
The steadystate file did not compute the
steady state


And the same error is generated if I substitute the ss-values found in the initval; case directly into the _steadystate.m.

Can anybody tell me why dynare can find the ss-values using initval; block but fail when the steadystate-file is used with exactly the same information?

Re: Schmitt-Grohe Uribe'03 initval; versus steadystate-file

PostPosted: Tue Mar 26, 2013 6:51 pm
by jpfeifer
It's a silly mistake. In your steady state file, you have a variable i for investment, but you use i as a run-index in your steady state file. Thus, upon exiting, i is 5 (as i is variable number 5) and not -1.07949.