Description Usage Arguments Value Examples
get_start
get starting values for discrete or continuous choice model.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | get_start(
eq_c = NULL,
eq_d = NULL,
data = NULL,
part = "joint",
datan = "data",
fixed_term = FALSE,
weight_paths = TRUE,
weight_paths_cont = FALSE,
data_weight = NULL,
par_c = NULL,
par_d = NULL,
best_method = FALSE,
startvals = NULL,
DEoptim_run = FALSE,
hessian = NULL,
transform = TRUE,
MNtypef = "logit",
pardogit = NULL,
opt_method = "BFGS",
numerical_deriv = FALSE
)
|
eq_c |
Continuous equations errors. |
eq_d |
Discrete equations. |
data |
|
part |
Type of estimation: "joint", "cont", "disc". |
datan |
Name of |
fixed_term |
if |
weight_paths |
if |
weight_paths_cont |
if |
data_weight |
|
par_c |
Names of parameters in continuous equations. |
par_d |
Names of parameters in discrete equations. |
best_method |
if |
startvals |
Starting values, can be also |
DEoptim_run |
if |
hessian |
Name of hessian function. |
transform |
if |
MNtypef |
"dogit" or "logit". |
pardogit |
"dogit" parameters. |
opt_method |
optimization method to use. |
numerical_deriv |
if |
Starting values for discrete or continuous blocks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # Example of discrete choice model
data("TravelMode", package = "AER")
eq_d <- c("ASC1 * 1 + B2_t * travel_1 + B3_v * vcost_1" ,
"ASC2 * 1 + B2_t * travel_2 + B3_v * vcost_2",
"ASC3 * 1 + B2_t * travel_3 + B3_v * vcost_3",
"ASC4 * 1 + B2_t * travel_4 + B3_v * vcost_4")
parl <- c(paste0("ASC", 1:4), "B2_t", "B3_v")
obj <- get_par(parl, eq_d)
mode_spec_var <- c("wait", "vcost", "travel", "gcost")
data <- TravelMode
data$wait <- as.numeric(data$wait)
data[data$wait==0,"wait"] <- 0.000001 # add a small number to 0
data$travel <- as.numeric(data$travel)
data[data$travel==0,"travel"] <- 0.000001
data$vcost <- as.numeric(data$vcost)
data[data$vcost==0,"vcost"] <- 0.000001
data <- prepare_data(data, choice="mode", dummy="choice", PeID="individual", WeID="",
type="long", mode_spec_var =mode_spec_var, wc=FALSE)
stv <- get_start(eq_d=eq_d, data=data, datan="data", part="disc", par_d = parl,
transform = FALSE)
#example, system of equations
data("CreditCard", package="AER")
cdat <- CreditCard
cdat$income2 <- cdat$income^2
cdat$d_selfemp <- as.numeric(cdat$selfemp)
eq_c <- c("expenditure ~ b1*age + b2*income + b3*income2",
"income ~ a1*age + a2*d_selfemp + a3*dependents + a4*majorcards")
parl <- c(paste0("b", 1:3), paste0("a", 1:4))
para_cont <- get_par(parl, eq_c)
cheqs0 <- para_cont$cheqs0
stv <- get_start(eq_c = eq_c, data=cdat, datan="cdat", part="cont", par_c=parl)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.