Dear all,

I am a beginner using Dynare.

I try to use Mr. Jpfeifer’s file of indivisible labor and the business cycle, and extend the model by adding government factor into the equation as shown below. However, the error messege appears. It specify that ‘The steady state file did not compute the steady state’.

I am not sure where I have to start to begin with to find the mistake and how to correct it. Could anyone please give me any suggestions?

Thank you so much in advance.

**Residuals of the static equations:**

Equation number 1 : 0

Equation number 2 : 546.7572

Equation number 3 : 0

Equation number 4 : 0

Equation number 5 : 0

Equation number 6 : 0

Equation number 7 : 0

Equation number 8 : 0

Equation number 9 : 0

** code** (Credit to Mr.Jpfeifer)

```
var c w r y h k i lambda productivity g;
varexo e eg;
parameters beta delta theta gamma A h0 sigma B rho gbar;
//Calibration
beta = 0.99;
delta = 0.025;
theta = 0.36;
gamma = 0.95;
A = 2;
sigma=0.00712;
h0=0.53;
rho = 0.04;
gbar=190.8;
B=-A*(log(1-h0))/h0;
model;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Euler equation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1/c = beta*((1/c(+1))*(r(+1) +(1-delta)));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Labor FOC
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(1-theta)*(y/h) = A/(1-h)*c;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Resource Constraint
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c + k + g = y +(1-delta)*k(-1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Law of Motion
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
k= (1-delta)*k(-1) + i;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Production Function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
y = lambda*k(-1)^(theta)*h^(1-theta);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Real Interest Rate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
r = theta*(y/k(-1));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Wage Rate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
w = (1-theta)*(y/h);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Technology Shock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
log(lambda)=gamma*log(lambda(-1))+e;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Government Spending Shock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
log(g)= (1-rho)*log(gbar) + rho*log(g(-1)) + eg;
end;
steady_state_model;
B=-A*(log(1-h0))/h0;
lambda = 1;
h = (1-theta)*(1/beta -(1-delta))/(B*(1/beta -(1-delta)-theta*delta));
g = gbar;
k = h*((1/beta -(1-delta))/(theta*lambda))^(1/(theta-1));
i = delta*k;
y = lambda*k^(theta)*h^(1-theta);
c = y-g-delta*k;
r = 1/beta - (1-delta);
w = (1-theta)*(y/h);
productivity = y/h;
end;
steady;
shocks;
var eg; stderr sigma;
end;
check;
steady;
stoch_simul(order=1,irf=20,loglinear,hp_filter=1600) y c i k h productivity g;
stoch_simul(order=1,irf=20,loglinear,hp_filter=1600,simul_replic=100,periods=115) y c i k h productivity g;
%read out simulations
simulated_series_raw=get_simul_replications(M_,options_);
%filter series
simulated_series_filtered=NaN(size(simulated_series_raw));
for ii=1:options_.simul_replic
[trend, cycle]=sample_hp_filter(simulated_series_raw(:,:,ii)',1600);
simulated_series_filtered(:,:,ii)=cycle';
end
%get variable positions
y_pos=strmatch('y',M_.endo_names,'exact');
c_pos=strmatch('c',M_.endo_names,'exact');
i_pos=strmatch('i',M_.endo_names,'exact');
k_pos=strmatch('k',M_.endo_names,'exact');
h_pos=strmatch('h',M_.endo_names,'exact');
productivity_pos=strmatch('productivity',M_.endo_names,'exact');
g_pos=strmatch('g',M_.endo_names,'exact');
var_positions=[y_pos; c_pos; i_pos; k_pos; h_pos; productivity_pos; g_pos];
%get variable names
var_names=M_.endo_names_long(var_positions,:);
%Compute standard deviations
std_mat=std(simulated_series_filtered(var_positions,:,:),0,2)*100;
%Compute correlations
for ii=1:options_.simul_replic
corr_mat(1,ii)=corr(simulated_series_filtered(y_pos,:,ii)',simulated_series_filtered(y_pos,:,ii)');
corr_mat(2,ii)=corr(simulated_series_filtered(y_pos,:,ii)',simulated_series_filtered(c_pos,:,ii)');
corr_mat(3,ii)=corr(simulated_series_filtered(y_pos,:,ii)',simulated_series_filtered(i_pos,:,ii)');
corr_mat(4,ii)=corr(simulated_series_filtered(y_pos,:,ii)',simulated_series_filtered(k_pos,:,ii)');
corr_mat(5,ii)=corr(simulated_series_filtered(y_pos,:,ii)',simulated_series_filtered(h_pos,:,ii)');
corr_mat(6,ii)=corr(simulated_series_filtered(y_pos,:,ii)',simulated_series_filtered(productivity_pos,:,ii)');
corr_mat(7,ii)=corr(simulated_series_filtered(y_pos,:,ii)',simulated_series_filtered(g_pos,:,ii)');
end
%Print table with results
fprintf('\n%-40s \n',title_string)
fprintf('%-20s \t %11s \t %11s \n','','std(x)','corr(y,x)')
for ii=1:size(corr_mat,1)
fprintf('%-20s \t %3.2f (%3.2f) \t %3.2f (%3.2f) \n',var_names(ii,:),mean(std_mat(ii,:,:),3),std(std_mat(ii,:,:),0,3),mean(corr_mat(ii,:),2),std(corr_mat(ii,:),0,2))
end
```