Announcement

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

  • HELP_discrete choice (mixlogit syntax)

    Hi all,

    I am now a university student and I am conducting the discrete choice analysis, yet, after I input the mixlogit syntax, it keeps showing "unrecognized command: mixlogit"...Please help me...

    Basically, there are 6 attributes with 3, 2, 2, 2, 2, 2 levels...
    In an experimental design, I have manipulated the following variables and created the stimuli:
    1. rating 2x (high vs low), - R_High, R_Low
    2. type of house3 x (different photos of apartments) - Ap_Ap1, Ap_Ap2, Ap_Ap3
    3. gender 2x (male vs female), - G_Male, G_Female
    4. head 2 x (show vs not show); - H_Head, H_No
    5. mouth 2x (show vs not show) - M_Mouth, M_No
    6. eyes 2x (show vs not show). - E_Eyes, E_No
    I have identified the best fractional factorial design, and also created the choice sets (total of 8 choice sets with 3 options each)
    Also, I coded all variables into dummy variables, but I am not too sure how to write the mixlogit syntax in STATA to run the analysis.

    So, here is what I wrote for the syntax:

    mixlogit choice const, group(obsid) id(personid) rand(Ap_Ap1 Ap_Ap2 Ap_Ap3 R_High H_Head E_Eyes M_Mouth G_Male) nrep(500)

    I also tried:

    mixlogit choice const, group(obsid) id(personid) rand(Ap_Ap1 Ap_Ap2 Ap_Ap3 R_High R_Low H_No H_Head E_No E_Eyes M_No M_Mouth G_Male G_Female) nrep(500)

    However, it keeps showing "unrecognized command: mixlogit".

    p.s. I am actually not sure whether I need to have "const" and "nrep(500)". I saw most of the examples include that, so I also write it in the syntax.
    I aa very new to STATA, and I kept checking on different tutorial etc, but I still cannot solve it.
    Can anyone see what my problem is? (I am really stuck at the moment. It will be very helpful if you can give me some suggestions!!!!)

    Thanks
    Joanne
    Last edited by Joanne Yu; 12 Dec 2017, 04:57.

  • #2
    Hi Joanne, regardless of the specific command you try, you have to make sure mixlogit is installed correctly, since it is a user-written implementation. Using -ssc install mixlogit- you install the package.

    Comment


    • #3
      Vince Bekker oh thanks so much! I just did that, and I think it works now!! However, now it shows "Some variables are collinear - check your model specification". Does this mean that there is problems with the coding? or??
      Thanks!!

      Comment


      • #4
        Great! I assume that you use dummy variable coding. Therefore you need to omit one of the attribute level variables for each attribute, which will be your reference level. (After that you will probably still get an error because you include a subject-specific variable, i.e. gender.)

        Comment


        • #5
          Vince Bekker oh ok I see! omg thank you so much! but what if I have one attribute with 3 levels? I understand how to omit one of the variable, but what if it is for 3 levels? Also, but I have the gender is because that is one of the attribute, does it matter??

          Comment


          • #6
            For each attribute you have to select one of the levels to be your reference level. The coefficients for the remaining levels will then measure the effect with respect to this reference level.

            I see, if gender is different across choice tasks (such that it is not the gender of the respondent, but of the entities that make up the choice tasks) you can indeed include it. (Since you didn't provide any explanation, I could not tell what kind of study your are doing.)

            Comment


            • #7
              Vince Bekker sorry I did not get the idea of reference level. So for example, I have these attributes and levels
              1. rating 2x (high vs low), - R_High, R_Low ----I choose R_Low as reference level which coded as 0?
              2. type of house3 x (different photos of apartments) - Ap_Ap1, Ap_Ap2, Ap_Ap3 ---- If I choose Ap_Ap3 as reference level, how do I code for Ap_Ap1 and Ap_Ap2???
              3. gender 2x (male vs female), - G_Male, G_Female ----G_Female as reference level (coded as 0?)
              4. head 2 x (show vs not show); - H_Head, H_No----H_No as reference level (coded as 0?)
              5. mouth 2x (show vs not show) - M_Mouth, M_No----M_No as reference level (coded as 0?)
              6. eyes 2x (show vs not show). - E_Eyes, E_No----E_No as reference level (coded as 0?)
              In the syntax, I should write like below?

              mixlogit choice const, group(obsid) id(personid) rand( Ap_Ap2 Ap_Ap3 R_High H_Head E_Eyes M_Mouth G_Male) nrep(500)

              One more question, actually, do I need to write const and nrep(500) in the syntax? I don't know what's the purpose of that, but I just found that most of the peopel have it.

              ​​​​​​​Thanks!!!

              Comment


              • #8
                Yes, that's exactly right as far as I can determine without looking at your data! Indeed, the coding should be right. Post an excerpt of your data if you are unsure.

                In the case of the apartments, if you choose apartment 1 as a reference apartment, the coefficients of the other two indicate how much better or worse they appear to respondents.

                nrep at 500 is fine, though remember that since this is simulated likelihood it can take a lot of time (days, weeks) for the results to converge depending on the problem and the amount of data. You could try first with 50 reps, to get a feel for how long that takes (but results are unreliable).

                const is necessary I suspect to indicate some constant for either of the three choice alternatives, regardless of attributes.
                Last edited by Vince Bekker; 12 Dec 2017, 07:46.

                Comment

                Working...
                X