scoretest: The three tests for mlogit models

Description Usage Arguments Details Value Author(s) Examples

View source: R/test.R

Description

Three tests for mlogit models: specific methods for the Wald test and the likelihood ration test and a new function for the score test

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
scoretest(object, ...)

## S3 method for class 'mlogit'
scoretest(object, ...)

## Default S3 method:
scoretest(object, ...)

## S3 method for class 'mlogit'
waldtest(object, ...)

## S3 method for class 'mlogit'
lrtest(object, ...)

Arguments

object

an object of class mlogit or a formula,

...

two kinds of arguments can be used. If mlogit arguments are introduced, initial model is updated using these arguments. If formula or other mlogit models are introduced, the standard behavior of lmtest::waldtest() and lmtest::lrtest() is followed.

Details

The scoretest function and mlogit method for waldtest and lrtest from the lmtest package provides the infrastructure to compute the three tests of hypothesis for mlogit objects.

The first argument must be a mlogit object. If the second one is a fitted model or a formula, the behaviour of the three functions is the one of the default methods of waldtest and lrtest: the two models provided should be nested and the hypothesis tested is that the constrained model is the ‘right’ model.

If no second model is provided and if the model provided is the constrained model, some specific arguments of mlogit should be provided to descibe how the initial model should be updated. If the first model is the unconstrained model, it is tested versus the ‘natural’ constrained model; for example, if the model is a heteroscedastic logit model, the constrained one is the multinomial logit model.

Value

an object of class htest.

Author(s)

Yves Croissant

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library("mlogit")
library("lmtest")
data("TravelMode", package = "AER")
ml <- mlogit(choice ~ wait + travel + vcost, TravelMode,
             shape = "long", chid.var = "individual", alt.var = "mode")
hl <- mlogit(choice ~ wait + travel + vcost, TravelMode,
             shape = "long", chid.var = "individual", alt.var = "mode",
             method = "bfgs", heterosc = TRUE)
lrtest(ml, hl)
waldtest(hl)
scoretest(ml, heterosc = TRUE)

Example output

Loading required package: Formula
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

Loading required package: lmtest
Likelihood ratio test

Model 1: choice ~ wait + travel + vcost
Model 2: choice ~ wait + travel + vcost
  #Df  LogLik Df  Chisq Pr(>Chisq)
1   6 -192.89                     
2   9 -190.18  3 5.4203     0.1435

	Wald test

data:  homoscedasticity
chisq = 39.944, df = 3, p-value = 1.095e-08


	score test

data:  heterosc = TRUE
chisq = 26.028, df = 3, p-value = 9.41e-06
alternative hypothesis: heteroscedastic model

mlogit documentation built on Oct. 23, 2020, 5:29 p.m.