[R] Problem implementing 'waldtest' when using 'mlogit' package

Mark Difford mark_difford at yahoo.co.uk
Sun Mar 13 15:41:21 CET 2011


On Mar 13, 2011; 03:44pm Gaurav Ghosh wrote:

>> I have been working through the examples in one of the vignettes
>> associated with the 'mlogit' 
>> package, 'Kenneth Train's exercises using the mlogit package for R.'  In
>> spite of using the code 
>> unchanged, as well as the data used in the examples, I have been unable
>> to run a Wald test to 
>> test two models.

It strikes me that you may not have given the full facts. I have no problem
with this (using a development version of R). Note that you need to make H
first.

> data("Heating", package = "mlogit")
> H <- mlogit.data(Heating, shape = "wide", choice = "depvar",
+ varying = c(3:12))
> m <- mlogit(depvar ~ ic + oc | 0, H)
> summary(m)

> mc <- mlogit(depvar ~ ic + oc, H, reflevel="hp") 
> mi2 <- mlogit(depvar ~ oc + ic | income, H, reflevel="hp")
> waldtest(mc,mi2)
Wald test

Model 1: depvar ~ ic + oc
Model 2: depvar ~ oc + ic | income
  Res.Df Df  Chisq Pr(>Chisq)
1    894                     
2    890  4 4.6456     0.3256

What does print(mc) and print(mi2) report?

Mark.

> sessionInfo()
R version 2.13.0 Under development (unstable) (2010-10-14 r53299)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] grDevices datasets  stats4    splines   graphics  utils     stats    
methods   base     

other attached packages:
 [1] mlogit_0.2-1      maxLik_1.0-0      miscTools_0.6-10  lmtest_0.9-27    
zoo_1.6-4        
 [6] statmod_1.4.9     Formula_1.0-0     rms_3.3-0         Hmisc_3.8-3      
modeltools_0.2-17
[11] mvtnorm_0.9-96    survival_2.36-5  

loaded via a namespace (and not attached):
 [1] cluster_1.13.3     coin_1.0-18        colorspace_1.0-1   grid_2.13.0       
lattice_0.19-17   
 [6] Matrix_0.999375-47 mboost_2.0-10      party_0.9-99991    sandwich_2.2-6    
tools_2.13.0

--
View this message in context: http://r.789695.n4.nabble.com/Problem-implementing-waldtest-when-using-mlogit-package-tp3351904p3351984.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list