Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Fixing parameters with WLSMV

698 views
Skip to first unread message

veren...@gmail.com

unread,
Sep 18, 2018, 10:40:53 AM9/18/18
to lavaan
Hi all,

I have a problem with running a CFA with WLSMV (dichotomous data).

R has the basic setting of fixing the first factor loading of a factor. I want all factor loadings to be free estimated. How can I do this? The following syntax doesn't work

myModel11 <- "FA =~ NA* T1_OD1a + T1_OR1a + V1_OD1a + V1_OR1a + T2_OD1a + T2_OR1a + V2_OD1a + V2_OR1a"
fit11 <- cfa(myModel11, data=data.T1, estimator = "WLSMV", ordered = c("T1_OD1a, T1_OR1a, V1_OD1a, V1_OR1a, T2_OD1a, T2_OR1a, V2_OD1a, V2_OR1a"))
model <- summary(fit11, fit.measures = TRUE, rsq=TRUE, standardized=TRUE)
modificationIndices(fit11)
reliability(fit11)


Similar problem:
In another case I want to fix parameters. But this synatx doesn't work either:

myModel32 <- 'Video 1 =~ V1_OD1a + V1_OR1a
Video 2 =~ V2_OD1a + V2_OR1a
Text 1=~ T1_OD1a + T1_OR1a
Text 2=~ T2_OD1a + T2_OR1a
Diagnostik =~ T1_OD1a + 1*V1_OD1a + 1*T2_OD1a + 1*V2_OD1a
Rückmeldung =~ T1_OR1a + 1*V1_OR1a + 1*T2_OR1a + 1*V2_OR1a
'
fit32 <- cfa(myModel32, data = data.T1,estimator = "WLSMV", ordered = c("T1_OD1a, T1_OR1a, V1_OD1a, V1_OR1a, T2_OD1a, T2_OR1a, V2_OD1a, V2_OR1a"))
summary(fit32, fit.measures =T, standardized = T, rsq=T)

Thank you for your help!

Terrence Jorgensen

unread,
Sep 24, 2018, 5:29:54 AM9/24/18
to lavaan
I want all factor loadings to be free estimated. How can I do this? The following syntax doesn't work

Works fine for me.

In another case I want to fix parameters. But this synatx doesn't work either:

Works fine for me. 

myModel32 <- 'Video 1 =~ NA*V1_OD1a + V1_OR1a
Video 2 =~ NA*V2_OD1a + V2_OR1a
Text 1=~ NA*T1_OD1a + T1_OR1a
Text 2=~ NA*T2_OD1a + T2_OR1a

Diagnostik =~ T1_OD1a + 1*V1_OD1a + 1*T2_OD1a + 1*V2_OD1a
Rückmeldung =~ T1_OR1a + 1*V1_OR1a + 1*T2_OR1a + 1*V2_OR1a
'

fit32
<- cfa(myModel32)
parTable
(fit32)


What version of lavan are you using?

sessionInfo()

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

veren...@gmail.com

unread,
Sep 24, 2018, 7:09:04 AM9/24/18
to lavaan
I´m using lavaan_0.6-3.

Maybe the warning messages might help?:

Results using "NA*"
> myModel11 <- "FA =~ NA*T1_OD1a + T1_OR1a + V1_OD1a + V1_OR1a + T2_OD1a + T2_OR1a + V2_OD1a + V2_OR1a"
> fit11 <- cfa(myModel11, data=data.T1, estimator = "WLSMV", ordered = c("T1_OD1a, T1_OR1a, V1_OD1a, V1_OR1a, T2_OD1a, T2_OR1a, V2_OD1a, V2_OR1a"))
Warning messages:
1: In lav_partable_check(lavpartable, categorical = lavoptions$categorical,  :
  lavaan WARNING: parameter table does not contain thresholds 
2: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats,  :
  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.
3: In lav_test_satorra_bentler(lavobject = NULL, lavsamplestats = lavsamplestats,  :
  lavaan WARNING: could not invert information matrix

> model <- summary(fit11, fit.measures = TRUE, rsq=TRUE, standardized=TRUE)
lavaan 0.6-3 ended normally after 32 iterations

  Optimization method                           NLMINB
  Number of free parameters                         25

                                                  Used       Total
  Number of observations                           276         277

  Estimator                                       DWLS
  Model Fit Test Statistic                      18.481
  Degrees of freedom                                19
  P-value (Chi-square)                           0.491
Error in TEST[[2]] : subscript out of bounds

Results without "NA*":
> myModel11 <- "FA =~ T1_OD1a + T1_OR1a + V1_OD1a + V1_OR1a + T2_OD1a + T2_OR1a + V2_OD1a + V2_OR1a"
> fit11 <- cfa(myModel11, data=data.T1, estimator = "WLSMV", ordered = c("T1_OD1a, T1_OR1a, V1_OD1a, V1_OR1a, T2_OD1a, T2_OR1a, V2_OD1a, V2_OR1a"))
Warning messages:
1: In lav_partable_check(lavpartable, categorical = lavoptions$categorical,  :
  lavaan WARNING: parameter table does not contain thresholds 
2: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats,  :
  lavaan WARNING:
    The variance-covariance matrix of the estimated parameters (vcov)
    does not appear to be positive definite! The smallest eigenvalue
    (= -5.703747e-18) is smaller than zero. This may be a symptom that
    the model is not identified.
> model <- summary(fit11, fit.measures = TRUE, rsq=TRUE, standardized=TRUE)
lavaan 0.6-3 ended normally after 37 iterations

  Optimization method                           NLMINB
  Number of free parameters                         24

                                                  Used       Total
  Number of observations                           276         277

  Estimator                                       DWLS      Robust
  Model Fit Test Statistic                      18.481      35.161
  Degrees of freedom                                20          20
  P-value (Chi-square)                           0.556       0.019
  Scaling correction factor                                  0.568
  Shift parameter                                            2.640
    for simple second-order correction (Mplus variant)

Model test baseline model:

  Minimum Function Test Statistic              257.648     136.904
  Degrees of freedom                                28          28
  P-value                                        0.000       0.000

User model versus baseline model:

  Comparative Fit Index (CFI)                    1.000       0.861
  Tucker-Lewis Index (TLI)                       1.009       0.805

  Robust Comparative Fit Index (CFI)                            NA
  Robust Tucker-Lewis Index (TLI)                               NA

Root Mean Square Error of Approximation:

  RMSEA                                          0.000       0.053
  90 Percent Confidence Interval          0.000  0.048       0.021  0.081
  P-value RMSEA <= 0.05                          0.961       0.409

  Robust RMSEA                                                  NA
  90 Percent Confidence Interval                                NA     NA

Standardized Root Mean Square Residual:

  SRMR                                           0.055       0.055

Parameter Estimates:

  Information                                 Expected
  Information saturated (h1) model        Unstructured
  Standard Errors                           Robust.sem

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  FA =~                                                                 
    T1_OD1a           1.000                               0.177    0.463
    T1_OR1a           0.609    0.168    3.631    0.000    0.108    0.284
    V1_OD1a           1.173    0.218    5.393    0.000    0.208    0.463
    V1_OR1a           0.783    0.175    4.474    0.000    0.139    0.421
    T2_OD1a           1.479    0.264    5.612    0.000    0.262    0.660
    T2_OR1a           0.524    0.153    3.428    0.001    0.093    0.366
    V2_OD1a           1.536    0.290    5.289    0.000    0.272    0.583
    V2_OR1a           0.628    0.178    3.533    0.000    0.111    0.410

Intercepts:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .T1_OD1a           1.178    0.023   51.102    0.000    1.178    3.076
   .T1_OR1a           1.174    0.023   51.360    0.000    1.174    3.091
   .V1_OD1a           1.279    0.027   47.290    0.000    1.279    2.847
   .V1_OR1a           1.123    0.020   56.674    0.000    1.123    3.411
   .T2_OD1a           1.196    0.024   49.981    0.000    1.196    3.009
   .T2_OR1a           1.069    0.015   70.008    0.000    1.069    4.214
   .V2_OD1a           1.319    0.028   46.930    0.000    1.319    2.825
   .V2_OR1a           1.080    0.016   66.108    0.000    1.080    3.979
    FA                0.000                               0.000    0.000

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .T1_OD1a           0.115    0.014    8.284    0.000    0.115    0.786
   .T1_OR1a           0.133    0.015    9.007    0.000    0.133    0.919
   .V1_OD1a           0.159    0.015   10.791    0.000    0.159    0.786
   .V1_OR1a           0.089    0.013    6.742    0.000    0.089    0.823
   .T2_OD1a           0.089    0.013    7.114    0.000    0.089    0.565
   .T2_OR1a           0.056    0.011    5.086    0.000    0.056    0.866
   .V2_OD1a           0.144    0.015    9.510    0.000    0.144    0.660
   .V2_OR1a           0.061    0.011    5.468    0.000    0.061    0.832
    FA                0.031    0.011    2.977    0.003    1.000    1.000

R-Square:
                   Estimate
    T1_OD1a           0.214
    T1_OR1a           0.081
    V1_OD1a           0.214
    V1_OR1a           0.177
    T2_OD1a           0.435
    T2_OR1a           0.134
    V2_OD1a           0.340
    V2_OR1a           0.168

Terrence Jorgensen

unread,
Sep 25, 2018, 7:06:39 AM9/25/18
to lavaan
Results using "NA*"
> myModel11 <- "FA =~ NA*T1_OD1a + T1_OR1a + V1_OD1a + V1_OR1a + T2_OD1a + T2_OR1a + V2_OD1a + V2_OR1a"
> fit11 <- cfa(myModel11, data=data.T1, estimator = "WLSMV", ordered = c("T1_OD1a, T1_OR1a, V1_OD1a, V1_OR1a, T2_OD1a, T2_OR1a, V2_OD1a, V2_OR1a"))

Set std.lv = TRUE if you want to free the first factor loading (then NA* would not be necessary anyway), or fix the factor variance in the model syntax.  Either way, you need to identify the latent scale somehow, otherwise your model is not identified (perhaps causing the failure to calculate the robust test statistic, which prevents the remainder of the summary() from being printed).
Reply all
Reply to author
Forward
0 new messages