SEM involving latent vars within latent vars

60 views
Skip to first unread message

nmc09

unread,
Jun 14, 2019, 8:00:17 AM6/14/19
to lavaan
I have been trying to run a SEM in lavaan that contains two layers of latent vars. I'm finding that when I remove the latent vars that contain latent vars, the model runs. But when I run the model that I actually want (i.e. one containing several latent vars that themselves contain latent vars), I get the error:

lavaan WARNING: the optimizer warns that a solution has NOT been found!

Any straightforward or obvious solutions?

# Here's the model I am aiming for:
model
<- '
  # measurement model
latentvar1 =~ obsvar1 + obsvar2 + obsvar3 + obsvar4
latentvar2 =~ obsvar5 + obsvar6 + obsvar7 + obsvar8 + obsvar9 + obsvar10
latentvar3 =~ obsvar11 + obsvar12 + obsvar13 + obsvar14 + obsvar15 + obsvar16 + obsvar17 + obsvar18 + obsvar19
latentvar4 =~ obsvar20 + obsvar21 + obsvar22 +obsvar23
latentvarA =~ latentvar1 + latentvar2 + latentvar3 + latentvar4
latentvar5=~ obsvar24 + obsvar25 + obsvar26 + obsvar27 + obsvar28 + obsvar29 + obsvar30 + obsvar31 + obsvar32 + obsvar33 + obsvar34 + obsvar35
latentvar6 =~ obsvar36 + obsvar37 + obsvar38 + 39 + obsvar40 + obsvar41
latentvarB =~ latentvar5 + latentvar6
latentvar7 =~ obsvar42 + obsvar43 + obsvar44
latentvar8 =~ obsvar45 + obsvar46 + obsvar47
latentvar9 =~ obsvar48 + obsvar49 + obsvar50
latentvar10 =~ obsvar51 + obsvar52
latentvar11 =~ obsvar53 + obsvar54
latentvar12 =~ obsvar55 + obsvar56
latentvarC =~ latentvar7 + latentvar8 + latentvar9 + latentvar10 + latentvar11 + latentvar12
latentvarD=~ obsvar57 + obsvar58 + obsvar59 + obsvar60 + obsvar61 + obsvar62 + obsvar63 + obsvar64
latentvarE=~ obsvar65 + obsvar66 + obsvar67 + obsvar68
latentvarF=~ obsvar69 + obsvar70 + obsvar71 + obsvar72
# regressions
latentvarB~ latentvarA
latentvarC ~ latentvarA
latentvarD ~ latentvarA
latentvarE ~ latentvarA
latentvarF ~ latentvarA
'

fit
<- sem(model, data= data)
summaryfit
, fit.measures=TRUE, standardized=TRUE)



Edward Rigdon

unread,
Jun 14, 2019, 9:17:50 AM6/14/19
to lav...@googlegroups.com
Without seeing your output, the weak link looks to be latentvarB. Only two other variables are dependent on latentvarB--latentvar5 and latentvar6. LatentvarB is itself dependent on one other variable, latentvarA. Even if lavaan has successfully imposed basic identifying constraints (such as fixing latentvarB's variance, or fixing one of its loadings), identification may be marginal. Try estimating the model without latentvarB, but with latentvar5 and latentvar6 allowed to covary.
If it was a full-on identification failure, then you would get a message to that effect. But the model may be nearly not identified, where your satellite of a model hasn't quite crashed into the black hole but it's on the fringe. Look at the prameter estimates. You want loadings / R2's to be strong for latentvarB especially, because its status is so fragile.
You may also get around the problem by setting starting values for some of these parameter estimates. You want values close to the final estimates, but especially on the correct side of 0, so that the iterating solution does not cross through the singularity.
Again, that's all said without having seen your solution or data.

On Fri, Jun 14, 2019 at 7:03 AM nmc09 <noraam...@gmail.com> wrote:
Below is the SEM I have been trying to run via lavaan. I'm finding that when I remove the latent vars that contain latent vars, the model runs. But when I run the model that I actually want (i.e. one containing several latent vars that themselves contain latent vars), I get the error:
fit <- sem(model, data= AsburyPEFit.data)
summaryfit, fit.measures=TRUE, standardized=TRUE)

--
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 post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/503855d6-cdbc-4b62-b3ba-3405cdcc276e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

nmc09

unread,
Jun 14, 2019, 2:14:13 PM6/14/19
to lavaan
Hello

Thank you for your input.

I have tried your solution (dropping latentvarB and making latentvar5 and latent6 covary) but I get the same error message. In fact, to test whether the error is indeed specific to latentvarB, I removed it, latenvar5 and latentvar6 altogether: I got the same error message. I do think there is a general issue with latent vars containing latent vars. Might this be related to a relatively small sample size - N = 450?

Do let me know if anyone has any further thoughts while I try out some other suggestions that Edward made.

Many thanks!
fit <- sem(model, data= data)
summaryfit, fit.measures=TRUE, standardized=TRUE)

--
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 lav...@googlegroups.com.

Terrence Jorgensen

unread,
Jun 17, 2019, 5:10:45 PM6/17/19
to lavaan
Might this be related to a relatively small sample size - N = 450?

Your model is gigantic, so this might be a problem.  Try modeling the first factor to obsvar1-4, then add the second factor to obsvar5-10, and so on until you see when it breaks.  Not that it will provide a solution, but it might be informative to know what your limit is.  Factor-score regression might be an option.

fit <- lavaan:::fsr(model, data= data)

But that is still a hidden function, in development until the kinks are worked out.  You can read about the approach here:


Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Nora McIntyre

unread,
Jun 19, 2019, 2:44:53 AM6/19/19
to lav...@googlegroups.com
Thanks for your input Terrence. Maybe I can run the sem with only the means for the overall constructs,  having already run the cfa on the whole of each construct in relation to their subscales. Or is that bad practice?



--
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 post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.

Terrence Jorgensen

unread,
Jun 19, 2019, 7:50:30 AM6/19/19
to lavaan
Maybe I can run the sem with only the means for the overall constructs,  having already run the cfa on the whole of each construct in relation to their subscales. Or is that bad practice?

Scale means still include measurement error, and they assume all items are equally related to the construct.  You can certainly try a path analysis on scale means, but some estimates might be attenuated (and have lower power) if your constructs are reflective:


And you might get the opposite problem (inflated estimates and Type I errors) if your construct is actually formative:

Nora McIntyre

unread,
Jun 27, 2019, 3:06:27 PM6/27/19
to lav...@googlegroups.com
Dear Terrence 

Thank you for your response regarding taking scale means. I will give factor score regression a try. Can you direct me to the documentation for this, so I know the parameter options available? I can't seem to find it at the moment.

Much appreciation.

--
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 post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.

For more options, visit https://groups.google.com/d/optout.


--
Dr. Nora McIntyre

Research Associate
Department of Education
University of York
United Kingdom

Teaching Associate
Faculty of Science
University of Sheffield
United Kingdom

Terrence Jorgensen

unread,
Jun 27, 2019, 5:26:01 PM6/27/19
to lavaan
I will give factor score regression a try. Can you direct me to the documentation for this, so I know the parameter options available?

No, it is still a hidden function.  If you type 

lavaan::fsr(


into the Console, and press the Tab key (once in RStudio, twice in R, depending on the OS), it will display a list of arguments.  But there is not yet a documentation page letting you know the options in detail because it is not ready for public consumption.

You could fit individual factor models and save plausible values of each factor's factor-scores, then loop over factors to merge into a single list of imputed data sets, but that will require careful attention (e.g., depending on missing data patterns, you might not get values for every row in your data in each factor's model).  If you want to try this approach, the plausibleValues() function in the development version of semTools will help:

devtools::install_github("simsem/semTools/semTools")
Reply all
Reply to author
Forward
0 new messages