Description Usage Arguments Value Author(s) References Examples
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.
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, ...)
|
object |
An fitted model which is an object of class |
... |
For |
x |
A fitted object of class |
z |
An object of class |
alt.subset |
A subset of alternatives to do testing on. |
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. |
Asad Hasan, Wang Zhiyu, Alireza S. Mahani
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.
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)
|
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.