run_models: Run multiple *existing* 'mod' or 'dyn' files.

View source: R/run_models.R

run_modelsR Documentation

Run multiple existing mod or dyn files.

Description

Use this function to execute multiple existing Dynare files. Use run_models(model='someModel') if the Dynare files live in the current working directory. Use run_models(model='someDirectory/someModel') if the Dynare files live in the path different from the current working directory (for example, someDirectory).

Usage

run_models(model = "*", import_log = FALSE)

Arguments

model

Object or a vector of character strings representing the names of the Dynare model files excluding .mod or .dyn file extension

import_log

Logical. Whether or not to import dynare log file.

Value

Set of Dynare (open-source software for DSGE modelling) outputs

See Also

Other important functions: DynareR, add_path(), eng_dynare(), import_log(), include_IRF(), run_dynare(), set_dynare_version(), set_octave_path(), write_dyn(), write_mod()

Examples

library(DynareR)

## Not run: 
demo(agtrend)
demo(bkk)
demo(example1)

# Provide the list of the `Dynare` files in a vector
# Ensure that "agtrend.mod", "bkk.mod" and "example1.mod"
# live in the current working directory

# Copy the dynare files to the current working directory

lapply(c("agtrend","bkk","example1"),\(x) file.copy(paste0(x,"/",x,".mod"),"."))

run_models(c("agtrend","bkk","example1")) # Run the models in the vector.

run_models() # Run all models in Current Working Directory.

# You can run all models that live in "DynareR/run_dynare/" folder

# Copy the dynare files to the 'DynareR/run_dynare' directory

lapply(c("agtrend","bkk","example1"),\(x) file.copy(paste0(x,".mod"),"DynareR/run_dynare"))

run_models("DynareR/run_dynare*") # Note the * at the end.

## End(Not run)

DynareR documentation built on April 30, 2022, 9:05 a.m.