Single indicator specification in lavaan

280 views
Skip to first unread message

Ángel Rodríguez Laso

unread,
Oct 13, 2022, 5:54:20 AM10/13/22
to lav...@googlegroups.com
Hi,

Is this a correct specification for a single indicator latent variable?:

MOB =~ 1.0*slowstandsw1
slowstandsw1 ~~ (1-0.89)*slowstandsw1


where 0.89 is the reliability of the observed variable?

Best regards,

Ángel

Edward Rigdon

unread,
Oct 13, 2022, 7:02:40 AM10/13/22
to lav...@googlegroups.com
Yes.

--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/CACpA%3DVTuu0M0hhM7V_hMktDpNPJB%2BVsF4_hBO3t6-Gkry37%2BOw%40mail.gmail.com.

Edward Rigdon

unread,
Oct 13, 2022, 7:04:45 AM10/13/22
to lav...@googlegroups.com
Beg pardon. I'm not sure lavaan can manage arithmetic functions inside a label.

Ángel Rodríguez Laso

unread,
Oct 13, 2022, 7:22:40 AM10/13/22
to lav...@googlegroups.com
Thank you Edward.

That would not be a real problem, I can just write: slowstandsw1 ~~
(0.11)*slowstandsw1

But I was asking because I've received this message from lavaan when
using a similar specification:

Warning message:

In lav_object_post_check(object) :
lavaan WARNING: some estimated ov variances are negative

This is my model:


model <- '
# latent variable definitions
#reflective

MOB =~ 1.0*slowstandsw1
VIS =~ 1.0*visimpw1
HEAR =~ 1.0*hearimpw1
VIT =~ lossweiw1 + lossappw1
COG =~ failyearw1 + failmonthw1 + faildmonthw1 + faildweekw1
EMO =~ emptyw1 + nohappw1 + nohopew1

HOSP =~ 1.0*hosp3y
INST =~ 1.0*depaivdw2
BAS =~ 1.0*depabvdw2

#fix error variance
slowstandsw1 ~~ .11*slowstandsw1
visimpw1 ~~ 0.14*visimpw1
hearimpw1 ~~ 0.14*hearimpw1 #copio la de visión
hosp3y ~~ 0.01*hosp3y
depaivdw2 ~~ 0.085*depaivdw2
depabvdw2 ~~ 0.01*depabvdw2 #100% reliability en
literatura pero le meto algo de error

# regressions

BAS ~ MOB + VIS + HEAR + VIT + COG + EMO + HI8_w2 + woman
+ primarios + masqueprim + charlsonw1
INST ~ MOB + VIS + HEAR + VIT + COG + EMO + HI8_w2 +
woman + primarios + masqueprim + charlsonw1
HOSP ~ MOB + VIS + HEAR + VIT + COG + EMO + HI8_w2 +
woman + primarios + masqueprim + charlsonw1
MOB ~ HI8_w2 + woman + primarios + masqueprim + charlsonw1
VIS ~ HI8_w2 + woman + primarios + masqueprim + charlsonw1
HEAR ~ HI8_w2 + woman + primarios + masqueprim + charlsonw1
VIT ~ HI8_w2 + woman + primarios + masqueprim + charlsonw1
COG ~ HI8_w2 + woman + primarios + masqueprim + charlsonw1
EMO ~ HI8_w2 + woman + primarios + masqueprim + charlsonw1
'

fit <- sem(model, data=icopetescsemic, std.lv=TRUE,
ordered=c("slowstandsw1","visimpw1","hearimpw1","lossweiw1","lossappw1",

"failyearw1","failmonthw1","faildmonthw1","faildweekw1","nohappw1","emptyw1","nohopew1","hosp3y",
"depabvdw2","depaivdw2"))


And these are the variances:

Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.slowstandsw1 0.000 0.000 0.000
.visimpw1 0.000 0.000 0.000
.hearimpw1 0.000 0.000 0.000
.hosp3y -0.035 -0.035 -0.029
.depaivdw2 -0.050 -0.050 -0.037
.depabvdw2 -0.131 -0.131 -0.109
.lossweiw1 0.433 0.433 0.415
.lossappw1 0.478 0.478 0.459
.failyearw1 0.585 0.585 0.573
.failmonthw1 0.529 0.529 0.517
.faildmonthw1 0.551 0.551 0.539
.faildweekw1 0.562 0.562 0.550
.emptyw1 0.246 0.246 0.225
.nohappw1 0.402 0.402 0.375
.nohopew1 0.281 0.281 0.259
.MOB 1.000 0.959 0.959
.VIS 1.000 0.842 0.842
.HEAR 1.000 0.944 0.944
.VIT 1.000 0.927 0.927
.COG 1.000 0.953 0.953
.EMO 1.000 0.892 0.892
.HOSP 1.000 0.796 0.796
.INST 1.000 0.724 0.724
.BAS 1.000 0.754 0.754

The culprits are the single indicators hosp3y, depaidvdw2, depabvdw2
of HOSP, INST and BAS, respectively.


The interesting thing is that, when I run the same model without using
these single indicators, but the item themselves:

model <- '
# latent variable definitions
#reflective

MOB =~ 1.0*slowstandsw1
VIS =~ 1.0*visimpw1
HEAR =~ 1.0*hearimpw1
VIT =~ lossweiw1 + lossappw1
COG =~ failyearw1 + failmonthw1 + faildmonthw1 + faildweekw1
EMO =~ emptyw1 + nohappw1 + nohopew1

#HOSP =~ 1.0*hosp3y
#INST =~ 1.0*depaivdw2
#BAS =~ 1.0*depabvdw2

#fix error variance
slowstandsw1 ~~ .11*slowstandsw1
visimpw1 ~~ 0.14*visimpw1
hearimpw1 ~~ 0.14*hearimpw1 #copio la de visión
#hosp3y ~~ 0.01*hosp3y
#depaivdw2 ~~ 0.085*depaivdw2
#depabvdw2 ~~ 0.01*depabvdw2 #100% reliability en
literatura pero le meto algo de error

# regressions

depabvdw2 ~ MOB + VIS + HEAR + VIT + COG + EMO + HI8_w2 +
woman + primarios + masqueprim + charlsonw1
depaivdw2 ~ MOB + VIS + HEAR + VIT + COG + EMO + HI8_w2 +
woman + primarios + masqueprim + charlsonw1
hosp3y ~ MOB + VIS + HEAR + VIT + COG + EMO + HI8_w2 +
woman + primarios + masqueprim + charlsonw1
MOB ~ HI8_w2 + woman + primarios + masqueprim + charlsonw1
VIS ~ HI8_w2 + woman + primarios + masqueprim + charlsonw1
HEAR ~ HI8_w2 + woman + primarios + masqueprim + charlsonw1
VIT ~ HI8_w2 + woman + primarios + masqueprim + charlsonw1
COG ~ HI8_w2 + woman + primarios + masqueprim + charlsonw1
EMO ~ HI8_w2 + woman + primarios + masqueprim + charlsonw1
'

fit <- sem(model, data=icopetescsemic, std.lv=TRUE,
ordered=c("slowstandsw1","visimpw1","hearimpw1","lossweiw1","lossappw1",

"failyearw1","failmonthw1","faildmonthw1","faildweekw1","nohappw1","emptyw1","nohopew1","hosp3y",
"depabvdw2","depaivdw2"))



There is no problem with the variances:

Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.slowstandsw1 0.000 0.000 0.000
.visimpw1 0.000 0.000 0.000
.hearimpw1 0.000 0.000 0.000
.lossweiw1 0.433 0.433 0.415
.lossappw1 0.478 0.478 0.459
.failyearw1 0.585 0.585 0.573
.failmonthw1 0.529 0.529 0.517
.faildmonthw1 0.551 0.551 0.539
.faildweekw1 0.562 0.562 0.550
.emptyw1 0.246 0.246 0.225
.nohappw1 0.402 0.402 0.375
.nohopew1 0.281 0.281 0.259
.depabvdw2 0.869 0.869 0.727
.depaivdw2 0.950 0.950 0.714
.hosp3y 0.965 0.965 0.791
.MOB 1.000 0.959 0.959
.VIS 1.000 0.842 0.842
.HEAR 1.000 0.944 0.944
.VIT 1.000 0.927 0.927
.COG 1.000 0.953 0.953
.EMO 1.000 0.892 0.892


Is there a reason (and more importantly, a solution) for that?

Best regards,

Ángel

El jue, 13 oct 2022 a las 13:04, Edward Rigdon
(<edward...@gmail.com>) escribió:
> To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/CAHxMgefUfEMNVNoKeYPvrSin9e3Thvbabu3VrBOpJmjraK5KZw%40mail.gmail.com.

Yves Rosseel

unread,
Oct 13, 2022, 7:43:52 AM10/13/22
to lav...@googlegroups.com
On 10/13/22 11:54, Ángel Rodríguez Laso wrote:
> Is this a correct specification for a single indicator latent variable?:
>
> MOB =~ 1.0*slowstandsw1
> slowstandsw1 ~~ (1-0.89)*slowstandsw1
>
> where 0.89 is the reliability of the observed variable?

Almost. The above version assumes the observed variance of slowstandsw1
is 1.0. If the observed variance would be different, say, 10, then you
need to write

slowstandsw1 ~~ ((1-0.89)*10)*slowstandsw1

Yves.

Shu Fai Cheung (張樹輝)

unread,
Oct 13, 2022, 7:54:39 AM10/13/22
to lavaan
Interesting. Is it possible to somehow use a function to fix a parameter? E.g.,

slowstandsw1 ~~ ((1-0.89)*sd(tmp))*slowstandsw1

, where tmp is a vector of the values of slowstandsw1. I didn't use slowstandsw1 or icopetescsemic$ slowstandsw1 directly as shown below because I guess it won't work:

slowstandsw1 ~~ ((1-0.89)*sd(slowstandsw1))*slowstandsw1

-- Shu Fai

Yves Rosseel

unread,
Oct 13, 2022, 8:05:00 AM10/13/22
to lav...@googlegroups.com
On 10/13/22 13:54, Shu Fai Cheung (張樹輝) wrote:
> Interesting. Is it possible to somehow use a function to fix a
> parameter? E.g.,
>
> slowstandsw1 ~~ ((1-0.89)*sd(tmp))*slowstandsw1

No. Not 'inside' the model syntax. But you can break up the syntax in
multiple parts, and add computations when needed. For example:

library(lavaan)

model <- c(' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9

x4 ~~ ((1-0.725)*',

var(HolzingerSwineford1939$x4)*300/301,

')*x4')

fit <- cfa(model, data = HolzingerSwineford1939)

(To be consistent with ML, I rescaled the variance with (N-1)/N)


Yves.

Shu Fai Cheung (張樹輝)

unread,
Oct 13, 2022, 8:09:54 AM10/13/22
to lavaan
Thanks a lot! I haven't thought about this technique! I used to use a placeholder and gsub() but this method is much better!

-- Shu Fai

Ángel Rodríguez Laso

unread,
Oct 13, 2022, 8:14:26 AM10/13/22
to lav...@googlegroups.com
Thank you, Yves.

I corrected that, but I'm still getting the same variances:

Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.slowstandsw1 0.000 0.000 0.000
.visimpw1 0.000 0.000 0.000
.hearimpw1 0.000 0.000 0.000
.hosp3y -0.035 -0.035 -0.029
.depaivdw2 -0.050 -0.050 -0.037
.depabvdw2 -0.131 -0.131 -0.109
.lossweiw1 0.433 0.433 0.415
.lossappw1 0.478 0.478 0.459
.failyearw1 0.585 0.585 0.573
.failmonthw1 0.529 0.529 0.517
.faildmonthw1 0.551 0.551 0.539
.faildweekw1 0.562 0.562 0.550
.emptyw1 0.246 0.246 0.225
.nohappw1 0.402 0.402 0.375
.nohopew1 0.281 0.281 0.259
.MOB 1.000 0.959 0.959
.VIS 1.000 0.842 0.842
.HEAR 1.000 0.944 0.944
.VIT 1.000 0.927 0.927
.COG 1.000 0.953 0.953
.EMO 1.000 0.892 0.892
HOSP 1.000 1.000 1.000
INST 1.000 1.000 1.000
BAS 1.000 1.000 1.000

Best regards,

Ángel
> --
> You received this message because you are subscribed to the Google Groups "lavaan" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/7dbefa1d-eb8c-cada-b42f-b52e7b208690%40gmail.com.

Yves Rosseel

unread,
Oct 13, 2022, 8:56:58 AM10/13/22
to lav...@googlegroups.com
But you treat them as ordinal! In that case, the 'residual variances'
are not really parameters of the model (hence no standard error). They
are just the values you get so that the total variances equals unity.

The 'reliability' trick only works for continuous indicators.

Instead of using single-indicator factors with a single ordinal
indicator, just use the ordinal variables directly as observed variables.

Yves.

Ángel Rodríguez Laso

unread,
Oct 13, 2022, 9:27:17 AM10/13/22
to lav...@googlegroups.com
Ok, I didn´t know there was no way to incorporate measurement error in
single-indicators that are qualitative.

Is there any reference I can use to justify that it is not possible to
incorporate measurement error to qualitative single-indicators in SEM?

Thank you.

Ángel
> To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/31962da6-fbe8-640c-051a-d1d2ee92c556%40gmail.com.

Ángel Rodríguez Laso

unread,
Oct 13, 2022, 9:53:01 AM10/13/22
to lav...@googlegroups.com
In any case, I have two quantitative variables in my model (HI8_w2,
charlsonw1). When I use the 'trick' with these two I get negative
variances for the three 'usual' ones as well:

model <- '
# latent variable definitions
#reflective

VIT =~ lossweiw1 + lossappw1
COG =~ failyearw1 + failmonthw1 + faildmonthw1 + faildweekw1
EMO =~ emptyw1 + nohappw1 + nohopew1

AGE =~ 1.0*HI8_w2
CHARL =~ 1.0*charlsonw1

#fix error variance
HI8_w2 ~~ 0.01*28.79527*HI8_w2
charlsonw1 ~~ 0.09*1.133332*charlsonw1

# regressions

depabvdw2 ~ slowstandsw1 + visimpw1 + hearimpw1 + VIT +
COG + EMO + AGE + woman + primarios + masqueprim + CHARL
depaivdw2 ~ slowstandsw1 + visimpw1 + hearimpw1 + VIT +
COG + EMO + AGE + woman + primarios + masqueprim + CHARL
hosp3y ~ slowstandsw1 + visimpw1 + hearimpw1 + VIT + COG
+ EMO + AGE + woman + primarios + masqueprim + CHARL
slowstandsw1 ~ AGE + woman + primarios + masqueprim + CHARL
visimpw1 ~ AGE + woman + primarios + masqueprim + CHARL
hearimpw1 ~ AGE + woman + primarios + masqueprim + CHARL
VIT ~ AGE + woman + primarios + masqueprim + CHARL
COG ~ AGE + woman + primarios + masqueprim + CHARL
EMO ~ AGE + woman + primarios + masqueprim + CHARL
'

fit <- sem(model, data=icopetescsemic, std.lv=TRUE,
ordered=c("slowstandsw1","visimpw1","hearimpw1","lossweiw1","lossappw1",

"failyearw1","failmonthw1","faildmonthw1","faildweekw1","nohappw1","emptyw1","nohopew1","hosp3y",
"depabvdw2","depaivdw2"))


Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.HI8_w2 0.288 0.288 0.224
.charlsonw1 0.102 0.102 0.093
.lossweiw1 0.403 0.403 0.394
.lossappw1 0.510 0.510 0.501
.failyearw1 0.450 0.450 0.440
.failmonthw1 0.412 0.412 0.403
.faildmonthw1 0.661 0.661 0.652
.faildweekw1 0.647 0.647 0.638
.emptyw1 0.242 0.242 0.227
.nohappw1 0.398 0.398 0.378
.nohopew1 0.277 0.277 0.260
.depabvdw2 -5.951 -5.951 -4.457
.depaivdw2 -6.960 -6.960 -4.507
.hosp3y -5.303 -5.303 -3.519
.slowstandsw1 0.972 0.972 0.949
.visimpw1 0.933 0.933 0.834
.hearimpw1 0.866 0.866 0.850
.VIT 1.000 0.647 0.647
.COG 1.000 0.841 0.841
.EMO 1.000 0.635 0.635
AGE 1.000 1.000 1.000
CHARL 1.000 1.000 1.000

El jue, 13 oct 2022 a las 15:27, Ángel Rodríguez Laso
(<angel...@gmail.com>) escribió:
Reply all
Reply to author
Forward
0 new messages