get_par_names_by_index: Parameters corresponding to given indices

Description Usage Arguments Details Value Examples

View source: R/class_model_par.R

Description

The get_par_names_by_index function allows to retrieve the names of parameters with given indices.

Usage

1
get_par_names_by_index(model, index_names)

Arguments

model

an object of gecon_model class.

index_names

a character vector of indices.

Details

Cf. gEcon users' guide, chapter ‘Templates’.

Value

The function returns a character vector of relevant parameters' names.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# copy the example to the current working directory
file.copy(from = file.path(system.file("examples", package = "gEcon"),
          "pure_exchange.gcn"), to = getwd())

# make and load the model
pure_exchange_t <- make_model("pure_exchange.gcn")

# model calibration
pure_exchange_t <- set_free_par(pure_exchange_t,
                                free_par= c("alpha__A__1" = 0.3, "alpha__A__2" = 0.4,
                                            "alpha__A__3" = 0.3, "alpha__B__1" = 0.3,
                                            "alpha__B__2" = 0.4, "alpha__B__3" = 0.3,
                                            "e_calibr__A__1" = 3, "e_calibr__B__1" = 1,
                                            "e_calibr__A__2" = 2, "e_calibr__B__2" = 1,
                                            "e_calibr__A__3" = 1, "e_calibr__B__3" = 3))

# get all parameters associated with agent A
par_names_A <- get_par_names_by_index(pure_exchange_t, index_names = "A")
par_info(pure_exchange_t, par_names_A)

# get all parameters associated with agent B
par_names_B <- get_par_names_by_index(pure_exchange_t, index_names = "B")
par_info(pure_exchange_t, par_names_B)

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