% Standard NK model

var pi x u m rn price i; 

varexo e_u  e_m;

parameters rhou rhom beta chi theta 
           pipi pix kappa sigma sigu sigm;

rhou    = 0;               
rhom    = 0.5;	            
beta    = 0.99;
chi     = 1;
pipi    = 1.5;
pix     = 0.1;
theta   = 0.75;
sigma   = 1;
kappa   = (1-theta)*(1-theta*beta)*(sigma+chi)/theta;
sigu    = 1;
sigm    = 0.25;

model(linear);

pi = kappa*x + beta*pi(+1) + u;

x = x(+1) - (rn - pi(+1))/sigma;

rn = pipi*pi + pix*x + m;

u = rhou*u(-1) + sigu*e_u;

m = rhom*m(-1) + sigm*e_m;

pi  = price - price(-1);

i   = 4*rn; 
end;

%model_info;
%steady;

%check;
shocks;
%var e_u; stderr 1;
var e_m; stderr 1;                                                   
end;

varobs i price x; 

estimated_params;
    rhom                           , uniform_pdf  ,,, 0  , 1    ;
    theta     , 0.75 , 0.1  , 0.9  , beta_pdf     , 0.7  , 0.2  ;
    pipi      , 1.1  , 1.01 , 5    , normal_pdf   , 1.5  , 0.3  ;
    pix       , 0.1  , 0.001, 1    , normal_pdf   , 0.4  , 0.3  ;
    sigm      , 0.5  , 0.001, 10   , Inv_gamma_pdf, 0.6  , 0.3  ;
    chi       , 2.0                , gamma_pdf    , 2.0  , 0.75 ;

end;

i_x   = [0.23908909,0.08030732,-0.052041964,-0.047898191,-0.106808291,-0.113932,-0.089063078,-0.104483761,-0.09829754,-0.081587964,-0.078859896,-0.069462127,-0.059801927,-0.056222718,-0.050479038,-0.046416356,-0.044309879,-0.040678876,-0.037772578,-0.034676178,-0.031281714];
price_x  = [-0.060617807,-0.050675636,-0.05843373,-0.075789126,-0.091750689,-0.105769739,-0.122801656,-0.136661514,-0.148434607,-0.161207178,-0.170137383,-0.177379695,-0.183455932,-0.187859631,-0.192496467,-0.196090405,-0.198058202,-0.200619269,-0.201618913,-0.202033141,-0.20307725];
x_x   = [-0.160092724,-0.185453772,-0.276467635,-0.257266917,-0.249390105,-0.254980315,-0.240698085,-0.222826119,-0.218482576,-0.203463834,-0.195636311,-0.19190663,-0.187192913,-0.18531162,-0.183454448,-0.180905901,-0.178171605,-0.175373825,-0.174646665,-0.173813683,-0.171813801];

matched_irfs; 
var i     ;  varexo e_m ;  periods 1:21   ;  values (i_x)       ;   
var price ;  varexo e_m ;  periods 1:21   ;  values (price_x)   ;    
var x     ;  varexo e_m ;  periods 1:21   ;  values (x_x)       ;   
end;
 

method_of_moments(mom_method = irf_matching
, posterior_sampling_method  = 'random_walk_metropolis_hastings'
, mode_compute               = 5
, mh_replic                  = 20000
, cova_compute               = 1
, mh_conf_sig                = 0.95
, mh_drop                    = 0.25
, mh_jscale                  = 0.005
, mh_nblocks                 = 1
, plot_priors                = 1
, verbose
, qz_criterium               = 1.00001
, posterior_sampler_options  = ('proposal_distribution'
                               ,'rand_multivariate_normal'
%                              ,'rand_multivariate_student'
%                              ,'student_degrees_of_freedom',4
%                              ,'use_mh_covariance_matrix',1
%                              ,'save_tmp_file',1
%                              , scale_file
                              ));


