var y, c, k, i, l, y_l, w, r, z;
varexo e;

parameters beta, psi, delta, alpha, rho, sigma, epsilon;
 
alpha=0.33;
beta=0.99;
delta=0.023;
psi=1.75;
rho=0.95;
sigma=(0.007/(1-alpha));
epsilon=10;
 
model;
(1/c) = beta*(1/c(+1))*(1+r(+1)-delta);%euler eqn in consumption
psi*c/(1-l) = w;%labour supply function
c+i = y;%accountancy identity
y = (k(-1)^alpha)*(exp(z)*l)^(1-alpha);%production function
w = y*((epsilon-1)/epsilon)*(1-alpha)/l;%marginal cost equal to mark-up equations
r = y*((epsilon-1)/epsilon)*alpha/k(-1);%marginal cost equal to mark-up equations
i = k-(1-delta)*k(-1);%investment equality
y_l = y/l;%identity which may be useful
z = rho*z(-1)+e;%equation of motion of technology
end; 
 
initval;
k=9;
c=0.7;
l=0.3;
w=2.0;
r=0;
z=0;
e=0;
end; 
 
steady;%you can control whether you want to start your simulations from the steady state, or the exact values specified in the initval block
check;%this computes and displays the eigenvalues of your system which are used in the solution method. A necessary condition for the uniqueness 
%in the neighborhood of the steady state is that there are as many
%eigenvalues larger than one in modulus as there are forward looking
%variables in the system. If this condition is not met, Dynare will tell
%you that the Blanchard-Kahn conditions are not satisfied.
 
shocks;
var e = sigma^2;%add a shock with variance sigma squared. 
 
 
stoch_simul(periods==2100);
 
