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 :doc:`Installation` (MATLAB R2023b or newer, and ``rise_startup`` has been run). 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. 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: .. code-block:: none %% 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 use ``X``, ``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_model`` gives the steady state in closed form here; if you don't have one, omit it and RISE will solve for the steady state numerically; - ``@parameterization`` ships parameter values with the file -- you can also set them later from MATLAB with ``set(m,'parameters',...)``. See :doc:`../DSGE_capabilities/Model Language/rise or dsge model language` for the full model language. 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 :doc:`../DSGE_capabilities/Local Approximation/Stochastic solution by perturbation`. 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 :doc:`../DSGE_capabilities/Stochastic Simulations/Master stoch simul`. 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 :doc:`../DataManagement/Data Management` time series matching the model's observables.) Maximum likelihood, Bayesian posterior sampling, indirect inference and conditional forecasting all build on this -- see :doc:`../Estimation/Main Estimation`. Where to go next ---------------- - :doc:`../DSGE_capabilities/Teaser/Teaser Example` -- a fuller worked example - :doc:`../DSGE_capabilities/Main DSGE Modeling` -- the DSGE chapter - the runnable ``examples/*/howto.m`` scripts that ship with the toolbox - :doc:`Finding help` and ``rise.doc`` (opens the PDF manual)