clear all
 ...
global scalv_ ex_ ex_det_ recur_ recurs_ ys_ y_ exe_ exe_det_ lgy_ lgx_ lgx_det_ lgr_ dsmpl_ endval_
 ...
global endo_nbr exo_nbr exo_det_nbr iy_  ykmin_  ykmax_  xkmin_  xkmax_ zkmin_ zkmax_ iter_
 ...
global dynatol_ slowc_ maxit_ valf_ ys0_ recurs0_ ex0_ timing_ ct_ gstep_ Sigma_e_ fname_ lgx_orig_ord_ iter_ options_ dr_ oo_ trend_coeff_ eigenvalues_
global M_
M_.ex_det_length = 0;
M_.dname = 'baxter1_incomplete';
endo_nbr=0;exo_nbr=0;exo_det_nbr=0;
dsmpl_=0;
dynatol_=0.00001;
maxit_=10;
slowc_=1;
timing_=0;
ct_=0;
gstep_=1e-2;
endval_=0;rplottype_=0;
valf_=0;
y_=[];
ex_=[];
ex_det_=[];
fname_ = 'baxter1_incomplete';
logname_ = 'baxter1_incomplete.log';
diary off;
warning off;
delete baxter1_incomplete.log;
warning on;
warning backtrace;
diary baxter1_incomplete.log;
options_ = [];

lgy_ = 'b';
lgy_ = str2mat(lgy_,'bStar');
lgy_ = str2mat(lgy_,'c');
lgy_ = str2mat(lgy_,'cStar');
lgy_ = str2mat(lgy_,'g');
lgy_ = str2mat(lgy_,'h');
lgy_ = str2mat(lgy_,'hStar');
lgy_ = str2mat(lgy_,'inve');
lgy_ = str2mat(lgy_,'inveStar');
lgy_ = str2mat(lgy_,'k');
lgy_ = str2mat(lgy_,'kStar');
lgy_ = str2mat(lgy_,'nx');
lgy_ = str2mat(lgy_,'nxStar');
lgy_ = str2mat(lgy_,'p');
lgy_ = str2mat(lgy_,'pStar');
lgy_ = str2mat(lgy_,'tau');
lgy_ = str2mat(lgy_,'taxRev');
lgy_ = str2mat(lgy_,'y');
lgy_ = str2mat(lgy_,'yStar');
endo_nbr = 19;

lgx_ = 'e_g';
lgx_ = str2mat(lgx_,'e_tau');
lgx_orig_ord_ = [1 2];
exo_nbr = 2;



global A AStar Gss alpha beta delta eta gStar gamma pay 
global rho_g rho_t sigma tauSS tauStar theta 
load para1.mat
% A = 1;
% AStar = 1;
% Gss = 0.15491;
% alpha = 0.58;
% beta  = 0.984;
% delta = 0.025;
% eta = 15;
% gStar = 0.15491;
% gamma = 1.004;
% pay = 0.83235;
% rho_g = 0.90;
% rho_t = 0.90;
% sigma = 2;
% tauSS  = 0.3;
% tauStar = 0.3;
% theta = 0.282;

iy_ = [ 0 1 0 0 2 0 0 0 0 3 4 0 0 0 0 5 0 0 0];
temp = [ 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24];
iy_ = [ iy_ ; temp ];
temp = [ 0 0 25 26 0 0 0 27 28 0 0 0 0 29 30 0 0 31 32];
iy_ = [ iy_ ; temp ];
ykmin_ = 1;
ykmax_ = 1;
xkmin_ = 0;
xkmax_ = 0;
zkmin_ = 0;
zkmax_ = 0;
ys_ = zeros(19,1);
exe_ = zeros(2,1);


% INITVAL 
valf_ = 0;
endval_=0;
ys_(18)=0.77453;
ys_(3)=0.49402;
ys_(6)=0.2;
ys_(10)=5.0239;
ys_(5)=0.15491;
ys_(16)=0.3;
ys_(17)=0.2323;
ys_(14)=0.81742;
ys_(1)=0;
ys_(12)=0;
ys_(8)=0.1256;
ys_(19)=0.77453;
ys_(4)=0.49402;
ys_(7)=0.2;
ys_(11)=5.0239;
ys_(9)=0.1256;
ys_(2)=0;
ys_(15)=0.81742;
ys_(13)=0;
exe_(1)=0;
exe_(2)=0;
y_=[ys_*ones(1,ykmin_)];
if exo_nbr > 0;
  ex_=[ones(xkmin_,1)*exe_'];
end;
if exo_det_nbr > 0;
  ex_det_=[ones(ykmin_+1,1)*exe_det_'];
end;


check;


steady(0);


% (M)SHOCKS 
make_ex_;
shocks_file(0);
Sigma_e_ = zeros(2,2);
Sigma_e_(1,1) = (0.025946)^2;
Sigma_e_(2,2) = (0)^2;



options_.periods=1000;
options_.simul=1;
options_.irf=40;
var_list_ = [];
info=stoch_simul(var_list_);

IRF_d=zeros(280,2200);
IRF_d(1:280,1)=[g_e_g; y_e_g; taxRev_e_g; yStar_e_g; cStar_e_g; inveStar_e_g; nxStar_e_g];
save('IRF_theoretical', 'IRF_d');
save('baxter1_incomplete_results','oo_','dr_');
diary off
