Announcement

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

  • Latent profile model including ordinal variables

    I want to run a latent profile model including ordinal variables with 3 levels. I was sure that I had done this before but when I attempt to do this, I get an error message:

    quietly gsem ( beaten hit parviol famment separate no_care <-, logit) ( Pnon Pcont Ppen <-,ologit), lclass(C 3)
    option lclass() not allowed;
    option lclass() is not allowed with models specified with continuous latent variables
    Is anyone able to spot my error?


  • #2
    Is it the case that a capital letter tells Stata that I am using a continuous variable?

    Comment


    • #3
      It is never the case that capitalization tells Stata your variable is continuous. With sem and gsem, a captialized name is the default means of distinguishing latent variables from other variables.

      To my reading, the error message tells you that you cannot have both a latent class variable (C) and continuous latent variables (Pnon, Pcont, and Ppen) in the same model. As I read your model, the variables Pnon, Pcont, and Ppen are considered latent, because their names are capitalized.

      Comment


      • #4
        To elaborate on William's reply, the correct syntax is

        Code:
        quietly gsem (beaten hit parviol famment separate no_care <-, logit) ( Pnon Pcont Ppen <-,ologit), lclass(C 3) nocapslatent latent(C)
        -nocapslatent- turns off Stata's default setting, which is that any variable whose name starts in capital letters is a latent variable. -latent(C)- tells Stata that the only latent variable in your command is C. The -latent- option is required if you specify -nocapslatent-.

        (NB: latent variables are generally continuous unless otherwise specified, but a latent class is a categorical variable. Stata can't currently mix continuous and categorical variables. Hence the error.)
        Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

        When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

        Comment

        Working...
        X