Description Usage Arguments Details Value Examples
View source: R/class_model_shock.R
The set_shock_distr_par
function sets distribution parameters
(standard deviations, correlations, etc.) of shocks in an object of gecon_model
class.
1 | set_shock_distr_par(model, distr_par)
|
model |
an object of |
distr_par |
a list or a vector of distribution parameters with named elements. |
By default, gEcon
uses an identity matrix as the covariance matrix of shocks.
Valid parameters' names should match any of the following patterns:
"sd( SHOCK_NAME )"
"var( SHOCK_NAME )"
"cov( SHOCK_NAME_1, SHOCK_NAME_2 )"
"cor( SHOCK_NAME_1, SHOCK_NAME_2 )"
There are two issues which the user should be careful about while
using the set_shock_distr_par
function. First, in contrast to other parameters,
shock distribution parameters require quotation marks to be assigned properly.
If quotation marks are omitted, R parser treats elements of the distr_par
list
or vector as functions and attempts to evaluate them, producing errors.
Second, parameters passed to the distr_par
argument should not be specified twice.
An (updated) object of the gecon_model
class representing the model.
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"),
"home_production.gcn"), to = getwd())
# make and load the model
home_production <- make_model("home_production.gcn")
shock_info(home_production, all = TRUE)
# set the shock distribution parameters
home_production <- set_shock_distr_par(home_production,
distr_par = list("sd(epsilon_h)" = 0.7,
"var(epsilon_m)" = 0.49,
"cor(epsilon_m,
epsilon_h)" = 2/3))
# get information about shocks in the model
shock_info(home_production, all = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.