random_path: Simulation of the model with a random path of shocks

Description Usage Arguments Details Value See Also Examples

View source: R/class_model_stat_sim.R

Description

The function generates random shock paths based on the shock covariance matrix specified by the user and simulates the behaviour of the system.

Usage

1
random_path(model, variables = NULL, 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.

sim_length

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

Details

Cf. gEcon users' guide, chapter ‘Model analysis’.

Value

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

See Also

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.

Examples

 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)

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

Related to random_path in gEcon...