R错误:“row.names<;-”中的错误。data.frame`(`*tmp*`,value=value)

R错误:“row.names<;-”中的错误。data.frame`(`*tmp*`,value=value),r,statistics,probability,logistic-regression,R,Statistics,Probability,Logistic Regression,我只是建立了一个数据集来测试函数“mlogit”,它代表“多项式逻辑回归模型” 数据如下: head(dat) y x1 x2 x3 1 4 1 18 4 2 5 1 20 5 3 2 1 25 3 4 3 0 26 6 5 4 0 26 8 6 3 1 27 4 然后当我打字的时候 fit <- mlogit(y ~ x1 + x2 + x3, data=dat) fit帮助说明: “data”参数可以是普通的“data.frame”。在这种

我只是建立了一个数据集来测试函数“mlogit”,它代表“多项式逻辑回归模型”

数据如下:

head(dat)
   y x1 x2 x3
 1 4  1 18  4
 2 5  1 20  5
 3 2  1 25  3
 4 3  0 26  6
 5 4  0 26  8
 6 3  1 27  4
然后当我打字的时候

fit <- mlogit(y ~ x1 + x2 + x3, data=dat)
fit帮助说明:

“data”参数可以是普通的“data.frame”。在这种情况下,, 应提供一些补充参数,并将其传递给 “mlogit.data”

你没有提出任何补充论点。请注意,我认为这种糟糕的文档是因为它没有声明应该提供哪些补充参数。 从示例来看,似乎至少应该设置“形状”和“选择”:

 # a data.frame in wide format with two missing prices
 Fishing2 <- Fishing
 Fishing2[1, "price.pier"] <- Fishing2[3, "price.beach"] <- NA
 mlogit(mode~price+catch|income, Fishing2, shape="wide", choice="mode", varying = 2:9)

 # a data.frame in long format with three missing lines
 data("TravelMode", package = "AER")
 Tr2 <- TravelMode[-c(2, 7, 9),]
 mlogit(choice~wait+gcost|income+size, Tr2, shape = "long",
        chid.var = "individual", alt.var="mode", choice = "choice")
#宽格式的data.frame,缺少两个价格
捕鱼2
 # a data.frame in wide format with two missing prices
 Fishing2 <- Fishing
 Fishing2[1, "price.pier"] <- Fishing2[3, "price.beach"] <- NA
 mlogit(mode~price+catch|income, Fishing2, shape="wide", choice="mode", varying = 2:9)

 # a data.frame in long format with three missing lines
 data("TravelMode", package = "AER")
 Tr2 <- TravelMode[-c(2, 7, 9),]
 mlogit(choice~wait+gcost|income+size, Tr2, shape = "long",
        chid.var = "individual", alt.var="mode", choice = "choice")