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 = 'firesales_out';
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_ = 'firesales_out';
logname_ = 'firesales_out.log';
diary off;
warning off;
delete firesales_out.log;
warning on;
warning backtrace;
diary firesales_out.log;
options_ = [];
clc;

iter_ = 100000;
options_.periods = 100000;



lgy_ = 'a';
lgy_ = str2mat(lgy_,'be');
lgy_ = str2mat(lgy_,'c');
lgy_ = str2mat(lgy_,'d');
lgy_ = str2mat(lgy_,'der');
lgy_ = str2mat(lgy_,'fk');
lgy_ = str2mat(lgy_,'inf');
lgy_ = str2mat(lgy_,'k');
lgy_ = str2mat(lgy_,'ke');
lgy_ = str2mat(lgy_,'l');
lgy_ = str2mat(lgy_,'lmult1');
lgy_ = str2mat(lgy_,'lmult10');
lgy_ = str2mat(lgy_,'lmult11');
lgy_ = str2mat(lgy_,'lmult12');
lgy_ = str2mat(lgy_,'lmult13');
lgy_ = str2mat(lgy_,'lmult14');
lgy_ = str2mat(lgy_,'lmult15');
lgy_ = str2mat(lgy_,'lmult16');
lgy_ = str2mat(lgy_,'lmult17');
lgy_ = str2mat(lgy_,'lmult18');
lgy_ = str2mat(lgy_,'lmult19');
lgy_ = str2mat(lgy_,'lmult2');
lgy_ = str2mat(lgy_,'lmult20');
lgy_ = str2mat(lgy_,'lmult21');
lgy_ = str2mat(lgy_,'lmult22');
lgy_ = str2mat(lgy_,'lmult3');
lgy_ = str2mat(lgy_,'lmult4');
lgy_ = str2mat(lgy_,'lmult5');
lgy_ = str2mat(lgy_,'lmult6');
lgy_ = str2mat(lgy_,'lmult7');
lgy_ = str2mat(lgy_,'lmult8');
lgy_ = str2mat(lgy_,'lmult9');
lgy_ = str2mat(lgy_,'markup');
lgy_ = str2mat(lgy_,'mu');
lgy_ = str2mat(lgy_,'pa');
lgy_ = str2mat(lgy_,'pb');
lgy_ = str2mat(lgy_,'pnew');
lgy_ = str2mat(lgy_,'q');
lgy_ = str2mat(lgy_,'qs');
lgy_ = str2mat(lgy_,'r');
lgy_ = str2mat(lgy_,'Util');
lgy_ = str2mat(lgy_,'v');
lgy_ = str2mat(lgy_,'vbar');
lgy_ = str2mat(lgy_,'w');
lgy_ = str2mat(lgy_,'Welf');
lgy_ = str2mat(lgy_,'y');
lgy_ = str2mat(lgy_,'z');
endo_nbr = 47;




lgx_ = 'eps';
lgx_ = str2mat(lgx_,'epsm');
lgx_orig_ord_ = [1 2];
exo_nbr = 2;



global alpha be_SS beta c_SS chi d_SS delta divss eta fk_SS 
global k_SS kbar ke_SS l_SS lmult10_SS lmult11_SS lmult12_SS lmult13_SS  ...
lmult14_SS lmult15_SS 
global lmult16_SS lmult17_SS lmult18_SS lmult19_SS lmult1_SS lmult20_SS  ...
lmult21_SS lmult22_SS lmult2_SS lmult3_SS 
global lmult4_SS lmult5_SS lmult6_SS lmult7_SS lmult8_SS lmult9_SS m  ...
markup_SS markupss mu_SS 
global nbeta nu omega pa_SS pb_SS pnew_SS q_SS qs_SS r_SS rho 
global sigma tao v_SS vbar_SS w_SS y_SS z_SS 






find_steady_1;

iy_ = [ 1 2 3 0 0 0 0 4 5 0 0 0 0 6 7 8 0 0 0 0 0 0 9 10 0 11 12 0 0 13 0  ...
14 0 15 0 0 0 0 0 16 0 0 0 0 0 0 0];
temp = [ 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38  ...
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63];
iy_ = [ iy_ ; temp ];
temp = [ 0 0 64 65 66 0 67 0 0 0 0 0 68 0 0 0 0 0 69 0 0 0 0 0 0 0 0 70 71 ...
 0 0 0 72 0 73 74 0 75 76 0 77 78 0 0 0 79 0];
iy_ = [ iy_ ; temp ];
ykmin_ = 1;
ykmax_ = 1;
xkmin_ = 0;
xkmax_ = 0;
zkmin_ = 0;
zkmax_ = 0;
ys_ = zeros(47,1);
exe_ = zeros(2,1);




% INITVAL 
valf_ = 0;
endval_=0;
exe_(1)=0;
exe_(2)=0;
ys_(1)=0;
ys_(7)=1;
ys_(40)=r_SS;
ys_(33)=markup_SS;
ys_(4)=d_SS;
ys_(9)=ke_SS;
ys_(10)=l_SS;
ys_(46)=y_SS;
ys_(8)=k_SS;
ys_(6)=fk_SS;
ys_(3)=c_SS;
ys_(44)=w_SS;
ys_(38)=q_SS;
ys_(34)=mu_SS;
ys_(47)=z_SS;
ys_(39)=qs_SS;
ys_(5)=1;
ys_(35)=pa_SS;
ys_(36)=pb_SS;
ys_(37)=pnew_SS;
ys_(43)=vbar_SS;
ys_(42)=v_SS;
ys_(2)=be_SS;
ys_(41)=c_SS-(exp(l_SS)^chi)/chi;
ys_(45)=ys_(41)/(1-nbeta);
ys_(11)=lmult1_SS;
ys_(22)=lmult2_SS;
ys_(26)=lmult3_SS;
ys_(27)=lmult4_SS;
ys_(28)=lmult5_SS;
ys_(29)=lmult6_SS;
ys_(30)=lmult7_SS;
ys_(31)=lmult8_SS;
ys_(32)=lmult9_SS;
ys_(12)=lmult10_SS;
ys_(13)=lmult11_SS;
ys_(14)=lmult12_SS;
ys_(15)=lmult13_SS;
ys_(16)=lmult14_SS;
ys_(17)=lmult15_SS;
ys_(18)=lmult16_SS;
ys_(19)=lmult17_SS;
ys_(20)=lmult18_SS;
ys_(21)=lmult19_SS;
ys_(23)=lmult20_SS;
ys_(24)=lmult21_SS;
ys_(25)=lmult22_SS;
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;


steady(0);


check;


Sigma_e_ = [
0.000074, 0.0;
0.0, 0.000074
];

options_.irf=0;
options_.hp_filter=1600;
options_.order=1;
var_list_ = 'w';
var_list_ = str2mat(var_list_,'c');
var_list_ = str2mat(var_list_,'l');
var_list_ = str2mat(var_list_,'y');
var_list_ = str2mat(var_list_,'fk');
var_list_ = str2mat(var_list_,'z');
var_list_ = str2mat(var_list_,'markup');
var_list_ = str2mat(var_list_,'pnew');
var_list_ = str2mat(var_list_,'inf');
var_list_ = str2mat(var_list_,'mu');
var_list_ = str2mat(var_list_,'r');
var_list_ = str2mat(var_list_,'ke');
var_list_ = str2mat(var_list_,'k');
var_list_ = str2mat(var_list_,'be');
var_list_ = str2mat(var_list_,'d');
var_list_ = str2mat(var_list_,'q');
var_list_ = str2mat(var_list_,'qs');
info=stoch_simul(var_list_);














save('firesales_out_results','oo_','dr_');
diary off
