Shawn B
Shawn B

Reputation: 29

Lavann model estimation failed

So I started using lavaan and sem() today. Worked fine with a couple of constructs/latent variables and a single regression model. However, lavaan now fails. Even when I tried to remove the new variables out of the regression model, I still get this error:

'''

    Warning message:
    lavaan->lav_lavaan_step11_estoptim():  
    Model estimation FAILED! Returning starting values

'''

What could be causing this? Dput result:

dput(head(data2))
structure(list(everlied = c(0, 0, 0, 0, 0, 0), Buswebsite = c(3, 
1, 4, 1, 3, 3), BusFacebookpage = c(3, 2, 4, 2, 3, 3), 
periodicals = c(3, 2, 4, 3, 3, 3), internetsearch = c(3, 4, 4, 2, 
4, 4), googlebuslisting = c(3, 5, 5, 3, 3, 3), 
internetdiscussforum = c(3, 3, 4, 4, 3, 4), consumerratingssite = 
c(3,4, 5, 2, 4, 4), friends = c(5, 4, 5, 3, 4, 5), family = c(5, 
5, 5, NA, 4, 5), doctors = c(4, 4, 5, 3, 4, 4), politicians = 
c(3,1, 1, 3, 1, 1), salespeople = c(3, 2, 1, 3, 2, 1), like = 
c(3, 2, 2, 3, 2, 1), newimmigrants = c(3, 3, 2, 2, 3, 1),
businessowners = c(3, 2, 2, 3, 3, 1), celebrities = c(3, 3, 1, 2, 
3, 1), commercialactors = c(3, 2, 1, 2, 3, 1), religious = c(4,
4, 4, 2, 4, 1), socmediainfluencers = c(3, 3, 1, 4, 3, 1), 
teachers = c(4, 4, 4, 3, 4, 1), gender = c(0, 0, 0, 1, 0, 0), age 
= c(5, 5, 3, 3, 3, 2), education = c(4, 2, 3, 4, 5, 3), income = 
c(3, 2, 2, 2, 3, 4), region = c(3, 3, 7, 7, 3, 7)), row.names = 
c(NA, -6L), class = c("tbl_df", "tbl", "data.frame"))

My model is pretty tame. The observed outcome variable is ordinal (it's Likert scale values). The predictor variables for demographic are categorical. The rest of the variables are also ordinal. The first time I tried, I just used the first two latent vars. Coincidentally, I couldn't find anything about this error per se but found one post that mentioned about variance. I did try inserting auto.var = TRUE but that didn't help.

Here's what I have.

`
    model <- '
    + person  =~ family + friends
    + demographic =~ age + gender + income + education + 
    region 
    + instit =~ doctors+politicians+religious+businessowners
    + soc =~ salespeople + celebrities + commercialactors + 
    socmediainfluencers + newimmigrants
    + info =~ Buswebsite + BusFacebookpage + periodicals + 
    internetsearch + googlebuslisting + internetdiscussforum + 
    consumerratingssite
    + like ~ person + demographic + instit + soc + info 
+ '
> model_out <- sem(model, data=dat2)

Thank you

Upvotes: 0

Views: 208

Answers (1)

Shawn B
Shawn B

Reputation: 29

So, after trying several times, I decided to consolidate some of the latent variables. It seems that lavaan/sem doesn't like more than 4 constructs. Worked perfectly with 4 latent vars.

Upvotes: 0

Related Questions