在尝试使用mlogit.data时,我被行名错误所困扰。尽管事实是行名应由alt.levels变量提供。我怀疑问题是由于变量变化不正确造成的?变量应用于连续数字变量吗?
我在下面附加了一些示例数据:
library(mlogit)
id <- "1AbsBep330HxOlwt3iIkT1RZjs0qaqUPh" # google file ID
test<-read.csv(sprintf("https://docs.google.com/uc?id=%s&export=download", id))
model <- mlogit.data(test, shape = "long",
choice = "choice",
alt.levels=paste("pos", 1:3),
varying = 4:6,
id.var="resp.id")
m1 <- mlogit(choice ~ 0 + colour + up.front.cost + repayments, data = model)
Error in `.rowNamesDF<-`(x, value = value) : invalid 'row.names' length