# GRO1 Stochastic growth model

## Model's structure

Response variable Consumption ($C$).

State variable Capital stock ($K$), Log of productivity ($Z$).

Shock Innovation to productivity ($\epsilon$).

Parameters Capital depreciation rate ($\delta$), Discount factor ($\beta$), Elasticity of intertemporal substitution ($\tau$), Capital share ($\alpha$), Scale parameter ($a$).

Equilibrium equation

$C_{t}: C_{t}^{-\tau}=\beta\mathrm{E}_{t}\left[C_{t+1}^{-\tau}\left(1-\delta+a \alpha e^{Z_{t+1}}K_{t+1}^{\alpha-1}\right)\right].$

Transition equations

$K_{t}: K_{t}=a e^{Z_{t-1}}K_{t-1}^{\alpha}+\left(1-\delta\right)K_{t-1}-C_{t-1},$

$Z_{t}: Z_{t}=\rho Z_{t-1}+\epsilon_{t}.$

## Writing the model

The model is defined in a Yaml file: gro1.yaml.

## Create the model object

Mean and standard deviation of the shocks

Mu                = 0;
sigma             = 0.007;


You generate the MATLAB model file and pack the model object with the following command

model = recsmodel('gro1.yaml',...
struct('Mu',Mu,'Sigma',sigma^2,'order',5));

Deterministic steady state (different from first guess, max(|delta|)=1.75094e-08)
State variables:
1	1.627e-18

Response variables:
0.1993

Expectations variables:
26.51



This command creates a MATLAB file, gro1model.m, containing the definition the model and all its Jacobians from the human readable file gro1.yaml.

## Define approximation space using Chebyshev polynomials

Degree of approximation

order         = [10 10];


Limits of the state space

smin          = [0.85*model.sss(1) min(model.e)*4];
smax          = [1.15*model.sss(1) max(model.e)*4];

[interp,s] = recsinterpinit(order,smin,smax,'cheb');


## Find a first guess through first-order approximation around the steady state

[interp,x] = recsFirstGuess(interp,model,s,model.sss,model.xss);


## Define options

With high order Chebyshev polynomials, extrapolation outside the state space should not be allowed to prevent explosive values.

options = struct('reesolver','krylov',...
'extrapolate',0    ,...
'accuracy'   ,1);


## Solve for rational expectations

interp = recsSolveREE(interp,model,s,x,options);

Newton-Krylov solver
Major  Residual  Minor 1  Relative res.  Minor 2
0  1.32E-04        0       1.00E+00        0 (Input point)
1  2.70E-05        1       2.04E-01        0
2  1.88E-05        1       6.97E-01        0
3  2.79E-06        2       1.49E-01        0
4  4.96E-08        3       1.78E-02        0
5  1.12E-09        4       2.27E-02        0


## Simulate the model

[~,~,~,stat] = recsSimul(model,interp,model.sss(ones(1000,1),:),200,[],options);
subplot(2,2,1)
xlabel('Capital stock')
ylabel('Frequency')
subplot(2,2,2)
xlabel('Log of productivity')
ylabel('Frequency')
subplot(2,2,3)
xlabel('Consumption')
ylabel('Frequency')

Statistics from simulated variables (excluding the first 20 observations):
Moments
Mean      Std. Dev. Skewness  Kurtosis  Min       Max       %LB       %UB
1.0007    0.0265    0.1128    3.0084    0.8947    1.1053
-0.0000    0.0159    0.0027    2.9986   -0.0716    0.0718

Columns 1 through 7

0.1993    0.0034    0.0805    2.9904    0.1855    0.2130         0

Column 8

0

Correlation
1.0000    0.5229    0.9481
0.5229    1.0000    0.7667
0.9481    0.7667    1.0000

Autocorrelation
1         2         3         4         5
0.9940    0.9800    0.9595    0.9336    0.9033
0.8772    0.7680    0.6723    0.5866    0.5112

0.9732    0.9426    0.9090    0.8728    0.8349

Accuracy of the solution
Euler equation error (in log10)
Max       Mean
-4.6091   -6.6485

Equilibrium equation error (in log10 units)
Max       Mean
-2.9649   -4.9531