Error with using the mlogit R function: the two indexes don't define unique observations
问题 I've got a problem with the mlogit funtion in R. My dataset looks like this: personID caseID altID choice a1 a2 a3 a4 1 1 1 1 3 0 3 1 1 1 2 0 1 3 0 1 1 1 3 0 4 4 4 4 1 2 1 0 2 2 1 3 1 2 2 1 2 3 1 3 etc.... I've tried running the following code, performing the model. setV2 <- mlogit.data(data = setV2, choice = "choice", shape = "long", alt.var = "altID", chid.var = "personID") m <- mlogit(choice ~ a1 + a2 + a3 + a4 | -1, rpar = c(a1 = "n", a2 = "n", a3 = "n", a4 = "n"), correlation = FALSE,