clear all;
clc;

%parameters
us=0.1525;
qs=0.7;
rho_zero=0.1;
mu=0.5;
eta=0.5;
b_bar=0.73;
beta=0.99;
pis=1;
sigma=2;
epsilon_p=11;
kappa_p=20;
rhor=0.8;
phipi=2;
phiy=0.3;
rhoer=0;
rho_a=0.8976;
sigma_a=0.00934;
sigma_r=0;
gamma=1;
phi_c=0.572;

%steady state
guess =1.5;
As=1;
b=b_bar*As; 
%eq 1
ns=(1-us)/(1-rho_zero);
% eq 3
ms=ns*rho_zero;
%eq 4
u_ms=1-ns;
% eq 5
fs=ms/us;
%eq 6
vs=ms/qs;
%eq 2
m_zero=ms/((us^mu)*(vs^(1-mu)));
% eq 10
phis=(epsilon_p-1)/epsilon_p;
%eq 12
Rs=1/beta;
%eq 17
thetas=vs/us;
%(20)
sigs=((1-gamma+gamma*Rs)/(phis*phi_c*As*ns^(1-phi_c)))^(1/(phi_c-1));

Xs=As*(sigs^(phi_c))*(ns^(1-phi_c));

ys=Xs-sigs;

%eq 9 +13

Js=((1-eta)*phis*As*(1-phi_c)*(sigs^phi_c)*(ns^(-phi_c))-(1-gamma+gamma*Rs)*(1-eta)*b)/(beta*(1-rho_zero)*eta*fs-beta*(1-rho_zero)+1);

%eq 13

ws=(1/(1-gamma+gamma*Rs))*(phis*As*(1-phi_c)*(sigs^phi_c)*(ns^(-phi_c))+Js*(1-rho_zero)*beta-Js);
%eq 7
kappa_v=Js*qs;

%eq 18

%eq 16
cs=ys;
% eq 11
lams=cs^(-sigma);




LCs=(1-gamma+gamma*Rs)*ws;

save parameter_mainAA Js  LCs sigs Xs phi_c thetas eta rho_zero mu m_zero rho_a b kappa_p kappa_v epsilon_p beta gamma sigma us ns vs ms u_ms fs qs ys  As  phis pis lams Rs ws cs sigma_a sigma_r rhor rhoer phipi phiy
 dynare modelLin_3
IRF1 =oo_.irfs;
STD1=oo_.var;
AUT1=oo_.autocorr;
save IRF1 
save STD1
save AUT1