mlogit.data, index and
mFormulamlogit.data is deprecated, use dfidx::dfidx() instead,
mFormula is replaced by Formula::Formula() and zoo::index()
by idx.
mlogit.data(
data,
choice = NULL,
shape = c("long", "wide"),
varying = NULL,
sep = ".",
alt.var = NULL,
chid.var = NULL,
alt.levels = NULL,
id.var = NULL,
group.var = NULL,
opposite = NULL,
drop.index = FALSE,
ranked = FALSE,
subset = NULL,
...
)mFormula(object)
# S3 method for formula
mFormula(object)
# S3 method for default
mFormula(object)
# S3 method for mFormula
model.matrix(object, data, ...)
is.mFormula(object)
# S3 method for dfidx
index(x, ...)
# S3 method for mlogit
index(x, ...)
mlogit.data now returns a dfidx object, mFormula
simply calls Formula::Formula() and returns a Formula
object.
a data.frame,
the variable indicating the choice made: it can be either a logical vector, a numerical vector with 0 where the alternative is not chosen, a factor with level 'yes' when the alternative is chosen
the shape of the data.frame: whether long if each
row is an alternative or wide if each row is an observation,
the indexes of the variables that are alternative specific,
the seperator of the variable name and the alternative
name (only relevant for a wide data.frame),
the name of the variable that contains the
alternative index (for a long data.frame only) or the name
under which the alternative index will be stored (the default
name is alt),
the name of the variable that contains the choice index or the name under which the choice index will be stored,
the name of the alternatives: if null, for a
wide data.frame, they are guessed from the variable names and
the choice variable (both should be the same), for a long
data.frame, they are guessed from the alt.var argument,
the name of the variable that contains the individual index if any,
the name of the variable that contains the group index if any,
returns the opposite of the specified variables,
should the index variables be dropped from the
data.frame,
a logical value which is true if the response is a rank,
a logical expression which defines the subset of observations to be selected,
further arguments passed to reshape.
a formula, a dfidx or a mlogit object,
a boolean, equal to FALSE if one wants that a
data.frame is always returned,
Yves Croissant