%Model Description++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Standard RBC model taken from Chapter 5 of Advanced Macroeconommics by David
Romer.

The model is able to replicate a key stylised fact of business cycles, namely 
the relative volatilities of consumption, output, and investment. Over the 
business cycle investment tends to be far more volatile than output, and output 
tends to be more volatile than consumption and this model is able to replicate 
this feature of the data.  However, the only reason the model is able to match 
this key feature of the data is because the exogenous productivity (and 
government spending shocks) are assumed to be highly persistent.  Such large and
persistent shocks to productivity/technology are hard to identify in the data.
 
Model suffers from other issues common to RBC models, for example the model has
no room for involuntary unemployment.  In this model, workers  choose to be 
unemployed (or under employed!): workers optimally adjust their labor supply 
across time in response to changes in the real wage (which in turn are driven by
exogenous productivity/technology shocks).      

Note that there are two sources of growth in Romer's RBC: technology growth and 
population growth. Thus we will need to detrend variables accordingly in order 
to have a stationary model.  All variables, with the exception of l(t), are 
expressed in per effective worker terms.  The labor supply, l(t), is in per 
capita terms.

%Model Information++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Name = Romer's RBC model;

%Parameters+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Definition of exogenous parameters of this RBC are as follows:

# discount rate
rho = 0.01;

# Calibrated steady state labour, in the SS solver the parameter b now gets determined
l_bar = 2.0/3.0;

# Household size (normalized to unity)
H = 1.0;

# growth rate of technology
g = 0.005;

# population growth rate 
n = 0.0025; 

# rate of capital depreciation
delta = 0.025; 

# capital's  share of output
alpha = 1.0/3.0;

# government spending per effective worker is chosen so that in SS government
# spending roughly is 20% of output (which matches U.S. data)
# g_bar now gets determined residually in the SS solver
gov_share = 0.20;

# persistence of technology shocks
rho_A = 0.95;

# pesistence of government spending shocks
rho_G = 0.95;

# standard deviation of technology shocks
sigma_A = 0.011;

# standard deviation of government spending shocks
sigma_G = 0.011;

# Various easily computed steady-state values
z_A_bar = 1.0;
z_G_bar = 1.0;

%Variable Vectors+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Only endogenous state variable is capital per effective worker, k; the
# two exogenous variables are technology, A, and government spending, G.  Both
# are driven by AR(1) processes z_A and z_G, respectively. 

[0] y(t):output{con}[log,cf]
[1] k(t):physical_capital{endo}[log,cf]
[2] l(t):labor{con}[log,cf]
[3] c(t):consumption{con}[log,cf]
[4] i(t):investment{con}[log,cf]
[5] w(t):real_wage{con}[log]
[6] R(t):gross_interest_rate{con}
[7] g(t):gov_spending{con}[log,cf]
[8] z_A(t):eps_A(t):tech_shocks{exo}[log,cf]
[9] z_G(t):eps_G(t):gov_shocks{exo}[log,cf]

%Boundary Conditions++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
None

%Variable Substitution Non-Linear System++++++++++++++++++++++++++++++++++++++++
[10] @F(t)       = z_A(t)*k(t-1)**alpha*l(t)**(1-alpha);
[10] @F_bar      = SS{@F(t)};
[11] @Fk(t)      = DIFF{@F(t),k(t-1)};
[12] @Fl(t)      = DIFF{@F(t),l(t)};
[13] @Fk_bar     = SS{@Fk(t)};
[14] @Fl_bar     = SS{@Fl(t)};

%Non-Linear First-Order Conditions++++++++++++++++++++++++++++++++++++++++++++++
# Evolution of physical capital
[0] k(t) * EXP(n + g) - ((1 - delta) * k(t-1) + i(t)) = 0;
        
# Aggregate resource constraint
[1] y(t) - c(t) - i(t) - g(t) = 0;

# production process
[2] y(t) - @F(t) = 0;

# labor is paid its marginal product
[3] w(t) - @Fl(t) = 0;

# capital is paid its marginal product
[4] R(t) - (1 + @Fk(t) - delta) = 0;

# consumption Euler equation
[5] 1 - EXP(-(rho + g)) * (c(t) / E(t)|c(t+1)) * E(t)|R(t+1) = 0;

# intra-temporal consumption/labor supply trade-off
[6] b * c(t) - (1-l(t)) * w(t) = 0;

# evolution of government spending (per effective worker!)
[7] LOG((E(t)|g(t+1))/(g(t))) - (n+g) - (E(t)|z_G(t+1)/z_G(t)) = 0;

# technology shocks
[8] LOG(E(t)|z_A(t+1)) - rho_A * LOG(z_A(t)) = 0;

# government spending shocks
[9] LOG(E(t)|z_G(t+1)) - rho_G * LOG(z_G(t)) = 0;

%Steady States [Closed form]++++++++++++++++++++++++++++++++++++++++++++++++++++
None
 
%Steady State Non-Linear System [Manual]++++++++++++++++++++++++++++++++++++++++
[0] (EXP(n + g) - 1.0 + delta) * k_bar - i_bar = 0;
[1] y_bar - c_bar - i_bar - g_bar = 0;
[2] y_bar - @F_bar = 0;
[3] w_bar - @Fl_bar = 0;
[4] R_bar - (1 + @Fk_bar - delta) = 0;
[5] R_bar - (1.0/EXP(-(rho + g))) = 0;
[6] b*c_bar - (1 - l_bar)*w_bar = 0;
[7] g_bar - y_bar*gov_share = 0;

# initial values for numerical steady-state computation
[0] k_bar = 5.0;
[1] y_bar = @F_bar;
[2] w_bar = @Fl_bar;
[3] R_bar = 1 + @Fk_bar - delta;
[4] b = 2.0;
[5] c_bar = 1.0;
[6] g_bar = y_bar * gov_share;
[7] i_bar = y_bar - c_bar - g_bar;

%Log-Linearized Model Equations+++++++++++++++++++++++++++++++++++++++++++++++++
None

%Variance-Covariance Matrix+++++++++++++++++++++++++++++++++++++++++++++++++++++
Sigma = [sigma_A**2    0;
         0    sigma_G**2]; 

%End Of Model File++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

