close all;
% The aim of this program is to simulate a model similar to the one derived
% in GHK 2000. The basis of this program is the work of Villaverde
% substantially modified. For the specification of the specific
% investment technological change, we used the formulation of Villaverde, 
% even though it differs from the GHK one. 
% The program presented here below is nearly the same as GHK (up to the
% limitations mentionned above) excepted that we could not manage including
% a variable rate of utilization of equipement.

var y c ke ks ie is l w re rs q;
varexo e;
% ke stands for capital in equipment
% ks stands for capital in structure
% ie : investment in equipment
% is : investment in structures
% y : output
% c : consumption
% l : labour
% w : wage
% re and rs are rate of return for capital in equipment and structures
% q is the shock applied (equipment specific)

parameters beta thet deltae deltas alphae alphas  rho  sigma trend trend1 tk tl;

%beta : discounting factor
% thet : parameter of preferences
% deltae : depreciation rate of equipment
% deltas : depreciation rate of structures
% alphae : share of capital in equipment in output
% alphas : share of capital in structure in output
% rho : autoregressive parameter for the shock
% sigma : standard deviation of the shock
% trend : trend of all variables except labour (stationary) and capital in
% equipment
% trend1 : trned for capital in equipment
% tk :  taxation rate for capital
% tl : taxation rate for labour


alphae   = 0.18;
alphas   = 0.12;
beta    = 0.97;
deltae   = 0.124;
deltas = 0.056;
thet     = 0.4;
rho    = 0.64; 
sigma  = 0.035;
trend = 1.0124;
trend1 = 1.0124*1.032;
tk = 0.53;
tl = 0.4;

% Comments about parameters. 

%We used the values provided in GHK 2000.
model; 
  (1/c) = beta*(1/(c(+1)*trend))*((1-tk)*re(+1)+(1-deltae)*exp(q-q(+1)));
  (1/c) = beta*(1/(c(+1)*trend))*((1-tk)*rs(+1)+(1-deltas));
  rs = alphas*((ke(-1)/trend1)^(alphae))*((ks(-1)/trend)^(alphas-1))*l^(1-alphae-alphas);
  re = alphae*((ke(-1)/trend1)^(alphae-1))*((ks(-1)/trend)^(alphas))*l^(1-alphae-alphas);
  (1-thet)/thet*c/(1-l) = (1-tl)*w;
  w = (1-alphae-alphas)*((ke(-1)/trend1)^alphae)*((ks(-1)/trend)^alphas)*(l^(-alphae-alphas));
  c+ie+is = y;
  y = ((ke(-1)/trend1)^alphae)*(ks(-1)/trend)^alphas*(l)^(1-alphae-alphas);
  ke = (1-deltae)*ke(-1)/trend1+exp(q)*ie;
  ks = (1-deltas)*ks(-1)/trend+is;
  q = rho*q(-1)+e;
end;
% Comments about equations of the model

% The two first equations represents Euler equations for equipment and
% structures. The two following expressions are the equalisation of marginal
% productivity with marginal costs. the next one is the efficiency condition for labour 
% Specification for wage then follows. The seventh expression is the
% resource constraint, we find next the production function, the two
% capital accumulation rules and the rule for q ends the model.

initval;
  ke  = 1.155;
  ks= 2.324;
  c  = 0.48;
  l  = 0.24;
  q = 0;
  rs = 0.18;
  re = 0.30;
  w = 0.5;

    
  
end;

shocks;
var e= sigma;

end;

steady;
check;

stoch_simul(hp_filter=1600, order = 1);