»  Home »  Resources & support »  FAQs »  Error: No paths from latent variable to observed variables

Why did I get an error saying "no paths from latent variable to observed variables" from sem or gsem? Why did I get error message "option lclass() is not allowed with models specified with continuous latent variables" from gsem?

Title   Error: No paths from latent variable to observed variables
Error: option lclass() not allowed
Author Bingsheng Zhang, StataCorp

By default, both Stata commands sem and gsem assume that the variables whose first letter are capitalized are latent. Hence, the following two syntaxes are equivalent:

/* syntax 1*/

. sysuse auto,clear

. sem (X -> mpg displacement length price)

/* syntax 2 */

. sysuse auto,clear

. sem (X -> mpg displacement length price), latent(X)

Now, let's assume that we capitalize one of the observed variables; then, the next syntax will produce an error message:

/* syntax 3 */

. sysuse auto,clear
(1978 Automobile Data)

. rename price Price
. sem (X -> mpg displacement length Price)
model not identified;
no paths from latent variable Price to observed variables
r(503);

sem is assuming that Price is a latent variable; if that was the case, the model wouldn't be identified. We need to add the option nocapslatent, so sem will treat all variables as observed by default. When the nocapslatent option is present, the latent() option can be used to tell Stata which variables are latent. The variable names used as argument for this option might not be capitalized. That is, the following two syntaxes will be equivalent:

/* syntax 4 */

. sysuse auto,clear

. rename price Price
. sem (X -> mpg displacement length Price), nocapslatent latent(X)

/* syntax 5 */

. sysuse auto,clear

. rename price Price
. sem (x -> mpg displacement length Price), nocapslatent latent(x)

Recall that the gsem command can be used in Stata to fit latent class models. Let's see what happens when we have at least one observed variable capitalized.

. sysuse auto,clear
(1978 Automobile Data)

. rename rep78 Rep78
. gsem (headroom gear_ratio trunk Rep78 <- ), lclass(C 2)
option lclass() not allowed;
option lclass() is not allowed with models specified with continuous latent variables
r(198);

gsem is assuming that Rep78 is a continuous latent variable. This syntax will produce an error because this command currently doesn't allow combinations of continuous latent variables and categorical latent variables. Adding the option nocapslatent solves the issue.

Stata

Shop

Support

Company


The Stata Blog: Not Elsewhere Classified Find us on Facebook Follow us on Twitter LinkedIn YouTube Instagram
© Copyright 1996–2018 StataCorp LLC   •   Terms of use   •   Privacy   •   Contact us