> mod <- 'F1 =~ x1 + x2 + x3
+ F2 =~ x4 + x5 + x6
+ F3 =~ x7 + x8 + x9
+ g =~ F1 + F2 + F3'
>
>
>
> fit <- lavaan::cfa(mod, sample.cov = test_models$baseline$cormat,
+ sample.nobs = 500, estimator = "ml")
found: V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18
expected: x1 x2 x3 x4 x5 x6 x7 x8 x9
Error: lavaan->lav_samplestats_from_moments():
rownames of covariance matrix do not match the model! found: ("V1", "V2", "V3", "V4", "V5", "V6",
"V7", "V8", "V9", "V10", "V11", "V12", "V13", "V14", "V15", "V16", "V17", "V18") expected: ("x1",
"x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9")
--
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/a58df4cc-90a5-477b-8b67-37edb175a7adn%40googlegroups.com.
Found: V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18
expected: x1 x2 x3 x4 x5 x6 x7 x8 x9
Error: lavaan->lav_samplestats_from_moments():
rownames of covariance matrix do not match the model! found: ("V1", "V2", "V3", "V4", "V5", "V6",
"V7", "V8", "V9", "V10", "V11", "V12", "V13", "V14", "V15", "V16", "V17", "V18") expected: ("x1",
"x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9")
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/8e116e79-25bf-4490-84ba-7ffa6edbff64n%40googlegroups.com.
Thank you very much for helpful reply.
Unfortunately, there is something that I still do not understand.
If I understand properly, one can’t specify the model in the same way given one do not use the same data frame.
More precisely one can’t specify 9 observed variables (in this case, one got an error message (below)) but one need to specify 18 observed variables for a model with 9 observed variables given that it does not read the same data frame.
In this case, however, I do not understand how to interpret the results given I have twice more observed variables.
Could you please, give further explanations?
Thank you very much.
Pierre-Charles
> # Create and fit model in lavaan (assume all variables have SDs of 1)
> mod <- 'F1 =~ V1 + V2 + V3
+ F2 =~ V4 + V5 + V6
+ F3 =~ V7 + V8 + V9
+ g =~ F1 + F2 + F3'
> fit <- lavaan::cfa(mod, sample.cov = test_models$baseline$cormat,
+ sample.nobs = 500, estimator = "ml")
Warning message:
lavaan->lav_object_post_check():
some estimated lv variances are negative
>
> SL_lav <- SL(fit, g_name = "g")
Warning message:
In sqrt(std_sol$psi[col_names, col_names]) : NaNs produced
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/74252829-d84c-4804-80ca-2db8f6fe3d74n%40googlegroups.com.
'found: V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18
expected: x1 x2 x3 x4 x5 x6 x7 x8 x9
Error: lavaan->lav_samplestats_from_moments():
rownames of covariance matrix do not match the model! found: ("V1", "V2", "V3", "V4", "V5", "V6", "V7", "V8", "V9", "V10", "V11", "V12", "V13", "V14", "V15", "V16", "V17", "V18") expected: ("x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9")'