I have a large dataset from my own survey. It is a stated preference survey where respondents had to choose between either a bicycle or a public transport commute. I have it saved as (these are columns:
Question (there were 15 possible questions. So just repeats 1..15 for a long time
ID: the ID of the respondent, 1 ... 186.
RES: Repondents saw a random 8 of the 15 questions, values are A, B or 0. A and B for bike or public transport and 0 for questions the respondent did not see
And then all the attributes.
It is in a long format.
Now when i try to do this in R I keep getting:
TM <- mlogit.data(DFemployee, choice = "choice", shape = "long", chid.var = "ID")
Error in FUN(X[[i]], ...) :
argument must be coercible to non-negative integer
or
TM <- mlogit.data(DFemployee, choice = "choice", shape = "long", chid.var = "ID", alt.var = "Question")
Error in dfidx::dfidx(data = data, dfa$idx, drop.index = dfa$drop.index, :
the two indexes don't define unique observations
Can anyone see what I am doing wrong? Its not letting me upload pictures unfortunately