mlogit-deprecated: Some deprecated functions, especially 'mlogit.data', 'index'...

mlogit-deprecatedR Documentation

Some deprecated functions, especially 'mlogit.data', 'index' and 'mFormula'

Description

'mlogit.data' is deprecated, use [dfidx::dfidx()] instead, 'mFormula' is replaced by [Formula::Formula()] and [zoo::index()] by 'idx'.

Usage

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 class 'formula'
mFormula(object)

## Default S3 method:
mFormula(object)

## S3 method for class 'mFormula'
model.matrix(object, data, ...)

is.mFormula(object)

## S3 method for class 'dfidx'
index(x, ...)

## S3 method for class 'mlogit'
index(x, ...)

Arguments

data

a 'data.frame',

choice

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

shape

the shape of the 'data.frame': whether 'long' if each row is an alternative or 'wide' if each row is an observation,

varying

the indexes of the variables that are alternative specific,

sep

the seperator of the variable name and the alternative name (only relevant for a 'wide' 'data.frame'),

alt.var

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'),

chid.var

the name of the variable that contains the choice index or the name under which the choice index will be stored,

alt.levels

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,

id.var

the name of the variable that contains the individual index if any,

group.var

the name of the variable that contains the group index if any,

opposite

returns the opposite of the specified variables,

drop.index

should the index variables be dropped from the 'data.frame',

ranked

a logical value which is true if the response is a rank,

subset

a logical expression which defines the subset of observations to be selected,

...

further arguments passed to 'reshape'.

x, object

a 'formula', a 'dfidx' or a 'mlogit' object,

drop

a boolean, equal to 'FALSE' if one wants that a 'data.frame' is always returned,

Value

'mlogit.data' now returns a 'dfidx' object, 'mFormula' simply calls [Formula::Formula()] and returns a 'Formula' object.

Author(s)

Yves Croissant

See Also

[stats::reshape()]


mlogit documentation built on June 10, 2025, 9:10 a.m.