beta =0.99;
h = 0.6;
chi = 4;
delta = 0.025;
kappa_I = 2.48;
theta_w = 0.75;
varphi = 2;
kappa_w = 0.5;
alpha = 0.5;
theta_d = 0.75;
kappa_d = 0.5;
theta_f = 0.75;
kappa_f = 0.5;
gamma = 0.5; 
eta = 1.5;
eta_2 = 1.5;
rho_r = 0.6;
mu_pi = 1.5;
mu_y = 0.125; 
phi_a = 0.01;
phi_s = 0.1;
rho_zet_c = 0.7;
zeta_c_ss = 0;
rho_mu_z = 0.7;
mu_z_ss = 1.012;
rho_tau_c = 0.7;
tau_c_ss = 0.25;
rho_zeta_i = 0.7;  
zeta_i_ss = 0;
rho_mu_f = 0.7;
mu_f_ss = 1;
rho_lambda_w = 0.3;
lambda_w_ss = 1.4;
rho_zeta_n = 0.7;
zeta_n_ss = 0;
rho_tau_n = 0.7;
tau_n_ss = 0.3;
rho_lambda_d = 0.7;
lambda_d_ss = 1.1;
rho_zeta_y = 0.7;
zeta_y_ss = 0;
rho_tau_m = 0.7;
lambda_f_ss = 1.1;
tau_m_ss = 1/lambda_f_ss;
rho_lambda_f = 0.7;
rho_g = 0.7;
g_ss = 1; 
rho_y_star = 0.7;
y_star_ss = 1;
rho_pi_star = 0.7;
pi_star_ss =  1.01; 
rho_R_star = 0.7;
R_star_ss = pi_star_ss/beta*mu_z_ss;
rho_risk_premium = 0.7;
lambda_f_i_ss = 1.1;
rho_lambda_f_i = 0.7;
rho_tau_m_i = 0.7;
theta_f_i = 0.5;
kappa_f_i = 0.3;

mu_z_l = mu_z_ss;
mu_f_l = mu_f_ss;
zeta_y = zeta_y_ss;
tau_c_l = tau_c_ss;
tau_n_l = tau_n_ss;
lambda_d_l = lambda_d_ss;
lambda_w_l = lambda_w_ss;
lambda_f_l = lambda_f_ss;
lambda_f_i_l = lambda_f_i_ss;
zeta_c = zeta_c_ss;
zeta_i = zeta_i_ss;
zeta_n = zeta_n_ss;
y_star_l = y_star_ss;
pi_star_l = pi_star_ss;
R_star_l = R_star_ss;
p_f_star_l = 1;
risk_premium = 0;
pi_l = 1.01;
pi_data_l = pi_l;
pi_target_l = pi_l;
pi_w_hat_l = pi_l*mu_z_l;
pi_w_l = pi_l*mu_z_l;
p_d_l = 1;
pi_d_hat_l = pi_l;
pi_d_l = pi_l;
q_l = 1;
phi = 1;
p_i_l = 1;
p_f_i_l = 1;
pi_f_i_l = pi_l/mu_f_l;
pi_f_i_hat_l = pi_f_i_l^kappa_f_i*pi_target_l^(1-kappa_f_i);
p_f_i_star_l = ((1-theta_f_i)^(1- lambda_f_i_l)*(1 - theta_f_i*(pi_f_i_hat_l/pi_f_i_l)^(1/(1-lambda_f_i_l)))^lambda_f_i_l/(1 - theta_f_i*(pi_f_i_hat_l/pi_f_i_l)^(lambda_f_i_l/(1-lambda_f_i_l))))^((1 - lambda_f_i_l)/lambda_f_i_l);
R_l = pi_l/beta*mu_z_l;
delta_e_l = R_l/R_star_l;
tq_l = 1/((1 - kappa_I/2*(mu_f_l*mu_z_l-1)^2 - kappa_I*(mu_z_l*mu_f_l - 1)*mu_f_l*mu_z_l) +beta*kappa_I/(mu_z_l*mu_f_l)*(mu_f_l*mu_z_l-1)*(mu_f_l*mu_z_l)^2);
r_k_hat_l = tq_l*mu_z_l/beta - (1-delta)*tq_l/mu_f_l;
w_star_l = 1;
p_d_star_l = 1;
mc_l = 1/lambda_d_l;
w_hat_l = (mc_l*(r_k_hat_l/alpha)^(-alpha))^(1/(1-alpha))*(1-alpha);
x_l = 0.4*y_star_l;
g_l = g_ss;
k_n_l = mu_f_l*mu_z_l*(alpha/(1-alpha))*w_hat_l/r_k_hat_l;
n_l = solve_for_n(1, mu_z_l, mu_f_l, k_n_l, gamma, lambda_w_l, varphi, alpha, tau_n_l, tau_c_l, h, w_hat_l, chi, kappa_I, delta, g_l, x_l);
k_l = mu_f_l*mu_z_l*(alpha/(1-alpha))*w_hat_l/r_k_hat_l*n_l;
c_l = (1/lambda_w_l)*mu_z_l*(1-tau_n_l)/((mu_z_l - h)*(1 + tau_c_l))*w_hat_l*n_l^(-varphi)/chi;
c_d_l = (1-gamma)*c_l;
c_f_l = gamma*c_l;
y_l = (k_l/(mu_z_l*mu_f_l))^alpha*n_l^(1-alpha);
i_l = (1 - (1-delta)/(mu_z_l*mu_f_l))/(1 - kappa_I/2*(mu_z_l*mu_f_l - 1)^2)*k_l;
i_d_l = (1-gamma)*i_l;
i_f_l = gamma*p_f_i_star_l^(lambda_f_i_l/(1-lambda_f_i_l))*i_l;
Phi_z_l = 1/((c_l - h*c_l/mu_z_l)*(1 + tau_c_l));
F_w_l =  (Phi_z_l/lambda_w_l)*w_star_l^(-lambda_w_l/(1-lambda_w_l))*n_l*(1-tau_n_l)/(1-beta*theta_w);
K_w_l = (w_star_l^(-lambda_w_l/(1-lambda_w_l))*n_l)^(1+varphi)/(1-beta*theta_w);
K_d_l =  lambda_d_l*Phi_z_l*y_l*mc_l/(1 -beta*theta_d);
F_d_l = Phi_z_l*y_l/(1 -beta*theta_d);
mc_f_l = 1/lambda_f_l;
tau_m_l = mc_f_l;
mc_f_i_l = 1/lambda_f_i_l *(1 - beta*theta_f_i*(pi_f_i_hat_l/pi_f_i_l)^(lambda_f_i_l/(1-lambda_f_i_l)))/(1 - beta*theta_f_i*(pi_f_i_hat_l/pi_f_i_l)^(1/(1-lambda_f_i_l))) * ((1 - theta_f_i*(pi_f_i_hat_l/pi_f_i_l)^(1/(1-lambda_f_i_l)))/(1-theta_f_i))^(1-lambda_f_i_l);
tau_m_i_l = mc_f_i_l;
K_f_i_l = lambda_f_i_l*Phi_z_l*i_f_l*mc_f_i_l/(1 - beta*theta_f_i*(pi_f_i_hat_l/pi_f_i_l)^(lambda_f_i_l/(1-lambda_f_i_l)));
F_f_i_l = Phi_z_l*i_f_l/(1 - beta*theta_f_i*(pi_f_i_hat_l/pi_f_i_l)^(1/(1-lambda_f_i_l)));
K_f_l = lambda_f_l*Phi_z_l*c_f_l*mc_f_l/(1 - beta*theta_f);
F_f_l = Phi_z_l*c_f_l/(1 - beta*theta_f);
pi_f_hat_l = pi_l;
pi_f_l = pi_l;
p_f_l = 1;
a_l = (x_l-c_f_l -i_f_l)/(y_l*(1 - R_star_l*delta_e_l/(pi_l*mu_z_l)));
Phi_z = log(Phi_z_l);
c = log(c_l);
R = log(R_l);
pi = log(pi_l);
delta_e = log(delta_e_l);
q = log(q_l);
tq = log(tq_l);
i = log(i_l);
k = log(k_l);
w_star = log(w_star_l);
pi_w_hat = log(pi_w_hat_l);
pi_w = log(pi_w_l);
F_w = log(F_w_l);
K_w = log(K_w_l);
n = log(n_l);
w_hat = log(w_hat_l);
y = log(y_l);
p_d_star = log(p_d_star_l);
mc = log(mc_l);
p_d = log(p_d_l);
r_k_hat = log(r_k_hat_l);
K_d = log(K_d_l);
pi_d_hat = log(pi_d_hat_l);
pi_d = log(pi_d_l);
F_d = log(F_d_l);
pi_target = log(pi_target_l);
mc_f = log(mc_f_l);
c_f = log(c_f_l);
i_f = log(i_f_l);
K_f = log(K_f_l);
pi_f_hat = log(pi_f_hat_l);
p_f_star = log(p_f_star_l);
pi_f = log(pi_f_l);
F_f = log(F_f_l);
c_d = log(c_d_l);
i_d = log(i_d_l);
p_f = log(p_f_l);
p_i = log(p_i_l);
K_f_i = log(K_f_i_l);
F_f_i = log(F_f_i_l); 
p_f_i_star = log(p_f_i_star_l);
pi_f_i = log(pi_f_i_l);
p_f_i = log(p_f_i_l);
pi_f_i_hat = log(pi_f_i_hat_l);
mc_f_i = log(mc_f_i_l);
x = log(x_l);
a = log(a_l);
mu_z = log(mu_z_l);
tau_c = log(tau_c_l);
mu_f = log(mu_f_l);
lambda_w = log(lambda_w_l);
tau_n = log(tau_n_l);
lambda_d = log(lambda_d_l);
tau_m = log(tau_m_l);
tau_m_i = log(tau_m_i_l);
lambda_f = log(lambda_f_l);
lambda_f_i = log(lambda_f_i_l);
g = log(g_l);
y_star = log(y_star_l);
pi_star = log(pi_star_l);
R_star = log(R_star_l);
pi_data = log(pi_data_l);
R_data = 1;
R_star_data = 1;
y_star_data = 1;
pi_star_data = 1;
y_data = mu_z;
c_data = mu_z;
x_data = mu_z;
i_data = mu_z + mu_f;
q_data =1;

a_ss = a;
y_ss = y;

save par_exp a_ss  y_ss tau_m_i;