compute_model_stats: Computation of model statistics

Description Usage Arguments Details Value Note References See Also Examples

View source: R/class_model_stat_sim.R

Description

This function computes statistics of the model using spectral (FFT) or simulation methods.

Usage

1
2
3
compute_model_stats(model, n_leadlags = 5, ref_var = NULL, lambda = 1600,
                    ngrid = 64 * 16,
                    sim = FALSE, sim_length = 1e5)

Arguments

model

an object of gecon_model class.

n_leadlags

the number of leads and lags of the model's variables for which correlations are to be computed.

ref_var

the name or the index of the reference variable with respect to which correlations are to be computed.

lambda

HP filter parameter, if it is set to 0 no filtering is performed, 1600 is the default value (quarterly data).

ngrid

the density of grid used by the Fast Fourier transform (used only if the sim option is set to FALSE). It has to be a multiple of 8 and has to be large enough to guarantee unbiased results.

sim

a logical value. If TRUE simulation method is used for computing correlations, if FALSE, the Fast Fourier transform is used.

sim_length

the length of simulation path (used only if the sim option is set to TRUE).

Details

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

Value

An object of gecon_model class representing the model.

Note

The density of grid used by the FFT has to be large enough (at least 64 * 8) for spectral method to give accurate results.

References

Hamilton. J.D. (1994), Time Series Analysis, Princeton University Press

See Also

Generic functions such as print and summary allow to show the model's components. The get_model_stats function returns various statistics of the model (both absolute and relative).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# 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 model
rbc <- make_model("rbc.gcn")

# solve the model
rbc <- steady_state(rbc)
rbc <- solve_pert(rbc)

# compute and print correlations
rbc <- set_shock_cov_mat(rbc, cov_matrix = matrix(0.01, 1, 1),
                         shock_order = "epsilon_Z")
rbc <- compute_model_stats(rbc, ref_var = "Y")
get_model_stats(rbc)

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