15 Composing results
15.1 Overview
ems_compose() retrieves and processes results from a solved model run. Results are parsed according to the specified type (variables, coefficients, or all). Data validation and consistency checks are performed during the parsing process.
By default, ems_solve() calls ems_compose() automatically, so this function is primarily used when suppress_outputs = TRUE was passed to ems_solve() or solve_in_situ(), or when re-parsing results from a previous run.
15.2 Arguments
| Argument | Default | Description |
|---|---|---|
cmf_path |
Path to the CMF file generated by ems_deploy() |
|
type |
"all" |
Type of data to parse: "all", "variable", or "coefficient" |
name |
NULL |
Character vector to filter results by name, returning a subset of the selected type |
minimal |
FALSE |
Whether to run a minimal number of checks and modifications to output data |
15.3 Basic usage
After a standard model run with suppressed outputs:
ems_solve(
cmf_path = cmf_path,
matrix_method = "LU",
solution_method = "Johansen",
suppress_outputs = TRUE
)
# Parse all results
outputs <- ems_compose(cmf_path = cmf_path)15.4 Output types
The type argument controls what is parsed from the solver output:
# All model variables and coefficients
all_outputs <- ems_compose(cmf_path = cmf_path, type = "all")
# Percentage change values for model variables only
variables <- ems_compose(cmf_path = cmf_path, type = "variable")
# Values for model coefficients only
coefficients <- ems_compose(cmf_path = cmf_path, type = "coefficient")15.5 Filtering by name
The name argument filters results to a subset of the selected type:
# Retrieve a single variable
qfd <- ems_compose(cmf_path = cmf_path, type = "variable", name = "qfd")
# Retrieve multiple variables
trade_vars <- ems_compose(cmf_path = cmf_path, type = "variable",
name = c("qfd", "qfm", "qgd"))15.6 Minimal mode
When minimal = TRUE, a reduced number of checks and modifications are applied to the output data:
- Chronological data is not loaded and the model file is not parsed
- No post-model set checks are conducted between model sets as written out from the model input and solver set binaries
- Time steps remain in their model format (integer indices rather than chronological years)
This option must be set to TRUE when using output from solve_in_situ() with writeout = FALSE, since there is no set writeout to validate against:
outputs <- solve_in_situ(
...,
model_file = "model.tab",
closure_file = "model.cls",
shock_file = "shocks.shf",
suppress_outputs = TRUE
)
variables <- ems_compose(cmf_path = outputs, type = "variable", minimal = TRUE)