1.16. Automatic translation of files

RISE can automatically translate model files written for the model languages of other DSGE toolboxes into RISE model files. Three translators are provided:

  • dynare2rise converts a model file written in a common external format;

  • dynare_sstate_file2rise converts the steady-state file that accompanies such a model;

  • aim2rise converts a model file written in a second external format.

The same translators ship with the modern toolbox; only the way you call the resulting RISE model differs (dsge_model(...) rather than the legacy rise(...)).

1.16.1. Importing a model file

dynare2rise – converts a basic model file, written in a common external format, into a RISE one.

duplicates = dynare2rise(dynFileName)
duplicates = dynare2rise(dynFileName, riseFileName)
duplicates = dynare2rise(dynFileName, riseFileName, stderr_name)
duplicates = dynare2rise(dynFileName, riseFileName, stderr_name, detrend)
[duplicates, listOfFilesCreated] = dynare2rise(...)

Args:

  • dynFileName [char] : name of the model file to convert, with or without its extension (.mod or .dyn).

  • riseFileName [char | {'dynFileName.rs'}] : name of the created RISE file.

  • stderr_name [char | {'std'}] : prepended name for the newly created parameters (RISE transforms every variance / standard deviation in the imported model file into a parameter).

  • detrend [true | {false}] :

    • when true, the model is written in stationary form. For log-growth variables, y --> (y * trend). For linear-growth variables, y --> (y + trend). The steady state model of the imported model file then corresponds exactly to the steady state file produced by RISE, except that trend variables are added as new variables.

    • when false, the model is kept in non-stationary form. For log-growth variables the growth rate in an expression of the form f(x) becomes log(f(exp(x))). The growth rate for linear-growth variables is unchanged. Variables detected to have steady state 0 but that need to be stationarized are assigned a growth rate of 0 and declared as LEVEL variables. The steady state is unchanged.

    • The steady state for all trend variables with log growth is normalized to 1; the steady state for trend variables with linear growth is normalized to 0.

Returns:

  • duplicates [struct] : structure containing information on the redundancies.

  • listOfFilesCreated [cellstr] : list of files created.

Note

The created files are:

  • riseFileName.rs

  • riseFileName_params.m – parameter function file with calibration and priors as separate outputs.

  • riseFileName_sstate.m (optional) – steady-state function file.

These suffixes name translator-generated files; they are not a RISE naming convention. A hand-written calibration or prior function can have any name and supply its returned structs to set.

When riseFileName has a folder (out/mymodel.rs), the files are written in that folder and the functions in them are named after the file alone (mymodel_params, mymodel_sstate). A file that the original file includes is sought in the folder of the file that includes it first, then in the current folder and on the MATLAB path.

After translation, build the model with the modern factory:

m = dsge_model('riseFileName');

(The legacy documentation invoked the model with rise('riseFileName') – only the constructor differs.)

1.16.2. Importing a steady-state file

dynare_sstate_file2rise – translates the steady-state file of an imported model into a RISE-compatible function handle. The translator is a thin wrapper.

Syntax:

risefile = dynare_sstate_file2rise(dynfile)

Inputs:

  • dynfile [char | function_handle] : steady-state file of the imported model. If provided as a character array, it is converted to a function handle.

Outputs:

  • risefile [function handle] : RISE-compatible function handle that set(m, sstate_file = risefile) accepts directly.

Example:

risefile = dynare_sstate_file2rise('NK_baseline_steadystate');
m        = set(m, sstate_file = risefile);

1.16.3. Importing a model file in the second format

aim2rise – converts a basic model file, written in a second external format, into a RISE one.

duplicates = aim2rise(aimFileName)
duplicates = aim2rise(aimFileName, riseFileName)
duplicates = aim2rise(aimFileName, riseFileName, stderr_name)

Args:

  • aimFileName [char] : name of the model file to convert, with or without its extension (.aim).

  • riseFileName [char | {'aimFileName.rs'}] : name of the created RISE file.

  • stderr_name [char | {'std'}] : prepended name for the newly created parameters.

Returns:

  • duplicates [struct] : structure containing information on the redundancies.

The created files are:

  • riseFileName.rs

  • riseFileName_params.m – parameter function file with calibration and priors as separate outputs.

  • riseFileName_sstate.m (optional) – steady-state function file.

After translation, build with:

m = dsge_model('riseFileName');