compute_irf: Compute impulse response functions (IRFs)

Description Usage Arguments Details Value See Also Examples

View source: R/class_model_stat_sim.R

Description

The compute_irf function computes the impulse response functions for selected variables and shocks and returns an object of gecon_simulation class.

Usage

1
2
compute_irf(model, variables = NULL, shocks = NULL,
            sim_length = 40, cholesky = TRUE)

Arguments

model

an object of gecon_model class.

variables

the names or indices of variables whose responses are to be simulated.

shocks

the names or indices of shocks for which IRFs are to be computed. If missing, IRFs are computed for all shocks with non-zero variance.

sim_length

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

cholesky

a logical value. If set to FALSE, IRFs are computed with initial values of all shocks equal to 1, otherwise the Cholesky decomposition of shock covariance matrix is used (the default).

Details

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

Value

The function returns an object of gecon_simulation class.

See Also

For details, see gecon_simulation-class. Generic functions such as print and summary provide information about the impulse response functions. The plot_simulation function allows to plot the IRFs.

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)

# compute and print the IRFs
rbc <- set_shock_cov_mat(rbc, cov_matrix = matrix(0.01, 1, 1),
                         shock_order = "epsilon_Z")
rbc_irf <- compute_irf(rbc, variables = c("K_s", "C", "Z", "I", "Y"))
summary(rbc_irf)
plot_simulation(rbc_irf)

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

Related to compute_irf in gEcon...