Description Usage Arguments Value See Also Examples
View source: R/class_model_stat_sim.R
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.
1 2 | 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.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.