1

part of data set

I am estimating a mixed logit model with panel data from a stated choice experiment in R. I tried several things, but I get an error that I do not have an individual index. So for your information, each respondents got 8 choice tasks with 2 alternatives.

I used the following code:

Data <- mlogit.data(Data, shape="long", id.var="Resp", alt.var="Alt", choice="Chosen", idx=c("Nr", "Alt"))

mxl <- mlogit(Chosen ~ -1 + Con + Sun + Purpose_work + Supermarket_yes + Parcel_yes + Room_yes + Gym_yes + Drugstore_yes + Office_yes + Daycare_yes + Other_shopping + Other_package + Other_meeting + Distancehub_0.5 + Distancehub_1 + Distancehub_1.5 + Transfertime_1 + Transfertime_3 + Transfertime_5 + Parkingprice_sq + Parkinghub_0 + Odcar_3 + Odcar_7 + Odcar_11, rpar=c(Other_shopping="n", Other_package="n", Other_meeting="n", Purpose_work="n", Con="n", Transfertime_1="n", Transfertime_3="n", Transfertime_5="n"), R=25, halton=NA, panel = TRUE, data=urbandata) 

I also tried to use pdata.frame but this also did not help.

Can anyone help me?

nrennie
  • 1,877
  • 1
  • 4
  • 14
  • Please don't share data as images - it makes it much harder for people to help. Can you edit your question to include a reproducible example (and include data using `dput()`)? – nrennie Jul 06 '23 at 13:24

0 Answers0