mlogit {mlogit} | R Documentation |
Estimation by maximum likelihood of the multinomial logit model, with alternative-specific and/or individual specific variables.
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': model.matrix(object, ...) ## S3 method for class 'mlogit': update(object, new, ...)
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 returned, |
... |
further arguments. |
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.
An object of class "mlogit"
, a list with elements:
coefficients |
the named vector of coefficients, |
logLik |
the value of the log-likelihood, |
hessian |
the hessian of the log-likelihood at convergence, |
gradient |
the gradient of the log-likelihood at convergence, |
call |
the matched call, |
est.stat |
some information about the estimation (time used, optimisation method), |
freq |
the frequency of choice, |
residuals |
the residuals, |
fitted.values |
the fitted values, |
formula |
the formula (a logitform object), |
expanded.formula |
the formula (a formula object), |
model |
the model frame used, |
index |
the index of the choice and of the alternatives. |
Yves Croissant
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.
mlogit.data
to shape the data. multinom
from package nnet
performs the estimation of the multinomial
logit model with individual specific variables
## 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="mlogit") 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)