Lavaan error message

305 views
Skip to first unread message

Andries Noeth

unread,
Feb 29, 2024, 7:23:12 AM2/29/24
to lavaan
Hi Support group,

I'm using Jasp to build a SEM and found the following error message. 

"Some latent variable names collide with observed variable names: SAT_Dr SAT_Nu, SAT_ovall.

This is the syntax code is used:

  # latent variables

SAT_Dr =~ DR_1 + DR_2 + DR_3 + DR_4

SAT_Nu =~ Nu_1 + Nu_2 + Nu_3 + Nu_4

SAT_Ovall =~ Env_1 + Env_2 + Env_3 + Env_4 + Med_1 + Med_2 + Med_3 + Med_4 + Dis_1 + Dis_2

# regressions

REC ~ SAT_Dr + SAT_Nu + SAT_Ovall

Choose ~ SAT_Dr + SAT_Nu + SAT_Ovall


Any advice will be greatly appreciated



Shu Fai Cheung (張樹輝)

unread,
Feb 29, 2024, 7:38:16 AM2/29/24
to lavaan
Maybe it is because the dataset already have columns named SAT_Dr, SAT_Nu, and SAT_Ovall?

I can produce a similar error by creating the columns with names equal to the factors:

``` r
library(lavaan)
#> This is lavaan 0.6-17
#> lavaan is FREE software! Please report any bugs.
dat <- HolzingerSwineford1939
dat$visual <- rowSums(dat[, c("x1", "x2", "x3")])
dat$textual <- rowSums(dat[, c("x4", "x5", "x6")])
HS.model <- ' visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9 '
fit <- cfa(HS.model, data = dat)
#> Error in lavaan::lavaan(model = HS.model, data = dat, int.ov.free = TRUE, : lavaan ERROR: some latent variable names collide with observed
#>      variable names: visual textual
```


<sup>Created on 2024-02-29 with [reprex v2.1.0](https://reprex.tidyverse.org)</sup>

-- Shu Fai

Andries Noeth

unread,
Feb 29, 2024, 8:02:17 AM2/29/24
to lav...@googlegroups.com
Hi Shu Fai,

Thanks for the quick response, really appreciate it! The data file indeed has columns with those variable names. Excuse my ignorance, I'm a new Jasp user. What is the solution?

--
You received this message because you are subscribed to a topic in the Google Groups "lavaan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lavaan/9Z5WfmCWXDY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/1237f51f-5a92-4224-909c-95a02557eaf0n%40googlegroups.com.

Shu Fai Cheung (張樹輝)

unread,
Feb 29, 2024, 8:13:09 AM2/29/24
to lavaan
How about using names that do not exist in the dataset for the latent factors? E.g., SATDr, SATNu, and SATOvall?

-- Shu Fai

P.S.: I rarely use JASP. My suggestion is based on my knowledge about lavaan, which I guess is used by JASP to do SEM.

Andries Noeth

unread,
Feb 29, 2024, 9:15:44 AM2/29/24
to lav...@googlegroups.com
HI Shu Fai,

Thanks for your support and suggestions, we really appreciate it. Will look into it and let you know if it works. 

Reply all
Reply to author
Forward
0 new messages