Simulate data for KT models
GenerateMDCEVData(
model,
nobs = 1000,
nalts = 10,
income = stats::runif(nobs, 1e+05, 150000),
price = matrix(stats::runif(nobs * nalts, 100, 500), nobs, nalts),
alpha_parms = 0.5,
scale_parms = 1,
gamma_parms = stats::runif(nalts, 1, 10),
psi_i_parms = c(-1.5, 2, -1),
psi_j_parms = c(-5, 0.5, 2),
phi_parms = c(-5, 0.5, 2),
dat_psi_i = matrix(2 * stats::runif(nobs * length(psi_i_parms)), nobs,
length(psi_i_parms)),
dat_psi_j = cbind(matrix(stats::runif(nalts * (length(psi_j_parms)), 0, 1), nrow =
nalts)),
dat_phi = cbind(matrix(stats::runif(nalts * (length(phi_parms)), 0, 1), nrow =
nalts)),
nerrs = 1,
tol = 1e-20,
max_loop = 999
)
A string indicating which model specification is estimated. The options are "alpha", "gamma", "hybrid" and "hybrid0" for the MDCEV model and "kt_ee" for the environmental economics Kuhn-Tucker specification.
Number of individuals
Number of non-numeraire alts
Vector of individual income
Matrix of prices for non-numeraire alternatives.
Parameter value for alpha term
Parameter value for scale term
Parameter value for gamma terms
Parameter value for psi terms that vary by individual
Parameter value for psi terms that vary by alt (all models except kt_ee)
Parameter value for phi terms that vary by alt (kt_ee model only)
(nobs X # psi_i_parms) matrix with individual-specific characteristics
(nalts X # psi_j_parms) matrix with alternative-specific variables (all models except kt_ee)
(nalts X # phi_parms) matrix with alternative-specific variables (kt_ee model only)
Number of error draws for demand simulation
Tolerance level for simulations if using general approach
maximum number of loops for simulations if using general approach
A `mdcev.data` object, which is a `data.frame` in long format. Also includes parms_true with parameter values
# NOT RUN {
data <- GenerateMDCEVData(model = "gamma")
# }
Run the code above in your browser using DataLab