simulate_model: Simulation of the model

Description Usage Arguments Value See Also Examples

View source: R/class_model_stat_sim.R

Description

The simulate_model function simulates the impact of shock paths specified by the user on the model's variables. In particular, it allows to compute the impact of negative shocks.

Usage

1
2
simulate_model(model, variables = NULL, shocks = NULL,
               shock_path, sim_length = 40)

Arguments

model

an object of gecon_model class.

variables

the names or indices of variables whose paths are to be simulated. By default all variables are selected.

shocks

the names or indices of shocks corresponding to consecutive rows of the shock_path matrix. If missing, the rownames of the shock_path matrix are used.

shock_path

a matrix simulated paths of shocks in rows.

sim_length

the length of simulation path, the default value is 40.

Value

An object of gecon_simulation class storing simulated paths of the model's variables.

See Also

The random_path function generates random paths of shocks for the system behaviour simulation. This function also returns an object of gecon_simulation class. Generic functions such as print and summary provide information about simulations' results. The plot_simulation function allows to visualize the impact of simulated shock paths on the model's variables.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# copy the example to the current working directory
file.copy(from = file.path(system.file("examples", package = "gEcon"),
          "rbc.gcn"), to = getwd())

# make and load the model
rbc <- make_model("rbc.gcn")

# solve the model
rbc <- steady_state(rbc)
rbc <- solve_pert(rbc)

# set shock path
shock_path <- matrix(0, 1, 4)
shock_path[1, 1] <- -0.05
shock_path[1, 4] <- -0.05
# simulate model and plot results
rbc_sim <- simulate_model(rbc, variables = c("K_s", "C", "Z", "I", "Y"),
                          shocks = "epsilon_Z", shock_path = shock_path)
plot_simulation(rbc_sim)

gEcon documentation built on May 2, 2019, 6:52 p.m.

Related to simulate_model in gEcon...