1.1. Model file language
A RISE model lives in a plain-text file with the extension .rs.
The file is read by the RISE parser when you call dsge_model('mymodel.rs')
and is converted into a model object on which the engines (solve,
estimate, filter, forecast, …) operate. This chapter is the
reference for everything you can write in that file. The name of the file
may contain blanks (dsge_model('my model') reads my model.rs); the
model itself is named without them (mymodel).
The model file describes the model: which variables exist, which parameters they depend on, and what equations they satisfy. It does not carry calibration, priors, or solve-time choices – those live in companion MATLAB files or as options on the relevant calls. See What does not go in the model file below.
1.1.1. Block keywords at a glance
A .rs file is a sequence of blocks, each introduced by an
@ keyword. The blocks may appear in any order; the parser
collects them and links them together.
Keyword |
Purpose |
|---|---|
|
Declare endogenous variables. |
|
Declare exogenous innovations (shocks). |
|
Declare parameters whose value does not switch. |
|
Declare parameters that switch across |
|
Declare the variables observed in estimation / filtering. |
|
The list of equations. Required. |
|
Closed-form steady state (optional but recommended for non-trivial models). |
|
Endogenous (time-varying) transition probabilities – one equation per off-diagonal entry per chain. |
|
Replace one or more equations with the first-order conditions of a planner’s problem (optimal policy). |
|
Equations solved with the model that are not constraints of the optimal-policy players, who take |
|
Cognitive discounting of the expectations of the variables listed (see Cognitive discounting). |
|
Equations evaluated after solve and filter, e.g. for diagnostics or to derive variables not needed in the solution. |
A complete minimal example – a three-equation New Keynesian model with two shocks – appears at the end of this chapter.
1.1.2. Declarations
Endogenous variables
Variables determined inside the model:
@endogenous y pi i
You can attach a comment to a variable; comments survive in the solution table and in plots:
@endogenous Y "Output", C "Consumption", PAI "Inflation",
R "Interest rate (net)"
Variables in logs. Tag a variable to be interpreted in logs by adding
(log) to the declaration:
@endogenous(log) Y C
@endogenous PAI R
The shorter form is one line per group, but you may also mix them in the same block:
@endogenous Y "Output" C "Consumption"
@endogenous(log) MU "Technology growth"
A log variable is solved for, and approximated, in logs, but its name
always means its level: in @model, @outside_optimization,
@transition_functions and @epilogue alike, Y stands for
the level of output, and RISE substitutes exp of the log it
stores. Write every block in levels.
Exogenous variables (shocks)
White-noise innovations – one per Gaussian shock you want to feed into the model:
@exogenous eps_m "Monetary shock", eps_a "Technology shock"
Parameters
Non-switching parameters:
@parameters beta sigma kappa phi_pi phi_y rho_g
std_eps_m std_eps_g
Switching parameters
A parameter that takes different values in different regimes of a
Markov chain is declared with @parameters(chain, N) where N
is the number of states of the chain:
@parameters(mon,2) phi_pi
@parameters(fis,2) gamma_b
This declares two chains – mon and fis – each with two
states. phi_pi takes two values; gamma_b takes two values.
The model has 2 x 2 = 4 composite regimes.
You can label the regimes inline:
@parameters(zlb,2,"normal times","lower bound") gam
The labels appear in solution tables and plots.
The chain is introduced by its first appearance as the first
argument of @parameters(chain,N); the user names it there.
The transition probabilities are declared either as ordinary
parameters (constant probabilities) or as equations in a
@transition_functions block (endogenous / time-varying
probabilities); see Markov chains below.
Observables
The variables you observe in the data when filtering or estimating:
@observables y pi i
There must be at least as many shocks as observables, otherwise the predicted observation covariance becomes singular (“stochastic singularity”).
1.1.3. The @model block
The @model block contains the equations. Each equation ends with
;. Equations may span several lines.
Time indexing
Variables are indexed by time. Three equivalent notations are
available; the {...} form is recommended for readability:
x{t} x{t-1} x{t+1} % explicit time index
x x{-1} x{+1} % t implicit, offsets explicit
x x(-1) x(+1) % parenthesis form
A steady-state value of a variable is written {stst}:
R{stst} % steady-state value of R
R(stst), R{ss}, R(ss), R{sstate} and R(sstate) mean the
same. The function forms stst(R) and stst(R{+1}) are also accepted. In a
model with a balanced growth path, the steady state of the lead of a
growing variable moves with the trend: see Steady states of growing variables in the dynamic equations.
Equation labels
A quoted string immediately before an equation labels it. The label appears in error messages, in printed solutions, and in historical decompositions:
"Dynamic IS curve"
x{t} = x{t+1} - (1/sigma)*(i{t} - pi{t+1}) + g{t};
"Phillips curve"
pi{t} = beta*pi{t+1} + kappa*x{t};
Auxiliary definitions
A line that begins with # inside @model introduces a
short-hand. It is substituted into subsequent equations at parse
time:
@model
# rho_theta = rho_e;
# phi = (thetass-1)/psi;
# sig_theta = sig_e*phi;
log(THETA) = (1-rho_theta)*log(thetass)
+ rho_theta*log(THETA{-1})
+ sig_theta*EPS_THETA;
Definitions can reference each other in declaration order and may use any parameter or steady-state value already declared.
Definitions with a date
A definition used with a date is the definition at that date, as a
dated parameter is. With # b = 2*a;, b{+1} is 2*a{+1}: in a
regime-switching model, twice the intercept of the regime of the next
period, whose expectation averages the regimes that can follow. Every
spelling of a date works: b{+1}, b(+1), b{t+1} and
b(t+1) are the same, and so are b, b{0} and b{t}.
b{stst} (or b{ss}, b{sstate}) is the steady state of
b, that is b.
Kept (the default), a dated definition gets the auxiliary variable a
dated parameter gets, AUX_b{t} = b, and b{+1} becomes
AUX_b{t+1}. One auxiliary serves every lead and lag of b.
With definitions_inserted = true the definition is replaced by its
expression, and every time-indexed atom of the expression moves to the
date: with # g = X{-1};, g{+1} is X and g{-1} is
X{-2}. A steady-state reference such as X{stst} stays a
steady-state reference.
Refused, each with its identifier:
A date inside the body of a kept definition, as in
# c = b{-1} + a;or# c = a{-1};(rise:parser:datedDefinitionBody). A kept definition is a function of the parameters att. When all its atoms share one date, write that date where the definition is used,c{-1}; an expression whose atoms have different dates, such asb{-1} + a, keeps them only withdefinitions_inserted = true.A definition with the name of a variable or a shock of the model, or with a name that is not valid (
rise:parser:definitionName). A definition named as a parameter or as another definition is refused as a duplicate declaration.A variable named
AUX_xwherexis a dated parameter, definition or shock (rise:parser:reservedName):AUX_xis the name of the auxiliary ofx.A dated parameter or definition in
@transition_functions(rise:parser:datedConstantInTransitionFunction) or in@epilogue(RISE:epilogue:timeIndexedParameter): neither has a path to shift.
The tutorial ModelShapes/dated_definitions checks dated values,
inserted definitions and the four new refusal identifiers.
Steady-state-form companion equations
A dynamic equation may be followed by # and a simpler
steady-state form, separated from the rest of the equation by a
# token and terminated by the same ;. RISE uses the
steady-state form when computing the deterministic steady state,
which often converges much faster than evaluating the full dynamic
equation at the steady state:
"Euler equation"
-B*LAMBDA + betad*B{+1}*LAMBDA{+1}*(1+R)/PAI{+1} = 0
#
1+R = PAI*exp(MU)/betad
;
Both forms have to be mathematically consistent at the steady state.
Including files and conditional code
@include "file.rs" replaces its line by the content of the file.
A relative name is sought in the folder of the file that includes it,
then in the current folder and on the MATLAB path. Without an
extension, .rs, .rz and .dsge are tried. Only the last dot
starts an extension: @include "block.v2" reads block.v2.rs.
A file that includes itself, directly or through other files, is an
error that names the files of the cycle (rdico:preparse:includeCycle);
a file included twice without being inside itself is read twice.
@if, @elseif, @else and @end keep the lines of one
branch and drop the others. A condition is a MATLAB expression of the
flags passed with dsge_model(..., 'rise_flags', struct(...)):
@if strcmp(policy,'optimal')
@include "optimal_policy.rs"
@else
@include "taylor_rule.rs"
@end
The includes of a branch that is not taken are not read, so their
files need not exist. A name in a condition that is not a flag is
false, with a warning (rdico:preparse:undefinedFlag), so that
@if ~x is true when x is not a flag. Any other condition that
cannot be evaluated, or that gives no true or false value, is an error
(rdico:preparse:ifCondition). Blanks may follow the @:
@ if, @ else and @ end are accepted.
1.1.4. Steady state
A model file describes the model; the steady state belongs in
a separate function. The reason is the same as the reason
calibration belongs in a separate function: a model and
its steady state are two different things, and either can change
without the other. Conflating them inside the .rs file is bad
practice.
Steady-state file (recommended)
Write a MATLAB function – the name is your choice – with the full steady-state callback signature:
[y, newp, retcode] = my_steady_state(m, y, p, d, id)
RISE first calls it with only the model object m: return the
names of the variables you calculate in y, and the names of any
parameters you update in newp. On the calculation call, y
contains the current steady-state values, p the parameter struct,
d the definitions struct, and id the locations of those
variables. Update y(id,:) and return it, with an updated-parameter
struct (or []) in newp and retcode = 0 on success.
For a nonstationary model, y has two columns: reference level
and growth. See Anatomy of a steady-state file for the full protocol and a complete
nonstationary callback.
Point RISE at the function via the sstate_file option:
m = set(m, sstate_file = 'my_steady_state');
There is no enforced naming convention: my_steady_state,
compute_ss, model_ss, anything works. The convention
<modelname>_sstate.m is a habit, not a requirement.
The steady-state file is regime-agnostic: the same function
uses the parameter struct supplied for each regime, without
branching on chain states. A parameter implied by a steady-state
condition is calculated there and returned in newp.
@steady_state_model block (in-file alternative)
The steady state may also be written directly inside the model
file in a @steady_state_model block:
@steady_state_model
A = 1;
Y = (thetass-1)/thetass*(zss-beta*gam)/(zss-gam);
C = Y;
...
The block is evaluated, not solved – the right-hand side may reference parameters and earlier steady-state expressions in declaration order. The separate steady-state file is the recommended pattern; the in-file block is available when keeping everything in one file is the user’s preference.
For a nonstationary model, an endogenous assignment can return
[reference_level, growth]. Save this complete example as
bgp_example.rs:
@endogenous(log) x
@model
x = 1.05*x{-1};
@steady_state_model
x = [1, 1.05];
Here x is log-declared: the first entry, 1, is its reference
level, and the second, 1.05, is its gross growth factor
(5 percent per period), not 0.05 or log(1.05). Its balanced
growth path is x_t = 1.05^t when the reference date is t = 0.
The reference level chooses a point on that path.
Enable the balanced-growth solve next to the model call:
m = rise('bgp_example');
[m, retcode] = solve(m, solve_bgp = true);
assert(retcode == 0);
level = get(m, 'sstateLevel'); % level.x = 1
growth = get(m, 'bgpLevel'); % growth.x = 1.05
The growth convention follows the variable declaration. For a
log-declared variable such as x, supply its level and gross
factor; for an ordinary level variable, supply its value and
additive growth per period (0 for no growth). The bgpLevel
getter reports the gross factor for x; bgp reports its log
growth, log(1.05), in the model’s internal coordinates.
No steady-state specification
When neither a sstate_file nor a @steady_state_model is
provided, RISE attempts a numerical steady-state solve from a
default initial guess of zero. This works for log-linearized
models whose steady state is zero by construction.
1.1.5. Markov chains
RISE handles Markov-switching as a first-class concept. A chain is
introduced by writing parameters that switch on it (via
@parameters(chain,N)) and by declaring its transition
probabilities – either as constant parameters or as equations in
a @transition_functions block.
Constant transition probabilities
For a chain mon with N states, the off-diagonal transition
probabilities are declared as ordinary parameters with the name
pattern mon_tp_<i>_<j>:
@parameters mon_tp_1_2 mon_tp_2_1
@parameters(mon,2) phi_pi
The pattern is the whole name: mon_tp_1_2_gap is an ordinary name.
The diagonal probabilities mon_tp_1_1 and mon_tp_2_2 are
inferred (each row of the transition matrix must sum to 1) and
must not be declared explicitly.
Calibrate them like any other parameter:
p.mon_tp_1_2 = 0.05;
p.mon_tp_2_1 = 0.05;
p.phi_pi_mon_1 = 2.5;
p.phi_pi_mon_2 = 0.7;
m = set(m, parameters = p);
Endogenous transition probabilities
When the probabilities depend on endogenous variables (TVTP),
declare them as equations in a @transition_functions block:
@parameters p_min "transition-prob floor",
p_max "transition-prob ceiling",
theta_zlb "sensitivity to log(B)"
@parameters(zlb,2,"normal times","lower bound") gam
@transition_functions
"Probability normal -> bound: rises as preference demand falls"
zlb_tp_1_2 = p_min + (p_max - p_min) / (1 + B^theta_zlb);
"Probability bound -> normal: rises as preference demand recovers"
zlb_tp_2_1 = p_min + (p_max - p_min) / (1 + B^(-theta_zlb));
The right-hand side may reference any endogenous variable, parameter,
or steady-state value. A parameter or a definition has no path: one with a
lead or a lag, such as b{-1}, is refused when the model is read
(rise:parser:datedConstantInTransitionFunction). Keep the probabilities strictly interior
(0 < p < 1) unless a boundary is intended. A probability of zero
makes that move impossible and a probability of one makes it certain;
what this does to the chain depends on the whole transition matrix. A
regime is absorbing when its probability of staying is one: in the
two-regime chain above, zlb_tp_1_2 = 0 makes regime 1 absorbing,
while zlb_tp_1_2 = zlb_tp_2_1 = 1 has no absorbing regime and
alternates the regimes every period.
Occasionally-binding constraints
An OBC is a Markov chain whose switching is determined endogenously by the binding state of the constraint, not by exogenous probabilities. Declare the chain in the usual way:
@parameters(zlb,2) bind
with the constraint encoded in the model:
i{t} = bind*i_floor + (1-bind)*i_taylor{t};
and tell solve to honor the constraint at solve time (see
Modeling -> Solving). The transition probabilities of an OBC
chain must be zero (the switching is endogenous, not stochastic);
solve enforces this.
1.1.6. Optimal policy
When you want one equation in the model to be replaced by the
first-order conditions of a planner’s problem – i.e., to choose an
instrument optimally rather than according to a rule – declare an
@optimization_problem block.
Single-player problem
@optimization_problem{
@objective = -0.5*(pi^2 + lambda_y*y^2 + lambda_i*i^2),
@discount = beta
}
@model
% no Taylor rule -- i is the planner's instrument, chosen
% to minimize the discounted sum of -objective
y{t} = y{t+1} - (1/sigma)*(i{t} - pi{t+1}) + g{t};
pi{t} = beta*pi{t+1} + kappa*y{t};
...
A single planner needs no @instrument: it chooses every
endogenous variable subject to the equations of @model, and RISE
takes the first-order conditions with respect to all of them (the
variables of an @outside_optimization block excepted). How the
equations are written, and which variable sits on a left-hand side,
plays no role. With several players, @instrument is required for
each. The choice between commitment and discretion is made at solve
time:
m = solve(m, solve_policy_type = "ramsey"); % commitment
m = solve(m, solve_policy_type = "discretion");
There is no @commitment parameter and no @-prefixed marker
in the model file – the solve choice is an option, not a model
property.
Multi-player problem (Nash, Stackelberg)
Two players with separate objectives and instruments:
@optimization_problem[@no_u_turn=false]{
Monetary:
@order = 1
@discount = beta
@objective = -0.5*(pi^2 + lambda_y*y^2 + lambda_i*i^2)
@instrument = i ;
Fiscal:
@order = 2
@discount = beta
@objective = -0.5*(tau^2 + lambda_b*b^2)
@instrument = tau ;
}
When all players have the same @order, the game is Nash. When
the orders differ, it is a Stackelberg cascade with the lower
@order as the leader.
1.1.7. Cognitive discounting
@cognitive_discount (Gabaix-style bounded rationality) shrinks the
expectation of the variables it lists toward a reference point:
@cognitive_discount C, PI
creates one parameter mcd_<V> per variable (default 1, rational
expectations) and replaces every lead V{t+1} of a listed variable by
in the coordinates of the dynamic equations (the log of a log variable).
@cognitive_discount @all_but X lists every endogenous variable except
X; @cognitive_discount(chain,N) ... makes the mcd_ parameters
switch with a Markov chain. The operator applies to leads only, never to
lags; leads beyond one period are first rewritten into one-period
auxiliaries. In an optimal-policy model it applies to the formed system,
the planner’s first-order conditions included.
The reference point \(R_{V,t+1}\) is
for a stationary variable, its steady state (Gabaix’s discounting);
for a nonstationary variable, one that grows on the balanced growth path (a random walk with drift, a price level under a nonzero inflation target), its own current value grown at its own steady-state growth, \(V_t + g_V\) (for a log variable, \(V_t\) times its gross growth factor).
In one formula, \(R_{V,t+1} = \mathrm{stst}(V_{t+1}) +
\lambda_V\,(V_t - \mathrm{stst}(V_t))\), where the parameter
cdlambda_<V> (\(\lambda_V\), 1 or 0) is set after every
steady-state solve. In a model declared nonstationary (solve_bgp
true):
a variable whose steady-state growth is not zero in some regime gets its previous value plus its growth (\(\lambda_V = 1\));
a variable whose growth is zero in every regime and whose level the steady-state system does not pin down (a unit root without drift) gets its previous value (\(\lambda_V = 1\));
any other variable gets its steady state (\(\lambda_V = 0\)).
In a model not declared nonstationary every variable gets its steady
state. The check of the zero-growth variables is computed once, at the
first steady-state solve, and reused afterwards, also at every estimation
draw; it is redone only when the set of zero-growth variables changes.
Nothing has to be declared besides solve_bgp and the equations are not
searched for trend variables. cdlambda_<V> does not switch: in a
regime where the variable does not grow, its growth there is 0 and the
formula still holds.
With this reference the discounted model has a balanced growth
path for every mcd_V: RISE solves at one point of the path and uses that
solution all along it, and \(V_t + g_V\) moves one for one with the
trend.
Two cases worth knowing:
the price level: with
p = p{-1} + pi(log level) and a nonzero targetpis, the discountedp{+1}isp + pis + m*(pi{+1} - pis). Discounting the price level is discounting expected inflation (withpis = 0the price level does not grow; its level is not pinned down, so its reference isp);consumption on a random-walk technology
A: the discountedC{+1}is((1+mu)*C)^(1-m) * C{+1}^m. The reference follows consumption, not the realized technologyA{+1}: households shrink their forecast of consumption growth toward its mean.
Tagging a growing variable and tagging its detrended counterpart are
different models. With the Euler equation C{+1}*(1+PI{+1}) =
beta*(1+R)*C and a technology A that is a random walk with drift
mu (gross growth 1+mu, \(g=\log(1+\mu)\)), tagging C and
PI gives, to first order,
Expected consumption growth is discounted, and it reacts to the real rate
by \(1/m_C\). Tagging c = C/A in the detrended model discounts the
consumption gap instead, as in Gabaix (2020):
\(\log c_t = m_c\,E_t \log c_{t+1} - (\ldots)\). With iid shocks the
impact response of log(C/A) to a policy shock of size sig_r is
-sig_r/(m_C+phi*kappa) in the first case and -sig_r/(1+phi*kappa)
in the second (phi the response of the policy rate to inflation,
kappa the slope of the Phillips curve PI = beta*PI{+1} +
kappa*log(C/A)). Tag the variable whose expectation you mean to discount.
A stst(V{+1}) written in a dynamic equation is the same reference (see
Steady states of growing variables in the dynamic equations), so a discounting written by hand and one
made by @cognitive_discount coincide.
1.1.8. Epilogue
Equations that are not needed to solve the model but should be
evaluated on the paths the model produces – diagnostics, accounting
identities, output transformations – live in an @epilogue
block:
@epilogue
"Annualised inflation"
pi_ann = 400*pi;
"Ex-post real interest rate"
r_real = i - pi{+1};
"Inflation over the last four quarters"
pi_4q = pi + pi{-1} + pi{-2} + pi{-3};
Epilogue equations may reference any endogenous variable but they
do not affect the solution. They are evaluated after the fact,
which keeps the dynamic system small. An entry may be labeled like an
equation of the model, and may use other entries, in any order (RISE
sorts them; a cycle is an error, RISE:epilogue:cyclicDependency).
An entry cannot use its own series, current or dated: q = q{-1} + y
is refused (RISE:epilogue:selfReference), since each entry is
computed once, from the others.
Where the series appear
Each entry becomes a series, computed on the path the output holds, in the output of
simulate, and so offorecast, which simulates. A forecast’s path starts at the last date of history, so an entry with a lag has no value on that date;perfect_foresight;counterfactual, on the counterfactual and on the actual path;brute_force_simulate;filter: the smoothed, filtered and updated variables.
irf has none. An impulse response is a deviation, and an entry
with a constant or a nonlinearity is not the response of that entry:
pi_ann above would come out right, 400*(pi-1) would not. For
the response of an entry, simulate with and without the shock and take
the difference of the entry.
A parameter in an entry has the value of the parameterization that produced the path; with several parameterizations, each page of the output has its own. A switching parameter follows the regime path of a simulation. The other outputs carry no regime path, and there it takes its value in the first regime.
With measurement errors the observables in the output of simulate
are complex, the error in the imaginary part. An entry is a function of
the model’s variables and is evaluated on the real parts.
The entries of @transition_functions are evaluated in the same way,
so each transition probability has a series of its own, under its name
(zlb_tp_1_2), in all these outputs: the function evaluated on the
path at each date. See
Time-varying transition probabilities
for the probabilities the simulation itself used.
Leads and lags in the epilogue
An epilogue entry is computed from a path RISE has already computed,
so a lead or a lag in it is a literal shift of that path, not an
expectation. In r_real above, pi{+1} is the inflation that
followed; in @model the same expression is the inflation agents
expect. Hence:
Leads and lags may be of any order, on endogenous and exogenous variables and on other epilogue entries. They add nothing to the model: none of the auxiliary variables
@modelgets for its leads and lags beyond one and its dated shocks (LEAD_,LAG_,JLEAD_,AUX_) is created for them, and the model is the same with or without the epilogue.A series has no value where its path runs out: a lead of
kleaves the lastkperiods empty, a lag ofkthe firstk.Every time notation of the model block works:
x{t+2},x{+2}andx(+2)are the same series, and so for lags.A parameter or a definition has no path. One with a lead or a lag, such as
beta{+1}, is refused when the model is read, with the equation and the name (identifierRISE:epilogue:timeIndexedParameter);beta{t}isbeta.An exogenous variable is available only on a path that carries it. The outputs of
simulate,forecastandperfect_foresightcarry every exogenous variable. The variablesfilterreturns and the outputs ofcounterfactualandbrute_force_simulatecarry an exogenous variable that is observed, never a shock: an entry that uses a shock is left out of them, and so is an entry that uses that one.
For an expectation, write the variable into @model instead. The
tutorial ModelShapes/epilogue_leads_and_lags writes
I - PI{+1} in both blocks: the expected real rate in @model,
the realized one in @epilogue.
1.1.9. What does not go in the model file
The model file describes the model. By the modern convention several things are kept out:
Numerical parameter values
A calibration function returns a struct of parameter values. Its name
is arbitrary; RISE receives the returned struct, not the function name.
For example, save this function in calibration.m:
function p = calibration()
p = struct();
p.beta = 0.99;
p.sigma = 1.0;
p.kappa = 0.30;
...
end
and is bound to the model with set:
m = set(m, parameters = calibration());
This keeps model and calibration on independent change cycles.
The .rs file may also carry a @parameterization block;
a separate function keeps the calibration reusable. Each
statement of the block ends with a semicolon, the last one too (a
statement without it is an error,
rdico:parameterization:unterminated), and may span several lines.
A field is any MATLAB expression that gives one number; the commas
inside a call do not separate fields:
@parameterization
rho = max(0.4,0.5);
sig, 0.01, 0.001, 0.1;
Steady-state values
Same reasoning, applied to the steady state. The steady-state
function (a plain MATLAB file, name of your choice) is bound via
sstate_file:
m = set(m, sstate_file = 'my_steady_state');
The @steady_state_model block inside the model file is also
supported when keeping everything in one file is the user’s
preference. See Steady state above.
Solve-time choices
Choices about how the model is solved – commitment vs discretion,
perturbation strategy, solver, solve paradigm, …
are options on the solve call, not declarations in the model
file:
m = solve(m, solver = '+mn', solve_policy_type = "ramsey");
The model file does not change when you switch from commitment to discretion.
Estimation priors
Any MATLAB function can return the calibration and prior structs,
as separate outputs or in separate functions. The name and any suffix
are your choice. For example, calibration_and_priors.m can contain:
function [p, priors] = calibration_and_priors()
p = struct();
p.beta = 0.99;
...
priors = struct();
priors.kappa = {0.30, 0.10, 0.60, 'beta(0.9)', 1e-6, 0.999};
...
end
Call the function, then pass its returned structs to set:
[p, priors] = calibration_and_priors();
m = set(m, parameters = p, estim_priors = priors);
Priors may also be declared inside the .rs file’s
@parameterization block. A separate function keeps priors, an
estimation choice, independent of the model. RISE has no _params
or _est_params naming convention: any function returning the
required structs can supply them.
Comments
%or//starts a line comment: the rest of the line is ignored. A%or a//inside a quoted description belongs to the description, so a description may hold a URL.A block comment opens with a line whose first word is
%{or/*and closes with a line whose first word is%}or*/. Those two lines and every line between them are ignored, so put each delimiter on a line of its own. Block comments do not nest: an opening delimiter inside a block is an error. A block comment that is never closed is an error too, naming the line where it opens (rdico:unclosedBlockComment):