RainbowStats™ · DSGE commands
ADD_DSGE_EQUATION
Append a linear or affine equation.
Syntax
M=ADD_DSGE_EQUATION(M,"equation")Retain returned model updates
Always assign model-building results back to the model variable. Use M=ADD_DSGE_EQUATION(M,...), M=COMPILE_DSGE(M), M=SOLVE_DSGE(M) and M=SET_DSGE_INITIAL(M,...). Unassigned calls are not a reliable way to retain updates in the script evaluator. Model-building commands return a model; FORECAST_DSGE returns a presentation.
Complete runnable example
M=DSGE_MODEL()
M=ADD_DSGE_SHOCK(M,"EPS")
M=ADD_DSGE_EQUATION(M,"X=0.5*LAG(X,1)+EPS")
M=COMPILE_DSGE(M)
M=SOLVE_DSGE(M)
M=SET_DSGE_INITIAL(M,"X",2)
FORECAST_DSGE(M,12)The first displayed point is 2, followed by 1 and 0.5. The registered EPS innovation is zero during this deterministic forecast.
Behavior and interpretation
Keep the entire equation in quotes. Supported syntax includes +, -, *, /, parentheses, registered scalar parameters, LAG(variable,1) and LEAD(variable,1). A scalar coefficient times a variable is linear; products of endogenous variables or division by an endogenous variable are not supported.
Constants are supported, for example "X=0.96*LAG(X,1)+0.0208". These are affine equations and may describe levels. The command does not derive a linearization from nonlinear economic equations.
Adding an equation invalidates compiled and solved results. Retain the returned model and compile and solve the revised definition before forecasting.
Alias: ADD_EQUATION.
Model extracts and prerequisites
Use EXTRACT(M,"key") on the retained model. Definition metadata such as equations and parameters can be inspected before solving; coefficient matrices require compilation; solution diagnostics, transition matrices and impulse-response results require a successful solve and may depend on model settings.
In parameter:name, setting:name and result:name, replace name with an actual name. For a registered shock EPS, the impulse-response key pattern is impulse_response_chart_EPS or impulse_response_data_EPS, subject to result availability. Do not treat registration as an applied forecast shock.
Error handling
If a build, compile or solve step returns an error or diagnostic string instead of a model, stop and correct that step. Do not assume that later commands can forecast an unchanged or unsolved model.
Available extracts
Save the command result in a variable, then use EXTRACT(result, "key"). Availability can depend on the input form and fitted model.
modelsummaryequationsparameterssettingsslideshowparameter:namesetting:nameresult:namelead_matrixcurrent_matrixlag_matrixshock_matrixconstant_vectortransition_matrixshock_impact_matrixintercept_vectoreigenvaluesspectral_radiuspolicy_residualsolver_iterationsstabilitysolver_summaryimpulse_response_chart_SHOCKimpulse_response_data_SHOCK
In indexed patterns such as beta:n, replace n with the required index.