simulate_model {gEcon} | R Documentation |
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.
simulate_model(model, variables = NULL, shocks = NULL, shock_path, sim_length = 40)
model |
an object of |
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 |
shock_path |
a matrix simulated paths of |
sim_length |
the length of simulation path, the default value is 40. |
An object of gecon_simulation
class storing simulated paths of the model's variables.
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.
# 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)