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?

Title   Error: No paths from latent variable to observed variables
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)