%fix x = 0.25 to calibrate

alpha=0.4;
beta = 0.99;
delta = 0.05;           % capital depreciation rate
open=0.85;
gamma=2;
eta=0.5;
phipi=1.5;                
phiy=0.0125; 
kappaI = 5;
rhoa=0.9;
rhor=0.8;
slope= 2/3;
pi_ss=1;



sigma=0.92;
leta = 0.005 ;
Rstar=1.0025; 


R=1/beta;
x = 0.2;
lev = 3;
Rk = (1-sigma/beta-sigma*(1/beta-Rstar)*x*lev-lev*leta)/(sigma*lev)+1/beta;
omega = (1-sigma)/(1-sigma-sigma*lev*((beta*Rk-1)+x*(1-beta*Rstar)));
mu=omega;
muk = beta*(Rk-1/beta)*omega;
mustar = beta*(1/beta-Rstar)*omega;
aux1 =muk/mustar;
kappaX = 2/((x+aux1)^2-aux1^2);                  %kappaX calibration
theta = (mu/lev+muk+x*mustar)/(1+kappaX/2*x^2);  %theta calibration


eps = 9;
kappaP = (eps-1)*slope/((1-slope)*(1-beta*slope));

chi = 2;
phi = 1/3;


mc = (eps-1)/eps;
Y_K = (Rk-1+delta)/alpha/mc;
Y_L = Y_K^(alpha/(alpha-1));
L = ((1-alpha)*mc*Y_L/chi)^(1/phi);
Y = Y_L*L;
K = Y/Y_K;
i = delta*K;
n =K/lev;
Bstar = x*lev*n;
B = (lev-1-x*lev)*n;
C = Y-i-Bstar*(Rstar-1);
c_star = Y-open*(C+i);
lambda = (C-chi/(1+phi)*L^(1+phi))^(-gamma);    


Y_ss = Y;
q = 1;
pi=1;
piH=1;
pH = 1;
s=1;
A=1;

save par2 beta alpha chi gamma phi delta open sigma kappaX theta leta...
    kappaI eta rhoa rhor eps kappaP pi_ss Y_ss ...
    phipi phiy c_star Rstar;

save ss22.mat C L Y K i n B Bstar lambda omega muk mu mustar x lev R pH q Rstar s Rk A ...
 mc pi piH ;