hyptests: Hypothesis testing for multinomial logit models

Description Usage Arguments Value Author(s) References Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
lrtest(object, ...)
waldtest(object, ...)
scoretest(object, ...)
## S3 method for class 'mnlogit'
lrtest(object, ...)
## S3 method for class 'mnlogit'
scoretest(object, ...)
## S3 method for class 'mnlogit'
waldtest(object, ...)

hmftest(x, ...)
## S3 method for class 'formula'
hmftest(x, alt.subset, ...)
## S3 method for class '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.

Author(s)

Asad Hasan, Wang Zhiyu, Alireza S. Mahani

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
  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)

Example output

Package: mnlogit
Version: 1.2.5
Multinomial Logit Choice Models.
Scientific Computing Group, Sentrana Inc.
Likelihood ratio test

Model 1: mode ~ price | income | catch
Model 2: mode ~ price | income - 1 | catch
  #Df  LogLik Df Chisq Pr(>Chisq)    
1  11 -1199.1                        
2   8 -1247.9 -3 97.47  < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Wald test

Model 1: mode ~ price | income | catch
Model 2: mode ~ price | income - 1 | catch
  Res.Df Df  Chisq Pr(>Chisq)    
1   1171                         
2   1174 -3 93.206  < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

	score test

data:  mode ~ price | income | catch
chisq = -1.3927e-19, df = 3, p-value = 1
alternative hypothesis: unconstrained model


	Hausman-McFadden test

data:  Fish
chisq = -168.18, df = 8, p-value = 1
alternative hypothesis: IIA is rejected

mnlogit documentation built on May 28, 2019, 9:02 a.m.