
% Change option in line 12 od dynare file(taylor = 1 stands for taylor
% rule, taylor = 0 computes optimal ramsey policy). Choose the desired
% shock in line 159-165 of the dynare file and comment out the rest.


%To run OneCountryModel.mod
clear
clc
choice = 0 ;
%addpath C:\Users\cbhkyeja\Documents\MATLAB\dynare\4.3.1\matlab;

addpath /Applications/Dynare/4.5.1/matlab


xi=1;
%xi=0.1;
omega=0.7;
%omega = 0;
gamma = 16.0; % capital adjustment cost parameter
sigma=3.0;
alpha=0.5;
upsilon=200.0;% original value
%upsilon = 5000.0;
%upsilon=100.0;
%tau=0.0;
%tau = -0.3;
tau = -0.3;
delta=0.04;
beta=0.99;
pibar=0.005;
mu=1.1;
chi = 0.00; % parameter for non zero steady state price adjustment cost. set zero for now, we can change it later

%mu=10e10;
rho=0.5;
psi=4.0;
kappabar=0.7;
thetabar=11.0;
rho_int = 0.25;

%oput = zeros(17,9);
%
%for ll = 2:17
%lambdap = ll*0.05;
%lambda = lambdap;
gridsearch = 0;             %1 for gridsearch over mu

if gridsearch==0,
    save parameterfile xi omega sigma alpha upsilon tau delta beta pibar mu rho psi kappabar thetabar rho_int chi;


%dynare OneCountryModel.mod noclearall
dynare  onecountrymodel_nov17_2.mod noclearall nostrict
oo_.mean(1)
end

if gridsearch==1,

mugrid = linspace(1.1,10000,10); % grid for 
%mugrid = linspace(1.1,10,10);
%welfare_grid = nan(1,size(mugrid,2));


for j = 1:size(mugrid,2)
    mu = mugrid(1,j);
   
    

save parameterfile xi omega sigma alpha upsilon tau delta beta pibar mu rho psi kappabar thetabar rho_int chi;


%dynare OneCountryModel.mod noclearall
dynare onecountrymodel_nov17_2.mod noclearall nostrict
welfare_grid(1,j)=oo_.mean(1,1);
end


%plotting
f = figure
set(gcf,'color','w');
%set(gca,'FontSize', 55)
plot(mugrid,welfare_grid,'r-')
xlabel ('mu')
ylabel('welfare')
title('Theta (markup) shock ')
%title('zeta (preference) shock ')
%title('Productivity shock ')
set(gca,'FontSize',18);
%title('Kappa shock (relaxing collateral contraint ')

%title('zeta (preference) shock ')
end

%             oput(ll,1) = lambda;
%             oput(ll,2) = oo_.var(9,9);
%             oput(ll,3) = oo_.var(14,14);
%             oput(ll,4) = oo_.var(12,12);
%             oput(ll,5) = oo_.mean(9,1);
%             oput(ll,6) = oo_.mean(14,1);
%             oput(ll,7) = oo_.mean(2,1);
%             oput(ll,8) = oo_.var(28,28);
%             oput(ll,9) = oo_.var(27,27);
%end
 %onecountry_dyanreplots_nov2.m