%Calibration and steady-state code for RBC model

%Author: Abdumavlonov and Fang

global alpha beta delta zss eta gamma gbar;

%--------------------------------------------------------------------------
% Parameterization from Literature
%--------------------------------------------------------------------------

%Standard structural parameters
alpha     = 0.32;  %Capital share
beta      = 0.99; %Subjective discount factor  
delta     = 0.02; %Capital depreciation rate
zss       = 1;     %Steady state TFP
eta       = 4;    %Elasticity of labour
gamma     = 5.2142; %Parameter dictating disutility from labor
gbar      = 0.1825; %Goverment spending

%Parameters associated to TFP shock
rhoz      = 0.95;  %Persistence of TFP process
sigmaz    = 0.007; %Standard deviation of innovation/shock to TFP

%Parameters associated to Government shock
rhog      = 0.60; %Persistence of goverment spending process
sigmag    = 0.027; %Standard deviation of spending/shock to gbar


%--------------------------------------------------------------------------
% Calibrated Parameters
%--------------------------------------------------------------------------

% Calibrate the model using the external function neoclassical_calibration.m

% feed below gives initial values to solve the system in neoclassical_calibration.m

feed = [    
0.3;    %n %nss =  0.3556 new
11;     %k
0.8725;	%y
0.60;   %c             
];     



options_fsolve_silent = optimset('display','iter','maxfunevals',100000,'maxiter',100000','tolfun',10e-25,'tolx',10e-25);

[outc,fval,eflag] = fsolve(@modifiedrbc_calibration,feed,options_fsolve_silent);

%Define steady-state values obtained from solving the system:

nss = outc(1);
kss = outc(2);
yss= outc(3);
css = outc(4);



%In addition, define investment (not explicitly part of equilibrium; just a definition)
invss = kss - (1 - delta)*kss


