1.5. Quickstart
This page takes you from a fresh install to a solved model, impulse responses,
and a simulation – all in a few lines. It assumes you have followed
Setting up your RISE environment (MATLAB R2023b or newer, and rise_startup has been run).
1.5.1. The fastest check
Once rise_startup has run,
rise.demo % or: rise_demo
builds, solves and inspects a small DSGE model and reports each step. If it ends
with “RISE Installation Check Passed!” you are ready to go. The rest of this
page walks through (essentially) what rise.demo does, so you can adapt it.
1.5.2. Step 1 – write a model file
A RISE DSGE model lives in a text file ending in .rs (or .rz /
.dsge). Save the following as ngm.rs – a textbook neoclassical growth
model:
%% Neoclassical Growth Model
@endogenous A "Technology"
@endogenous(log) C "Consumption", K "Capital", Y "Output", I "Investment"
@parameters beta "discount factor", alpha "output elasticity of capital",
delta "depreciation rate", varphi "persistence of technology shock",
sigma "standard deviation of technology shock"
@exogenous EPSILON "Technology shock"
@model
"Consumption Euler equation"
- 1/C{t} + beta*(alpha*exp(A{t+1})*K{t}^(alpha-1) + 1-delta)/C{t+1} = 0 ;
"Capital accumulation"
K{t} = (1-delta)*K{t-1} + I{t};
"Output"
Y{t} = exp(A{t})*K{t-1}^alpha;
"Resource constraint"
Y{t} = C{t} + I{t};
"Technology shock"
A{t} = varphi*A{t-1} + sigma*EPSILON{t};
@steady_state_model
A = 0;
K = (alpha*exp(A)/(1/beta - 1 + delta))^(1/(1-alpha));
I = delta*K;
Y = exp(A)*K^alpha;
C = Y - I;
@parameterization
beta = 0.98;
alpha = 0.33;
delta = 0.02;
varphi = 0.98;
sigma = 0.05;
A few things worth noticing:
variable timing is written
X{t},X{t+1},X{t-1}(you may also useX,X{+1},X{-1});@endogenous(log) C, K, ...declares variables to be approximated in logs;equation labels (the strings before each equation) are optional but show up in reports and diagnostics;
@steady_state_modelgives the steady state in closed form here; if you don’t have one, omit it and RISE will solve for the steady state numerically;@parameterizationships parameter values with the file – you can also set them later from MATLAB withset(m,'parameters',...).
See Description for the full model language.
1.5.3. Step 2 – load and solve
m = rise('ngm'); % parse the model file (the .rs extension is optional)
m = solve(m); % perturbation solution (1st order by default)
print_solution(m) % look at the solution
To go to a higher-order approximation, pass the order to solve (e.g.
solve(m,'solve_order',2)); see
Stochastic solution via perturbation.
1.5.4. Step 3 – impulse responses and a simulation
stoch_simul is the Dynare-like one-stop call – it solves, then returns
impulse responses, theoretical moments and a simulation:
info = stoch_simul(m);
quick_irfs(m, info.irfs) % plot the IRFs
quick_plots(m, info.simulations, ...
'var_list', get(m,'endo_list(original)')) % plot the simulated paths
You can also call the pieces directly – irf(m), simulate(m),
theoretical_moments(m), variance_decomposition(m), forecast(m,...) –
see Stochastic simulations.
1.5.5. Step 4 – estimating a model
Estimation follows the same object-oriented pattern: declare @observables in
the model file, build the model, attach data and priors, and call estimate:
m = rise('ngm');
p = struct();
p.alpha = {0.30, 0.20, 0.40, 'beta'}; % {start, mean, std, distribution}
p.varphi = {0.90, 0.80, 0.10, 'beta'};
mest = estimate(m, 'data', db, 'priors', p, ...
'estim_start_date', '...', 'estim_end_date', '...');
(db is a structure of Time Series and Data Management time series
matching the model’s observables.) Maximum likelihood, Bayesian posterior
sampling, indirect inference and conditional forecasting all build on this –
see Bayesian Estimation.
1.5.6. Where to go next
Hit the ground running : An introductory example – a fuller worked example
DSGE Modeling – the DSGE chapter
the runnable
examples/*/howto.mscripts that ship with the toolboxFinding help and
rise.doc(opens the PDF manual)