I am trying to run a mixed effect multinomial model. Below is some of my data.
id outcome x
1008 two -0.36759425
1008 two -0.36759425
1008 two -0.36759425
1008 two -0.36759425
1008 one -0.36759425
1008 two -0.36759425
1008 two -0.36759425
1008 one -0.36759425
1012 two -0.08572346
1012 one -0.08572346
1012 three -0.08572346
1012 two -0.08572346
1012 three -0.08572346
I have 2 questions. First, if my data are already in the long format, do I need to specify it to be in the long format.
Second, when I run the code below, I am getting the error message below:
> a <- mlogit(outcome ~ 1 | short_sleep_tm_05r, data = df, reflevel = "one")
Error in dfidx::dfidx(data = data, dfa$idx, drop.index = dfa$drop.index, :
the two indexes don't define unique observations
I don't understand what this means. Can someone help?