linearmdcevFit¶
Purpose¶
Estimates parameters for the Multiple Discrete-Continuous Extreme Value (MDCEV) model using linear utility for the outside good. Supports input data and specification strings for consumption quantities and explanatory variables.
Format¶
-
beta_hat =
linearMDCEVFit(fname, dvunordname, davunordname, ivmt, ivgt[, weight_var, varnam, varngam])¶ Parameters: - fname (string) – Path to the dataset.
- dvunordname (string array) – Labels of dependent variables (consumption quantities). Must include the outside good as the first entry.
- davunordname (string or string array) – Labels of price variables. Set to
"none"if there is no price variation. - ivmt (string matrix) – Specification of independent variables (baseline utilities) for each alternative. Each row corresponds to an alternative, and each column to a variable.
- ivgt (string matrix) – Specification of independent variables for translation (satiation) parameters for each alternative.
- weight_var (string, default =
"uno") – Optional input. Label of the weight variable in the dataset. If not provided, all observations are treated as equally weighted. - varnam (string vector, default = auto-generated from
dvunordnameandivmt) – Optional input. Names of variables in the baseline utility specification. - varngam (string vector, default = auto-generated from
dvunordnameandivgt) – Optional input. Names of variables in the translation specification.
Returns: beta_hat (column vector) – Estimated model coefficients including baseline utility, translation, and scale parameters.
Remarks¶
- This function supports weighted estimation if a column name is passed for weights.
- The first good is treated as the outside good and normalized accordingly.
- Internally, the model uses two maximum likelihood steps to first estimate and then refine the scale parameter.
- Parameter names are optionally passed or auto-generated using variable specifications.
Examples¶
Estimate an MDCEV model with linear utility using tourism expenditure data:
// Set up the workspace
new;
cls;
// Load the libraries
library bhatlib, maxlik;
// Specify the dataset file
fname = __FILE_DIR $+ "WorkshopData_ToursimExp_rev.csv";
// Specify the dependent variables alternatives
string dvunordname = { "Transp" "Accomod" "FandB" "Shp" "Recr" };
// Specify avaialabaility restrictions
davunordname = "none";
/*
** Specify independent variables for baseline utility
** This string should contain:
** - One row for each alternative
** - One column for each independnet variable variable
*/
string ivmt = {
"sero" "sero" "sero" "sero" "sero" "sero" "sero" "sero" "sero" "sero",
"uno" "sero" "sero" "sero" "urban" "sero" "sero" "sero" "stlt3" "st410",
"sero" "uno" "sero" "sero" "sero" "urban" "sero" "sero" "sero" "sero",
"sero" "sero" "uno" "sero" "sero" "sero" "urban" "sero" "sero" "sero",
"sero" "sero" "sero" "uno" "sero" "sero" "sero" "urban" "sero" "sero"
};
/*
** Specify independent variables for translation
*/
string ivgt = {
"uno" "sero" "sero" "sero" "sero" "sero" "sero" "sero" "sero" "sero" "sero" "sero" "sero",
"sero" "uno" "sero" "sero" "sero" "urban" "sero" "sero" "stlt3" "st410" "sero" "sero" "sero",
"sero" "sero" "uno" "sero" "sero" "sero" "urban" "sero" "sero" "sero" "b51q11" "sero" "sero",
"sero" "sero" "sero" "uno" "sero" "sero" "sero" "urban" "sero" "sero" "sero" "b51q11" "sero",
"sero" "sero" "sero" "sero" "uno" "sero" "sero" "sero" "sero" "sero" "sero" "sero" "b51q11"
};
// Estimate the model
beta_hat = linearMDCEVFit(fname, dvunordname, davunordname, ivmt, ivgt);
Source¶
bhatlib.src