Description Usage Arguments Details Value See Also Examples
View source: R/class_model_stat_sim.R
The function generates random shock paths based on the shock covariance matrix specified by the user and simulates the behaviour of the system.
1 | random_path(model, variables = NULL, 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. |
sim_length |
the length of simulation path, the default value is 40. |
Cf. gEcon users' guide, chapter ‘Model analysis’.
An object of gecon_simulation
class storing simulated paths of the model's variables.
The simulate_model
function allows the user to specify her own shock paths and simulate
their impact on the model's variables. 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 | # 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)
# perform simulation and plot the results
rbc <- set_shock_cov_mat(rbc, cov_matrix = matrix(0.01, 1, 1),
shock_order = "epsilon_Z")
rbc_rndpath <- random_path(rbc, variables = c("K_s", "C", "Z", "I", "Y"),
sim_length = 100)
plot_simulation(rbc_rndpath)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.