%%Defining variables%%
%var C I K L_H L_L Y k(+1)i M rK E c_L c_E w_L w_H X_L X_H A q i_Z Z A_Z eta Z(+1);
%varexo l_L l_H Z;
%parameters beta sigma omega sigma_1 sigma_2 gamma mu b lambda delta_K delta_Z A psi_E psi_H psi_L theta;


%%Calibration: parameters fixed exogenously%%
beta = 0.99;
sigma = 1;
omega = 1.5;
sigma_1 = 0.5;
sigma_2 = 20.5;
gamma = 0.5;
mu = 0.5;
b_ss = 1;
lambda = 0.5;
delta_K = 0.02;
delta_Z = 0.02;
A_ss = 1;
psi_E = 0.1;
psi_H = 0.35;
psi_L = 0.55;
l_L_ss = 0.33;
l_H_ss = 0.33;
Z_ss = 1;
phi_I = 0.1; %investment adjustment cost

%%Calibration: parameters obtained through steady state relationships%%

L_L_ss = psi_L*l_L_ss;
L_H_ss = psi_H*l_H_ss;
rk_ss  = 1/beta-(1-delta_K);
KoY_ss = gamma*(A_ss^(sigma_1-1))*(rk_ss^(-sigma_1));
VoK_ss = (((1/KoY_ss)^((sigma_1-1)/sigma_1)-(gamma^(1/sigma_1))*(A_ss^((sigma_1-1)/sigma_1)))/((1-gamma)^(1/sigma_1)))^(sigma_1/(sigma_1-1));
VoY_ss = VoK_ss*KoY_ss;
V_ss   = ((mu^(1/sigma_2))*(L_L_ss^((sigma_2-1)/sigma_2))+((1-mu)^(1/sigma_2))*((b_ss*Z_ss)^((sigma_2-1)/sigma_2)))^(sigma_2/(sigma_2-1));
Y_ss   = V_ss/VoY_ss;
K_ss   = KoY_ss*Y_ss;
kE_ss   = K_ss/psi_E;
I_ss   = delta_K*K_ss;
iE_ss   = I_ss/psi_E;
w_L_ss = ((A_ss)^((sigma_1-1)/sigma_1))*((1-gamma)^(1/sigma_1))*(mu^(1/sigma_2))*((Y_ss/V_ss)^(1/sigma_1))*((V_ss/L_L_ss)^(1/sigma_2));
q_ss   = ((A_ss)^((sigma_1-1)/sigma_1))*((1-gamma)^(1/sigma_1))*((Y_ss/V_ss)^(1/sigma_1))*((1-mu)^(1/sigma_2))*((V_ss/(b_ss*Z_ss))^(1/sigma_2))*b_ss;
Iz_ss  = delta_Z*Z_ss;
eta_ss = beta*q_ss/(1-beta*(1-delta_Z));
AZ_ss  = (Iz_ss/(((eta_ss*(1-lambda))^((1-lambda)/lambda))*L_H_ss))^lambda;
M_ss   = L_H_ss*((eta_ss*(1-lambda)*AZ_ss)^(1/lambda));
w_H_ss = eta_ss*lambda*AZ_ss*((L_H_ss/M_ss)^(-(1-lambda)));
c_L_ss = w_L_ss*l_L_ss;
c_H_ss = w_H_ss*l_H_ss;
chiL   = w_L_ss/((l_L_ss)^(omega-1));
chiH   = w_H_ss/((l_H_ss)^(omega-1));
C_ss      = Y_ss - I_ss - M_ss;
cE_ss  = (C_ss-c_H_ss*psi_H-c_L_ss*psi_L)/psi_E;
lambdaE_ss = cE_ss^(-sigma);


















