
clear all 
clc 
cd('/Users/mehreganameri/Dropbox/MRes Economics/Advaced Techniques in Macro I/PS5/HW5')
addpath /Applications/Dynare/4.3.3/matlab;
%addpath /Applications/Dynare/4.4_2013-10-23/matlab;

%% Solving for steady state
X0=ones(33,1);
Z=fsolve(@steady_stateH,X0); 

MULT_ss=Z(1);
Y_ss=Z(2);
K_ss=Z(3);
K_L_ss=Z(4);
C_ss=Z(5);
C_Y_ss=Z(6);
K_Y_ss=Z(7);
Lh_ss=Z(8);
L_ss=Z(9);
PHI_ss=Z(10); 
Kh_ss=Z(11);
Ks_ss=Z(12);
Pstar_P_ss=Z(13);
Wh_P_ss=Z(14);
Wstar_P_ss=Z(15);
W_P_ss=Z(16);
R_ss=Z(17);
Rk_P_ss=Z(18);
premium_ss=Z(19);
gammaw_1_ss=Z(20);
gammaw_2_ss=Z(21); 
MC_P_ss=Z(22);
r_ss=Z(23);
gammap_1_ss=Z(24);
gammap_2_ss=Z(25);
G_ss = Z(26);
B_P_ss = Z(27);
C1_ss = Z(28);
Lh1_ss = Z(29);
C1_Y_ss = Z(30);
C2_ss = Z(31);
Lh2_ss = Z(32);
C2_Y_ss = Z(33);

%% Set parameters
delta=0.025;
lambda_w=0.5;
lambda_p=0.62;
sigma_c=1.39;
lambda=0.71;
sigma_l=1.92;
theta_p=0.65;
theta_w=0.73;
PHI=1.62;
alpha=0.19;
beta=0.998;
rho_R=0.8;
phi_pi=1.5;
phi_y=0.5;
rho_a=0.95;
rho_b=0.882;
rho_r=0.12;
rho_l=0.952;
rho_c=0.882;
sigma_a=0.45;
sigma_b=0.324;
sigma_r=0.24;
sigma_l=1.709;
sigma_c=0.324;
Ybar=Y_ss;
Rbar=R_ss;
G_ss = 0.1678;


save parameters delta lambda_w lambda_p sigma_c lambda sigma_l theta_p theta_w PHI alpha beta rho_R phi_pi phi_y rho_a rho_b rho_r rho_c rho_l sigma_a sigma_b sigma_r sigma_c sigma_l Ybar Rbar MULT_ss Y_ss K_ss K_L_ss C_ss C_Y_ss K_Y_ss Lh_ss L_ss PHI_ss Kh_ss Ks_ss Pstar_P_ss Wh_P_ss Wstar_P_ss W_P_ss R_ss Rk_P_ss premium_ss gammaw_1_ss gammaw_2_ss MC_P_ss r_ss gammap_1_ss gammap_2_ss G_ss B_P_ss C1_ss C2_ss Lh1_ss Lh2_ss;

%save parametrss delta lambda_w lambda_p1 sigma_c1 lambda1 sigma_l1 theta_p1 theta_w1 PHI1 alpha1 beta1 rho_R1 phi_pi1 phi_y1 rho_a1 rho_b1 rho_r1 sigma_a1 sigma_b1 sigma_r1 Ybar1 Rbar1 MULT_ss Y_ss K_ss K_L_ss C_ss C_Y_ss K_Y_ss Lh_ss L_ss PHI_ss Kh_ss Ks_ss Pstar_P_ss Wh_P_ss Wstar_P_ss W_P_ss R_ss Rk_P_ss premium_ss gammaw_1_ss gammaw_2_ss MC_P_ss r_ss gammap_1_ss gammap_2_ss;

%% after having run the mod-file:
%% first order:
%set_param_value('delta',d);
dynare nk3H;
%%
%plot(sp_eta_R);
%print('-dpdf','sp_eta_R');
%plot(sw_eta_R);
%print('-dpdf','sw_eta_R');

%% second order with pruning:

%dynare newkeynesian_pruning;
%%
%plot(sp_eta_R);
%print('-dpdf','sp_eta_R_pruning');
%plot(sw_eta_R);
%print('-dpdf','sw_eta_R_pruning');
