Model running in Mplus, not running in lavaan

34 views
Skip to first unread message

Sooyong Lee

unread,
Mar 18, 2020, 4:24:51 PM3/18/20
to lavaan
Dear all,

I've been studying SEM, and I am trying to run the following model.

dataUse <- read.csv("SRI.cov.csv" )
covUse <- data.matrix(dataUse, rownames.force = NA)

variable_names <- paste0("Y",1:32)
Nobs <- 939

model_stepA <- '
  F1 =~ Y2 + Y3 + start(-3000)*Y4
  F2 =~ Y9 + Y11 + Y13
  F3 =~ Y14 + Y16 + Y17 + Y18 + Y19
  F4 =~ Y20 + Y21
  F5 =~ Y22 + Y23 + Y24 + Y25 + Y26
  F6 =~ Y28 + Y29

'

fit <- sem(model_stepA, 
           sample.cov = covUse,
           sample.nobs = Nobs,
           std.lv = TRUE,
           )
   
The model has no issue in Mplus with a starting value of -3000 for Y4.

The problem is that it does not run in lavaan with the following error:

lavaan WARNING:
    Could not compute standard errors! The information matrix could
    not be inverted. This may be a symptom that the model is not
    identified.

Interestingly, the estimates and fit indices are identical for Mplus and lavaan.
The only thing different is standard errors, because the information matrix isn't inverted in lavaan.

I'd appreciate any suggestions how to make lavaan compute standard errors.

Best, 
Lee.

I've attached the output of Mplus for comparison.
SRI.cov.csv
sri.txt
Mplus_stepa.out

Yves Rosseel

unread,
Mar 21, 2020, 9:25:22 AM3/21/20
to lav...@googlegroups.com
On 3/18/20 9:24 PM, Sooyong Lee wrote:
> The problem is that it does not run in lavaan with the following error:
>
> lavaan WARNING:
>     Could not compute standard errors! The information matrix could
>     not be inverted. This may be a symptom that the model is not
>     identified.
>
> Interestingly, the estimates and fit indices are identical for Mplus and
> lavaan.

That is already a miracle, given the bad scaling properties of your data.

> The only thing different is standard errors, because the information
> matrix isn't inverted in lavaan.

Rescale!

For example,


fit <- sem(model_stepA,
sample.cov = covUse,
sample.nobs = Nobs,
std.lv = TRUE,
)

COV <- lavInspect(fit, "sampstat")$cov
D <- diag(nrow(COV))
D[3, 3] <- 1/10000 # Y4
D[5,5] <- 1/100 # Y13
D[16,16] <- 1/100 # Y24

COV.rescaled <- D %*% COV %*% D
rownames(COV.rescaled) <- colnames(COV.rescaled) <- rownames(COV)
diag(COV.rescaled)

model_stepA.bis <- '
F1 =~ Y2 + Y3 + Y4
F2 =~ Y9 + Y11 + Y13
F3 =~ Y14 + Y16 + Y17 + Y18 + Y19
F4 =~ Y20 + Y21
F5 =~ Y22 + Y23 + Y24 + Y25 + Y26
F6 =~ Y28 + Y29

'

fit2 <- sem(model_stepA.bis, sample.cov = COV.rescaled, sample.nobs =
Nobs, std.lv = TRUE)

And this works. It is fascinating that Mplus does not blink here. I have
not found a way to handle such badly-scaled problems yet.

Yves.

--
Yves Rosseel -- http://www.da.ugent.be
Department of Data Analysis, Ghent University
http://lavaan.org
Reply all
Reply to author
Forward
0 new messages