Announcement

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

  • how to convert data for lclogit2 into data for cmmixlogit

    Dear Statalist,

    I tried the latent class model with lclogit2 and lclogitml2 a few weeks ago.
    The codes were as follows;

    egen newgid = group(pid gid)
    lclogit2 choice, rand(per tax sup audit fee type_obl contr_assoc contr_conglo) membership(ec_sales indus size) id(pid) group(newgid) ncl(4)

    Now, I want to compare the results from lclogit2 with ones from mixed logit model by using cmmixlogit package.
    And the codes are as follows;

    cmset pid choice
    cmmixlogit choice, rand(per tax sup audit fee type_obl contr_assoc contr_conglo) casevars(i.ec_sales indus size)

    The questionnaire that I made has six questions(=gid) for each respondent(=pid).
    And each question(=gid) has three alternatives.
    While the text from per to contr_conglo) in the second code are the alternative-specific variables, ec_sales, indus and size are the case-specific variables.

    But when I executed the first code, I got the message as follows;

    . cmset pid choice
    at least one choice set has more than one instance of the same alternative
    r(459);

    Any help would be greatly appreciated.
    Thank you.

  • #2
    Jae-hyung Park: I haven't used the built-in mixed logit command before, but my reading of -help cmset- is that you'll need to type:

    Code:
    cmset pid gid, noalternative
    since pid identifies your "panel units" (individual decision makers); gid identifies your "time periods" (choice scenarios); and your experiment doesn't include alternative-specific labels.

    Comment


    • #3
      Dear Professor Hong il Yoo,

      I always thank you for your kind comments.
      I've tried the code "cmset pid gid, noalternative".
      But I faced an error message after executing the second code "cmmixlogit choice, rand(per tax sup audit fee type_obl contr_assoc contr_conglo) casevars(ec_sales i.indus_re i.size)".

      . cmmixlogit choice, rand(per tax sup audit fee type_obl contr_assoc contr_conglo) casevars(ec_sales i.indus_re i.size)
      note: data were cmset as panel data, and the default vcetype for panel data is vce(cluster pid); see cmmixlogit.
      models with alternative-specific constants or variables require specification of alternatives; for models without alternative-specific constants, specify noconstant
      r(198);

      So, I tried to modify the first code by specifying "alt" as follows;

      cmset pid gid alt

      When I executed the whole codes, the result was "not concave" in spite of iterations.

      Is there anything that I missed in my codes?
      Any help would be greatly appreciated.
      Thank you.

      Click image for larger version

Name:	cmmixlogit results_not concave.png
Views:	1
Size:	63.5 KB
ID:	1727527

      Comment


      • #4
        Jae-hyung Park:

        Option -casevars()- in -cmmixlogit- allows alternative-specific constants to shift with observed characteristics which are constant within a choice scenario, and hence it's quite a different thing from option -membership()- in -lclogit2-. If your interest is in making direct comparisons between the two models, you may want to either (1) drop -membership()- from -lclogit2-, and estimate a latent class logit model that includes alternative-specific constants and interaction terms between alternative-specific constants & relevant characteristics as non-random parameters; or (2) drop option -membership()- from -lclogit2-, and option -casevars()- from -cmmixlogit-.

        On the issue of non-convergence, I'm thinking that you should use -cmxtmixlogit- instead of -cmmixlogit-. You have panel choice data that -cmxtmixlogit- is intended for since you have six choice observations per person. Using repeated choice observations helps this type of model to achieve convergence.

        You may also find it useful to consult earlier threads about related topics. For example:

        https://www.statalist.org/forums/for...-large-dataset

        https://www.statalist.org/forums/for...git-cmmixlogit

        Comment


        • #5
          Dear Professor Hong il Yoo,

          Thank you for your kind comments.
          After reading your comments, I realized that I still do not fully understand the cmmixlogit/cmxtmixlogit and lclogit2 packages, as well as the theory of mixed logit models and latent class models.
          I am trying to understand these models by searching and reading more materials.
          Once again, thank you for your valuable advice.

          Comment

          Working...
          X