
clear params SS M_ oo_ options 

% Set the option for plots
set(0, 'DefaultAxesFontSize',      5);
set(0, 'DefaultTextFontSize',      5);
set(0, 'DefaultUicontrolFontSize', 5);
set(0, 'DefaultAxesLinewidth',   1.5);
set(0, 'DefaultLineLinewidth',   1.5);
set(0, 'DefaultPatchLinewidth',  1.5);

% Declare the parameters as global variables
global BETA SIGMA PHI CHI GAMMA GAMMA_STAR THETA EPSILON ALPHA DELTA;
global XI_I XI_P XI_B;
global RHO_A RHO_R RHO_RF RHO_YF RHO_P RHO_Y RHO_E;
global BF_GDP;
global params;


% Declare the calibrated value of each parameter
BETA  = 0.99;                 % subjective discount rate
SIGMA = 2.00;                 % inverse of elasticity of intertemporal substitution
PHI   = 2.00;                 % inverse of Frisch elasticity of substitution
CHI   = 37.3415;              % weight of disutility of labor

GAMMA      = 0.40;            % degree of openness for consumption goods   
GAMMA_STAR = 0.3970;          % degree of openness for consumption goods of the Foreign

THETA      = 3.00;            % elasticity of substitution between home and foreign goods
EPSILON    = 10.00;           % elasticity of subsitution between domestic goods
ALPHA      = 0.33;            % capital share in production function %0.60
DELTA      = 0.02;            % depreciation rate of capital

XI_I       = 2.48;            % charge of investment installation
XI_P       = 0.01;            % degree of price sluggishness
XI_B       = 0.01;            % magnitude of portfolio adjustment cost

RHO_A      = 0.9;             % autocorrelation of productivity shock
RHO_R      = 0.0;             % autocorrelation of monetary policy shock
RHO_RF     = 0.9;             % autocorrelation of foreign interest rate shock
RHO_YF     = 0.9;             % autocorrelation of foreign productivity shock
RHO_P      = 1.5;             % monetary policy response to inflation
RHO_Y      = 0.5;             % monetary policy response to outputs
RHO_E      = 0.0;             % monetary policy response to exchange rate

BF_GDP     = 0.49;            % external-bond-to-GDP ratio at SS


% Declare params as a VECTOR of parameters
params = [BETA; SIGMA; PHI; CHI; GAMMA; GAMMA_STAR;
THETA; EPSILON; ALPHA; DELTA; XI_I; XI_P; XI_B;
RHO_A; RHO_R; RHO_RF; RHO_YF; RHO_P; RHO_Y; RHO_E;
BF_GDP];
% to be loaded in Dynare


save parametervalues ...
BETA SIGMA PHI CHI GAMMA GAMMA_STAR THETA EPSILON ALPHA DELTA ...
XI_I XI_P XI_B ...
RHO_A RHO_R RHO_RF RHO_YF RHO_P RHO_Y RHO_E...
BF_GDP;
save params;


%% Run Dynare using the parameters
%% The option noclearall avoid loosing all data in memory after the code
dynare RamSOE.mod noclearall




