Help with steady state with NaN and positive residuals


#1

Hi ,

I have a problem with my code - The steadystate file did not compute the steady state. The residuals of two equations are nonzero : one is NaN and the other is positive.

This seems strange to me because the program did calculate the steady state from the analytical expressions provided ( I can see them when I open the M_,params)

This is a very simple model, and I attached the code. I appreciate any comments

mymodel.mod (1.3 KB)

Carlos


#2

Your model is supposed to be


var c n mc R pi y g;
varexo eps_g;
 
parameters gamma beta psi theta phi_pi phi_y gshare rho_g sigma_g;
 
gamma = 0.29; 
beta = 0.99;  
psi = 69; //equal to calvo when prob of not change price is 0.75  
theta = 7 ;   // from christiano
phi_pi = 1.5; 
phi_y = 0.25; // vilaverde 2012   
gshare = 0.2;  // vilaverde 2012
rho_g = 0.8; 
sigma_g = 0.0025; // vilaverde 2012
 
 
model;
#tau = 1/theta;
 
//euler equation
 
1/R  = beta*(c/c(+1))*(1/pi(+1)) ;
 
// real marginal cost
mc = ((1-gamma)/gamma)*(c/(1-n)) *(1-tau);
 
//optimal pricing
 
1 - psi*(pi-1)*pi + psi*beta*(c/c(+1))*(pi(+1)-1)*pi(+1)*(y(+1)/y) = theta*(1-mc);
 
 
 
//taylor rule
 
R = (1/beta)*(pi)^phi_pi*(y/steady_state(y))^phi_y ;
 
// Resource Constraint
 
y = (1/(1-g-psi/2*(pi-1)^2))*c;
 
// Aggregate supply 
 
y = n;
 
//stochastic process (already in log)
 
g = (1-rho_g)*gshare + rho_g*g(-1)+ eps_g;
 
end;
 
shocks;
var eps_g = 0.0025^2;
end;
 
steady_state_model;
n = gamma/(1-gshare*(1-gamma));
y = gamma/(1-gshare*(1-gamma));
c = (1-gshare)*(gamma/(1-gshare*(1-gamma)));
mc = (theta-1)/theta;
R = (1/beta);
G = gshare * gamma/(1-gshare*(1-gamma));
pi = 1;
g = gshare;
end;
 
 
steady;
check;
 
stoch_simul(order = 2,irf=40);

P.S.: Pro tip: use name tags for your equations instead of comments. See e.g. https://github.com/JohannesPfeifer/DSGE_mod/blob/master/Gali_2015/Gali_2015_chapter_3_nonlinear.mod


#3

perfect! thanks a lot professor