Learn R Programming

mlogit (version 0.1-1)

mlogit: Multinomial logit model

Description

Estimation by maximum likelihood of the multinomial logit model, with alternative-specific and/or individual specific variables.

Usage

mlogit(formula, data, subset, weights, na.action,
       alt.subset = NULL, reflevel = NULL, ...)
## S3 method for class 'mlogit':
print(x, digits = max(3, getOption("digits") - 2),
    width = getOption("width"), ...)
## S3 method for class 'mlogit':
summary(object, ...)
## S3 method for class 'summary.mlogit':
print(x, digits = max(3, getOption("digits") - 2),
    width = getOption("width"), ...)
## S3 method for class 'mlogit':
print(x, digits = max(3, getOption("digits") - 2),
    width = getOption("width"), ...)
## S3 method for class 'mlogit':
logLik(object, ...)
## S3 method for class 'mlogit':
vcov(object, ...)
## S3 method for class 'mlogit':
residuals(object, outcome = TRUE, ...)
## S3 method for class 'mlogit':
fitted(object, outcome = TRUE, ...)
## S3 method for class 'mlogit':
df.residual(object, ...)
## S3 method for class 'mlogit':
terms(x, ...)
## S3 method for class 'mlogit':
estfun(x, ...)
## S3 method for class 'mlogit':
bread(x, ...)
## S3 method for class 'mlogit':
model.matrix(object, ...)
## S3 method for class 'mlogit':
update(object, new, ...)

Arguments

x, object
an object of class mlogit
formula
a symbolic description of the model to be estimated,
new
an updated formula for the update method,
data
the data,
subset
an optional vector specifying a subset of observations,
weights
an optional vector of weights,
na.action
a function which indicates what should happen when the data contains 'NA's,
alt.subset
a vector of character strings containing the subset of alternative on which the model should be estimated,
reflevel
the base alternative (the one for which the coefficients of individual-specific variables are normalized to 0),
digits
the number of digits,
width
the width of the printing,
outcome
a boolean which indicates, for the fitted and the residuals methods whether a matrix (for each choice, one value for each alternative) or a vector (for each choice, only a value for the alternative chosen) should be returne
...
further arguments.

Value

  • An object of class "mlogit", a list with elements:
  • coefficientsthe named vector of coefficients,
  • logLikthe value of the log-likelihood,
  • hessianthe hessian of the log-likelihood at convergence,
  • gradientthe gradient of the log-likelihood at convergence,
  • callthe matched call,
  • est.statsome information about the estimation (time used, optimisation method),
  • freqthe frequency of choice,
  • residualsthe residuals,
  • fitted.valuesthe fitted values,
  • formulathe formula (a logitform object),
  • expanded.formulathe formula (a formula object),
  • modelthe model frame used,
  • indexthe index of the choice and of the alternatives.

Details

Let J being the number of alternatives. The formula may include alternative-specific and individual specific variables. For the latter, J-1 coefficients are estimated for each variable. Alternative and individual specific variables are separated by a |. For example, if x1 and x2 are alternative specific and z1 and z2 are individual specific, the formula y~x1+x2|z1+z2 describe a model with one coefficient for x1 and x2 and J-1 coefficients for z1 and z2. J-1 intercepts are also estimated. A model without intercepts is defined by the formula : y~x1+x2-1|z1+z2. To obtain alternative specific coefficients for the alternative-specific variable x2, use : y~x1+x2+x2:alt|z1+z2 (replace alt by the relevant variable name if the alternative index is provided). Models with only alternative-specific or individual-specific variables are respectively estimated by y~x1+x2 and y~1|z1+z2.

The model is estimated with the maxLik package and the Newton-Raphson method, using analytic gradient and hessian.

References

McFadden, D. (1973) Conditional Logit Analysis of Qualitative Choice Behavior, in P. Zarembka ed., Frontiers in Econometrics, New-York: Academic Press. McFadden, D. (1974) ``The Measurement of Urban Travel Demand'', Journal of Public Economics, 3, pp. 303-328. Train, K. (2004) Discrete Choice Modelling, with Simulations, Cambridge University Press.

See Also

mlogit.data to shape the data. multinom from package nnet performs the estimation of the multinomial logit model with individual specific variables

Examples

Run this code
## Cameron and Trivedi's Microeconometrics p.493
## There are two alternative specific variables : pr (price) and ca (catch)
## and four fishing mode : beach, pier, boat, charter

data("Fishing",package="Ecdat")
colnames(Fishing)[4:11] <- c("pr.beach","pr.pier","pr.boat","pr.charter",
                             "ca.beach","ca.pier","ca.boat","ca.charter")
Fish <- mlogit.data(Fishing,varying=c(4:11),shape="wide",choice="mode")

## a pure "conditional" model without intercepts

summary(mlogit(mode~pr+ca-1,data=Fish))

## a pure "multinomial model

summary(mlogit(mode~1|income,data=Fish))

## which can also be estimated using multinom (package nnet)

library(nnet)
summary(multinom(mode~income,data=Fishing))

## a "mixed" model

m <- mlogit(mode~pr+ca|income,data=Fish)
summary(m)

## robust inference with the sandwich package

library(lmtest)
coeftest(m,vcov=sandwich)

Run the code above in your browser using DataLab