[R] Problem implementing 'waldtest' when using 'mlogit' package
Achim Zeileis
Achim.Zeileis at uibk.ac.at
Sun Mar 13 15:14:53 CET 2011
On Sun, 13 Mar 2011, Ghosh, Gaurav wrote:
> Hi all,
>
> 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.
>
> Specifically, I have run the following command, where mc and mi2 are
> fitted models: waldtest(mc,mi2)
>
> The two fitted models are:
> mc <- mlogit(depvar ~ ic + oc, H, reflevel="hp")
> mi2 <- mlogit(depvar ~ oc + ic | income, H, reflevel="hp")
That's still not the complete code for replicating the problem...please do
provide reproducible examples as the posting guide asks you!
Using R 2.12.2 and mlogit 0.2-1, I can replicate the results from the
vignette using
library("mlogit")
data("Heating", package = "mlogit")
H <- mlogit.data(Heating, shape = "wide", choice = "depvar", varying = 3:12)
mc <- mlogit(depvar ~ ic + oc, H, reflevel = "hp")
mi2 <- mlogit(depvar ~ oc + ic | income, H, reflevel = "hp")
waldtest(mc, mi2)
> I think that the test is taken from the 'lmtest' package.
The generic is from "lmtest" but the method is provided by "mlogit".
> I get the following error message:
> Error in terms.default(x) : no terms component
The default method should not be called, there is a terms() method for
"mlogit" objects. Maybe you're using an old version of mlogit?
Z
>
> I would be grateful for tips on how to proceed. Thanks in advance.
>
> Best regards,
> Gaurav S. Ghosh, Ph.D.,
> E.ON Energy Research Centre, Room 01.32,
> RWTH Aachen,
> Mathieustra?e 6,
> D-52074 Aachen, Germany
>
>
>
> [[alternative HTML version deleted]]
>
>
More information about the R-help
mailing list