close all;

var y c ke ks ie is h 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)
% h is the varying rate of utilization

parameters beta thet deltae deltas alphae alphas bh 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
% bh : parameter


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;
bh = 0.2;

% Comments about parameters
% we used the values provided in GHK 2000.
model; 
  (1/c) = beta*(1/(c(+1)*trend))*((1-tk)*re(+1)*h(+1)+(1-deltae)*exp(q-q(+1)));
  (1/c) = beta*(1/(c(+1)*trend))*((1-tk)*rs(+1)+(1-deltas));
  rs = alphas*(h*(ke(-1)/trend1)^(alphae))*((ks(-1)/trend)^(alphas-1))*l^(1-alphae-alphas);
  re = alphae*(h*(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)*(h*(ke(-1)/trend1)^alphae)*((ks(-1)/trend)^alphas)*(l^(-alphae-alphas));
  c+ie+is = y;
  y = (h*(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;
(1-tk)*alphae*y*exp(q)/ke(-1)=bh;
  q = rho*q(-1)+e;
end;
% Comments about equations of the model
e model.

initval;
  ke  = 0.5;
  ks= 0.6;
  c  = 0.16;
  l  = 0.3;
  q = 0;
  rs = 0.18;
  re = 0.30;
  w = 0.59;
  h = 0.8;
    
  
end;

shocks;
var e= sigma^2;

end;

steady;
check;

stoch_simul(hp_filter = 1600, order = 1);

