Learn R Programming

mnlogit (version 1.2.6)

Hypothesis Testing: Hypothesis testing for multinomial logit models

Description

Three hypothesis tests applicable to any MLE (Likelihood ratio test, Wald test, Rao score test) and the Hausman-McFadden test for IIA (independence of irrelevant alternatives) are provided.

Usage

lrtest(object, ...)
waldtest(object, ...)
scoretest(object, ...)
# S3 method for mnlogit
lrtest(object, ...)
# S3 method for mnlogit
scoretest(object, ...)
# S3 method for mnlogit
waldtest(object, ...)

hmftest(x, ...) # S3 method for formula hmftest(x, alt.subset, ...) # S3 method for mnlogit hmftest(x, z, ...)

Arguments

object

An fitted model which is an object of class mnlogit.

...

For lrtest and waldtest a fitted mnlogit object or a formula object maybe given. However for scoretest ONLY an fitted mnlogit is accepted. For hmftest either a subset of alternatives or an mnlogit object estimated using a subset of alternatives must be given.

x

A fitted object of class mnlogit or a formula object.

z

An object of class mnlogit or a subset of alternatives for the hmftest.mnlogit method. Must be the same model as x estimated on a subset of alternatives.

alt.subset

A subset of alternatives to do testing on.

Value

An object of class htest, with elements:

statistic

The value of the test statistic.

parameter

the value of the underlying test distribution's parameter. In this case, the numbe r of degrees of freedom of chi-squared distribution.

data.name

The data frame used.

p.value

Probability for accepting the null hypothesis.

method

The name of the hypothesis test.

alternative

Alternative hypothesis.

References

Code for the last two tests (Score and IIA test) is gratefully adapted from the CRAN package mlogit, while the first 2 tests are performed by functions in the CRAN package lmtest.

Croissant, Yves. Estimation of multinomial logit models in R: The mlogit Packages.

Achim Zeileis, Torsten Hothorn (2002) Diagnostic Checking in Regression Relationships, R News 2(3), 7-10.

Examples

Run this code
# NOT RUN {
  library(mnlogit)
  data(Fish, package = "mnlogit")

  # Unconstrained model
  fm <- formula(mode ~ price | income | catch)
  fit <- mnlogit(fm, Fish) 
  # Constrained model - intercep dropped
  fm.c <- formula(mode ~ price | income - 1 | catch)
  fit.c <- mnlogit(fm.c, Fish) 

  ## MLE hypothesis tests
  lrtest(fit, fit.c)
  waldtest(fit, fit.c)
  scoretest(fit, fit.c)

  ## IIA test
  alt.subset <- c("beach", "boat", "charter")
  hmftest(fit, alt.subset)
# }

Run the code above in your browser using DataLab