[R] mlogit: Error reported using sample dataset

Steve_Friedman at nps.gov Steve_Friedman at nps.gov
Wed Feb 10 17:32:32 CET 2010


I've been working on a multinomial logit model, trying to predict
vegetation types as a function of total phosphorus. Previous responses to
my postings have pointed me to the mlogit package.  I'm now trying to work
examples and my data using this package.

data("Fishing", package = "mlogit")
Fish <- mlogit.data(Fishing, varying = c(4:11), shape = "wide", choice =
"mode")

both of those lines work, as expected.

However;

summary(mlogit(mode ~ pr + ca -1, data = Fish))

Call:
Error in deparse(object at call) :
  trying to get slot "call" from an object (class "mlogit") that is not an
S4 object

Using my data I've done the following:

xx <- fwc # copies and protects original data.frame
xx$VegType <- as.factor(xx$VegType)

xx.dat <- mlogit.data(xx, varying = "NULL", choice = "VegType", shape =
"wide")

xx.mlogit <- mlogit(VegType ~ TP, data = xx.dat,, reflevel = "1")

Error in relevel.factor(attr(mf, "index")[["alt"]], reflevel) :
  'ref' must be an existing level


Can someone explain why these errors are occuring and what to do about
them?
Thanks

Using R 2.10.1, Windows XP


Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

Steve_Friedman at nps.gov
Office (305) 224 - 4282
Fax     (305) 224 - 4147



More information about the R-help mailing list