shape a `data.frame` in a suitable form for the use of the `mdcev` function and complete some data checks
mdcev.data(
data,
id.var = NULL,
alt.var = NULL,
choice = "choice",
price = "price",
income = "income",
alt.levels = NULL,
drop.index = FALSE,
subset = NULL,
...
)
a `data.frame`,
the name of the variable that contains the individual index. Note that the id.var must be unique for each
the name of the variable that contains the alternative index or the name under which the alternative index will be stored (the default name is `alt`),
the variable indicating the consumption of non-numeraire alternatives that is made: it has to be a numerical vector. Default is "choice".
the variable indicating the price of the non-numeraire alternatives. Default is "price"
the variable indicating the income of the individual. Default is "income".
the name of the alternatives: if null, they are guessed from the `alt.var` argument,
should the index variables be dropped from the `data.frame`,
a logical expression which defines the subset of observations to be selected,
further arguments.
A `mdcev.data` object, which is a `data.frame` in long format, *i.e.* one line for each alternative. It has a `index` attribute, which is a `data.frame` that contains the index of the individual (`id`) and the index of the alternative (`alt`).