Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use mixlogit command for DCE?

    Hi there,

    #Stata18

    I have some pretest samples for a discrete choice experiment. I want to fit the mixed logit model following Hole's (2007) to capture the heterogeneity of preferences; however, I cannot make the mixlogit command work.

    The error I got from mixlogit y price, rand(pesticide type) group(id) id(group) nrep(50) is "command mixlogit is unrecognized" r(199). Also, when I try to get help from help mixlogit, it directs me to search mixlogit. My colleague uses a previous stata version, and mixlogit works fine for him.

    Here is an example of the data.
    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte(choice1 pesticide) int price byte(type group)
    0 1 102 2 7
    0 1  93 2 3
    0 1 148 3 4
    0 2  84 1 3
    0 2 124 3 7
    0 2 129 2 4
    1 3  77 1 4
    1 3 160 3 3
    1 3  98 1 7
    0 1  93 2 3
    0 1 102 2 7
    0 1 148 3 4
    0 2  84 1 3
    0 2 124 3 7
    0 2 129 2 4
    1 3 160 3 3
    1 3  98 1 7
    1 3  77 1 4
    0 1 148 3 4
    2 1 102 2 7
    3 1  93 2 3
    0 2  84 1 3
    0 2 129 2 4
    0 2 124 3 7
    1 3  77 1 4
    0 3 160 3 3
    0 3  98 1 7
    0 1 102 2 7
    0 1 148 3 4
    0 2 124 3 7
    0 2 129 2 4
    1 3  98 1 7
    1 3  77 1 4
    0 1 102 2 7
    0 1 148 3 4
    0 1  93 2 3
    0 2 129 2 4
    2 2  84 1 3
    0 2 124 3 7
    0 3 160 3 3
    1 3  98 1 7
    1 3  77 1 4
    0 1 102 2 7
    0 1 148 3 4
    0 1  93 2 3
    0 2 129 2 4
    0 2 124 3 7
    2 2  84 1 3
    1 3  77 1 4
    0 3 160 3 3
    1 3  98 1 7
    0 1  77 1 9
    0 1 129 2 6
    0 1  84 1 1
    1 2 102 2 9
    0 2 148 3 6
    3 2  93 2 1
    0 3 160 3 9
    3 3  77 1 6
    0 3 140 3 1
    0 1 124 3 2
    0 1 160 3 8
    0 1  98 1 5
    2 2  98 1 2
    2 2  77 1 8
    0 2 129 2 5
    1 3 148 3 5
    0 3 102 2 2
    0 3 102 2 8
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    . .   . . .
    end
    where choice is the dependent variable. Price, pesticide, and type are attributes. Group is for choice sets.
    I am not done with the data entry yet. Before I enter all the data into Excel, I wanted to check if Mixlogit works for me. I suspect my data is probably not in the right format for mixlogit.
    Moreover, I tried to follow cmmixlogit, but I'm unsure about the casevar. Is it the respondent's ID or the choice set?
    Any help is much appreciated. Thank you.

  • #2
    Update about the mixologist command!
    Please ignore the part about mixlogit. I have a solution to the mixlogit command.

    Comment


    • #3
      Sorry about the typo.

      Comment

      Working...
      X