Announcement

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

  • option lclass ( ) not allowed error

    Novice here!

    This may be a simple question, but I couldn't find an answer using either Google or this forum, so I am probably doing something very basic that is wrong.

    I am trying to run latent class analyses using gsem and no matter how I specify my model I get the same error message. An example model shown below

    gsem (meaning <- inwork owner indsex ), logit lclass(C 3)
    option lclass() not allowed
    r(198);


    All the variables are 0,1 binary variables and I am using about 3,000 observations.
    I copied the exact syntax for this code from these instructions from Stata: https://www.stata.com/features/overv...lass-analysis/

    What am I not seeing here please?

    Thank you for any pointers

    Karen


  • #2
    I don't see anything wrong with that syntax, and it works on my setup. Perhaps you are using a version of Stata from before the introduction of latent category variables?

    Comment


    • #3
      I tried
      Code:
      sysuse auto, clear
      
      foreach var of varlist length mpg price {
          su `var', meanonly
          gen `var'_bin = `var' < r(mean)
      }
      
      gsem (foreign <- length_bin mpg_bin price_bin ), logit lclass(C 3)
      and it works in both Stata 16.1 and the current Stata 19.5. So perhaps you are using a fairly old version of Stata?

      Comment


      • #4
        To test if it's a problem with my data I downloaded Stata's test dataset "use https://www.stata-press.com/data/r19/gsem_lca1"
        I then pasted in their code with the same results.
        gsem (accident play insurance stock <- ), logit lclass(C 2)
        option lclass() not allowed


        I am using Stata 14.2/SE, so maybe it's not allowed in my version of Stata?

        Comment


        • #5
          Support for latent category variables was introduced in version 15.

          Comment

          Working...
          X