Question on computation time

506 views
Skip to first unread message

MikkelGH

unread,
Aug 11, 2014, 9:26:46 AM8/11/14
to lav...@googlegroups.com
Dear lavaan-users,

I am experiencing very long computation times. Running 'sem' is really slow with my model and (probably out of ignorance) I am unable to figure out why. Perhaps I have to many parameters?

For convenience I have attached one of the imputed datasets for the variables in question (n = 796).

The model looks like this:

-------------- SCRIPT BEGINS --------------
cid.sem.only<-'
    cit =~ cit1 + cit4
    cce =~ cce1 + cce4
    cia =~ cia2 + cia3
    oit =~ oit1 + oit2 + oit3 + oit4
    oce =~ oce1 + oce2 + oce3 + oce4
    oia =~ oia1 + oia2 + oia3 + oia4
    wit =~ wit1 + wit2 + wit3 + wit4
    wce =~ wce1 + wce2 + wce3 + wce4
    wia =~ wia1 + wia2 + wia3 + wia4
    pit =~ pit1 + pit2 + pit3 + pit4
    pce =~ pce1 + pce2 + pce3 + pce4
    pia =~ pia1 + pia2 + pia3 + pia4

    cid =~ cit + cce + cia
    oid =~ oit + oce + oia
    wid =~ wit + wce + wia
    pid =~ pit + pce + pia

    cid ~ oid + wid + pid
    oid ~ wid
    wid ~ pid
'

test.sem <- sem(cid.sem.only, data = test.data, estimator = "WLSMV")

-------------- SCRIPT ENDS --------------

I can have the computer run for hours with no result. Is this to be expected?

Thanks for any help you may provide.


Best regards,
Mikkel
test.data.rdata

Edward Rigdon

unread,
Aug 11, 2014, 10:18:23 AM8/11/14
to lav...@googlegroups.com

Mikkel—

     You are specifying a second order factor model.  The sem function automatically scales the first level factors by fixing the first loading to 1, but I do not believe the sem function automatically scales the second order factors (cid, oid, wid, pid).  These factors also need scaling, and uncertainty about this might be causing an identification problem, which could make an algorithm cycle for a long time.  You may be able to remove this problem by specifying scale for those four factors.  You might do this by explicitly fixing one loading to 1, just as you do with the first order indicators, i.e.:

 

    cid =~ 1*cit + cce + cia

--Ed Rigdon

--
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 http://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.

Seongho Bae

unread,
Aug 11, 2014, 1:14:04 PM8/11/14
to lav...@googlegroups.com
I think your computer hardware environment is too low performance to estimate via WLSMV or occurred by using basic R BLAS.

I just do execute your syntax with ignored Edward's opinion, I get the result just 60 seconds.


It may help you.

Seongho Bae.

2014년 8월 11일 월요일 오후 10시 26분 46초 UTC+9, MikkelGH 님의 말:

Seongho Bae

unread,
Aug 11, 2014, 1:28:47 PM8/11/14
to lav...@googlegroups.com
Here your are the results:


> system.time(test.sem <- sem(cid.sem.only, data = test.data, estimator = "WLSMV"))
   user  system elapsed 
 218.75   20.01   71.44 
Warning messages:
1: In lavaan::lavaan(model = cid.sem.only, data = test.data, estimator = "WLSMV",  :
  lavaan WARNING: some estimated variances are negative
2: In lavaan::lavaan(model = cid.sem.only, data = test.data, estimator = "WLSMV",  :
  lavaan WARNING: covariance matrix of latent variables is not positive definite; use inspect(fit,"cov.lv") to investigate.
> summary(test.sem, standardize=TRUE)
lavaan (0.5-16) converged normally after  96 iterations

  Number of observations                           796

  Estimator                                       DWLS      Robust
  Minimum Function Test Statistic            13331.492    8789.149
  Degrees of freedom                               802         802
  P-value (Chi-square)                           0.000       0.000
  Scaling correction factor                                  1.605
  Shift parameter                                          482.565
    for simple second-order correction (Mplus variant)

Parameter estimates:

  Information                                 Expected
  Standard Errors                           Robust.sem

                   Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
Latent variables:
  cit =~
    cit1              1.000                               0.799    0.799
    cit4              1.020    0.050   20.319    0.000    0.816    0.816
  cce =~
    cce1              1.000                               0.913    0.913
    cce4              0.950    0.038   25.192    0.000    0.868    0.868
  cia =~
    cia2              1.000                               0.837    0.837
    cia3              1.054    0.045   23.380    0.000    0.882    0.882
  oit =~
    oit1              1.000                               0.746    0.746
    oit2              1.176    0.041   28.942    0.000    0.877    0.877
    oit3              0.863    0.039   22.076    0.000    0.644    0.644
    oit4              1.082    0.038   28.394    0.000    0.807    0.807
  oce =~
    oce1              1.000                               0.773    0.773
    oce2              0.863    0.043   19.942    0.000    0.668    0.668
    oce3              1.071    0.042   25.374    0.000    0.828    0.828
    oce4              0.966    0.043   22.417    0.000    0.747    0.747
  oia =~
    oia1              1.000                               0.874    0.874
    oia2              0.999    0.016   61.161    0.000    0.873    0.873
    oia3              0.969    0.020   48.217    0.000    0.846    0.846
    oia4              1.028    0.019   54.331    0.000    0.898    0.898
  wit =~
    wit1              1.000                               0.689    0.689
    wit2              1.124    0.046   24.509    0.000    0.775    0.775
    wit3              1.115    0.049   22.717    0.000    0.769    0.769
    wit4              1.249    0.052   24.005    0.000    0.861    0.861
  wce =~
    wce1              1.000                               0.632    0.632
    wce2              1.126    0.047   23.755    0.000    0.711    0.711
    wce3              1.084    0.044   24.827    0.000    0.685    0.685
    wce4              1.185    0.047   25.038    0.000    0.748    0.748
  wia =~
    wia1              1.000                               0.883    0.883
    wia2              0.998    0.015   65.322    0.000    0.881    0.881
    wia3              0.992    0.018   55.555    0.000    0.875    0.875
    wia4              0.996    0.015   67.247    0.000    0.879    0.879
  pit =~
    pit1              1.000                               0.711    0.711
    pit2              1.073    0.047   22.996    0.000    0.764    0.764
    pit3              1.011    0.046   21.905    0.000    0.719    0.719
    pit4              1.214    0.053   22.792    0.000    0.863    0.863
  pce =~
    pce1              1.000                               0.607    0.607
    pce2              1.253    0.058   21.650    0.000    0.760    0.760
    pce3              1.087    0.052   20.937    0.000    0.660    0.660
    pce4              1.289    0.058   22.102    0.000    0.782    0.782
  pia =~
    pia1              1.000                               0.839    0.839
    pia2              1.014    0.020   49.801    0.000    0.851    0.851
    pia3              1.005    0.026   38.025    0.000    0.844    0.844
    pia4              0.992    0.020   48.553    0.000    0.833    0.833
  cid =~
    cit               1.000                               0.880    0.880
    cce               1.001    0.061   16.467    0.000    0.771    0.771
    cia               0.904    0.062   14.584    0.000    0.760    0.760
  oid =~
    oit               1.000                               0.591    0.591
    oce               1.285    0.087   14.812    0.000    0.733    0.733
    oia               1.697    0.116   14.647    0.000    0.857    0.857
  wid =~
    wit               1.000                               0.640    0.640
    wce               1.344    0.078   17.338    0.000    0.939    0.939
    wia               1.593    0.083   19.193    0.000    0.796    0.796
  pid =~
    pit               1.000                               0.520    0.520
    pce               1.343    0.094   14.337    0.000    0.819    0.819
    pia               1.766    0.117   15.150    0.000    0.779    0.779

Regressions:
  cid ~
    oid               0.722    0.095    7.636    0.000    0.452    0.452
    wid              -0.030    0.205   -0.144    0.885   -0.019   -0.019
    pid               0.351    0.249    1.411    0.158    0.185    0.185
  oid ~
    wid               0.617    0.051   11.983    0.000    0.617    0.617
  wid ~
    pid               1.340    0.096   13.955    0.000    1.124    1.124

Intercepts:
    cit               0.000                               0.000    0.000
    cce               0.000                               0.000    0.000
    cia               0.000                               0.000    0.000
    oit               0.000                               0.000    0.000
    oce               0.000                               0.000    0.000
    oia               0.000                               0.000    0.000
    wit               0.000                               0.000    0.000
    wce               0.000                               0.000    0.000
    wia               0.000                               0.000    0.000
    pit               0.000                               0.000    0.000
    pce               0.000                               0.000    0.000
    pia               0.000                               0.000    0.000
    cid               0.000                               0.000    0.000
    oid               0.000                               0.000    0.000
    wid               0.000                               0.000    0.000
    pid               0.000                               0.000    0.000

Thresholds:
    cit1|t1          -1.897    0.090  -21.063    0.000   -1.897   -1.897
    cit1|t2          -1.810    0.084  -21.490    0.000   -1.810   -1.810
    cit1|t3          -1.596    0.073  -21.989    0.000   -1.596   -1.596
    cit1|t4          -0.825    0.050  -16.361    0.000   -0.825   -0.825
    cit1|t5          -0.582    0.047  -12.312    0.000   -0.582   -0.582
    cit1|t6           0.549    0.047   11.690    0.000    0.549    0.549
    cit4|t1          -2.202    0.117  -18.771    0.000   -2.202   -2.202
    cit4|t2          -1.794    0.083  -21.554    0.000   -1.794   -1.794
    cit4|t3          -1.542    0.070  -21.982    0.000   -1.542   -1.542
    cit4|t4          -0.794    0.050  -15.902    0.000   -0.794   -0.794
    cit4|t5          -0.474    0.046  -10.230    0.000   -0.474   -0.474
    cit4|t6           0.777    0.050   15.637    0.000    0.777    0.777
    cce1|t1          -1.204    0.058  -20.619    0.000   -1.204   -1.204
    cce1|t2          -0.560    0.047  -11.898    0.000   -0.560   -0.560
    cce1|t3          -0.337    0.045   -7.424    0.000   -0.337   -0.337
    cce1|t4           0.297    0.045    6.579    0.000    0.297    0.297
    cce1|t5           0.702    0.049   14.431    0.000    0.702    0.702
    cce1|t6           1.607    0.073   21.983    0.000    1.607    1.607
    cce4|t1          -1.204    0.058  -20.619    0.000   -1.204   -1.204
    cce4|t2          -0.549    0.047  -11.690    0.000   -0.549   -0.549
    cce4|t3          -0.235    0.045   -5.238    0.000   -0.235   -0.235
    cce4|t4           0.219    0.045    4.885    0.000    0.219    0.219
    cce4|t5           0.613    0.048   12.863    0.000    0.613    0.613
    cce4|t6           1.428    0.066   21.782    0.000    1.428    1.428
    cia2|t1          -2.239    0.122  -18.425    0.000   -2.239   -2.239
    cia2|t2          -1.917    0.091  -20.953    0.000   -1.917   -1.917
    cia2|t3          -1.585    0.072  -21.992    0.000   -1.585   -1.585
    cia2|t4          -0.474    0.046  -10.230    0.000   -0.474   -0.474
    cia2|t5          -0.357    0.045   -7.847    0.000   -0.357   -0.357
    cia2|t6           0.735    0.049   14.970    0.000    0.735    0.735
    cia3|t1          -2.280    0.126  -18.034    0.000   -2.280   -2.280
    cia3|t2          -1.720    0.079  -21.797    0.000   -1.720   -1.720
    cia3|t3          -1.532    0.070  -21.975    0.000   -1.532   -1.532
    cia3|t4          -0.549    0.047  -11.690    0.000   -0.549   -0.549
    cia3|t5          -0.404    0.046   -8.830    0.000   -0.404   -0.404
    cia3|t6           0.711    0.049   14.566    0.000    0.711    0.711
    oit1|t1          -1.552    0.071  -21.988    0.000   -1.552   -1.552
    oit1|t2          -0.834    0.051  -16.492    0.000   -0.834   -0.834
    oit1|t3          -0.582    0.047  -12.312    0.000   -0.582   -0.582
    oit1|t4          -0.066    0.044   -1.488    0.137   -0.066   -0.066
    oit1|t5           0.401    0.046    8.760    0.000    0.401    0.401
    oit1|t6           1.532    0.070   21.975    0.000    1.532    1.532
    oit2|t1          -1.129    0.056  -20.003    0.000   -1.129   -1.129
    oit2|t2          -0.354    0.045   -7.776    0.000   -0.354   -0.354
    oit2|t3          -0.123    0.045   -2.762    0.006   -0.123   -0.123
    oit2|t4           0.491    0.046   10.578    0.000    0.491    0.491
    oit2|t5           1.112    0.056   19.841    0.000    1.112    1.112
    oit2|t6           2.052    0.102   20.043    0.000    2.052    2.052
    oit3|t1          -1.230    0.059  -20.809    0.000   -1.230   -1.230
    oit3|t2          -0.481    0.046  -10.369    0.000   -0.481   -0.481
    oit3|t3          -0.101    0.045   -2.267    0.023   -0.101   -0.101
    oit3|t4           0.597    0.047   12.588    0.000    0.597    0.597
    oit3|t5           0.865    0.051   16.945    0.000    0.865    0.865
    oit3|t6           1.810    0.084   21.490    0.000    1.810    1.810
    oit4|t1          -1.300    0.061  -21.246    0.000   -1.300   -1.300
    oit4|t2          -0.398    0.046   -8.690    0.000   -0.398   -0.398
    oit4|t3          -0.035    0.044   -0.779    0.436   -0.035   -0.035
    oit4|t4           0.432    0.046    9.391    0.000    0.432    0.432
    oit4|t5           0.785    0.050   15.769    0.000    0.785    0.785
    oit4|t6           1.693    0.077   21.862    0.000    1.693    1.693
    oce1|t1          -1.542    0.070  -21.982    0.000   -1.542   -1.542
    oce1|t2          -0.986    0.053  -18.510    0.000   -0.986   -0.986
    oce1|t3          -0.777    0.050  -15.637    0.000   -0.777   -0.777
    oce1|t4          -0.304    0.045   -6.720    0.000   -0.304   -0.304
    oce1|t5           0.110    0.045    2.479    0.013    0.110    0.110
    oce1|t6           1.147    0.057   20.163    0.000    1.147    1.147
    oce2|t1          -1.088    0.055  -19.620    0.000   -1.088   -1.088
    oce2|t2          -0.271    0.045   -6.015    0.000   -0.271   -0.271
    oce2|t3          -0.038    0.044   -0.850    0.395   -0.038   -0.038
    oce2|t4           0.506    0.047   10.857    0.000    0.506    0.506
    oce2|t5           0.781    0.050   15.703    0.000    0.781    0.781
    oce2|t6           1.596    0.073   21.989    0.000    1.596    1.596
    oce3|t1          -1.007    0.054  -18.751    0.000   -1.007   -1.007
    oce3|t2          -0.330    0.045   -7.284    0.000   -0.330   -0.330
    oce3|t3          -0.177    0.045   -3.965    0.000   -0.177   -0.177
    oce3|t4           0.516    0.047   11.066    0.000    0.516    0.516
    oce3|t5           0.870    0.051   17.009    0.000    0.870    0.870
    oce3|t6           1.778    0.082   21.613    0.000    1.778    1.778
    oce4|t1          -1.542    0.070  -21.982    0.000   -1.542   -1.542
    oce4|t2          -0.727    0.049  -14.835    0.000   -0.727   -0.727
    oce4|t3          -0.460    0.046   -9.950    0.000   -0.460   -0.460
    oce4|t4           0.054    0.044    1.204    0.228    0.054    0.054
    oce4|t5           0.404    0.046    8.830    0.000    0.404    0.404
    oce4|t6           1.293    0.061   21.205    0.000    1.293    1.293
    oia1|t1          -1.826    0.085  -21.419    0.000   -1.826   -1.826
    oia1|t2          -1.437    0.066  -21.807    0.000   -1.437   -1.437
    oia1|t3          -1.083    0.055  -19.564    0.000   -1.083   -1.083
    oia1|t4          -0.499    0.047  -10.718    0.000   -0.499   -0.499
    oia1|t5          -0.187    0.045   -4.177    0.000   -0.187   -0.187
    oia1|t6           1.123    0.056   19.950    0.000    1.123    1.123
    oia2|t1          -2.202    0.117  -18.771    0.000   -2.202   -2.202
    oia2|t2          -1.879    0.089  -21.164    0.000   -1.879   -1.879
    oia2|t3          -1.512    0.069  -21.954    0.000   -1.512   -1.512
    oia2|t4          -0.773    0.050  -15.570    0.000   -0.773   -0.773
    oia2|t5          -0.635    0.048  -13.275    0.000   -0.635   -0.635
    oia2|t6           0.381    0.046    8.339    0.000    0.381    0.381
    oia3|t1          -2.078    0.105  -19.836    0.000   -2.078   -2.078
    oia3|t2          -1.619    0.074  -21.975    0.000   -1.619   -1.619
    oia3|t3          -1.330    0.062  -21.401    0.000   -1.330   -1.330
    oia3|t4          -0.702    0.049  -14.431    0.000   -0.702   -0.702
    oia3|t5          -0.579    0.047  -12.243    0.000   -0.579   -0.579
    oia3|t6           0.330    0.045    7.284    0.000    0.330    0.330
    oia4|t1          -1.958    0.095  -20.701    0.000   -1.958   -1.958
    oia4|t2          -1.563    0.071  -21.992    0.000   -1.563   -1.563
    oia4|t3          -1.279    0.061  -21.121    0.000   -1.279   -1.279
    oia4|t4          -0.307    0.045   -6.790    0.000   -0.307   -0.307
    oia4|t5          -0.022    0.044   -0.496    0.620   -0.022   -0.022
    oia4|t6           1.279    0.061   21.121    0.000    1.279    1.279
    wit1|t1          -2.052    0.102  -20.043    0.000   -2.052   -2.052
    wit1|t2          -1.720    0.079  -21.797    0.000   -1.720   -1.720
    wit1|t3          -1.483    0.068  -21.910    0.000   -1.483   -1.483
    wit1|t4          -1.172    0.058  -20.370    0.000   -1.172   -1.172
    wit1|t5          -0.715    0.049  -14.634    0.000   -0.715   -0.715
    wit1|t6           0.374    0.046    8.198    0.000    0.374    0.374
    wit2|t1          -2.168    0.114  -19.081    0.000   -2.168   -2.168
    wit2|t2          -1.596    0.073  -21.989    0.000   -1.596   -1.596
    wit2|t3          -1.308    0.061  -21.286    0.000   -1.308   -1.308
    wit2|t4          -0.936    0.052  -17.896    0.000   -0.936   -0.936
    wit2|t5          -0.418    0.046   -9.110    0.000   -0.418   -0.418
    wit2|t6           0.506    0.047   10.857    0.000    0.506    0.506
    wit3|t1          -2.106    0.107  -19.609    0.000   -2.106   -2.106
    wit3|t2          -1.521    0.069  -21.965    0.000   -1.521   -1.521
    wit3|t3          -1.129    0.056  -20.003    0.000   -1.129   -1.129
    wit3|t4          -0.743    0.049  -15.104    0.000   -0.743   -0.743
    wit3|t5          -0.456    0.046   -9.880    0.000   -0.456   -0.456
    wit3|t6           0.582    0.047   12.312    0.000    0.582    0.582
    wit4|t1          -2.136    0.110  -19.359    0.000   -2.136   -2.136
    wit4|t2          -1.428    0.066  -21.782    0.000   -1.428   -1.428
    wit4|t3          -1.044    0.054  -19.163    0.000   -1.044   -1.044
    wit4|t4          -0.735    0.049  -14.970    0.000   -0.735   -0.735
    wit4|t5          -0.470    0.046  -10.160    0.000   -0.470   -0.470
    wit4|t6           0.575    0.047   12.174    0.000    0.575    0.575
    wce1|t1          -2.136    0.110  -19.359    0.000   -2.136   -2.136
    wce1|t2          -1.763    0.081  -21.666    0.000   -1.763   -1.763
    wce1|t3          -1.642    0.075  -21.950    0.000   -1.642   -1.642
    wce1|t4          -1.129    0.056  -20.003    0.000   -1.129   -1.129
    wce1|t5          -0.794    0.050  -15.902    0.000   -0.794   -0.794
    wce1|t6           0.442    0.046    9.601    0.000    0.442    0.442
    wce2|t1          -1.512    0.069  -21.954    0.000   -1.512   -1.512
    wce2|t2          -0.764    0.050  -15.438    0.000   -0.764   -0.764
    wce2|t3          -0.553    0.047  -11.759    0.000   -0.553   -0.553
    wce2|t4          -0.235    0.045   -5.238    0.000   -0.235   -0.235
    wce2|t5           0.057    0.044    1.275    0.202    0.057    0.057
    wce2|t6           0.922    0.052   17.708    0.000    0.922    0.922
    wce3|t1          -1.861    0.088  -21.256    0.000   -1.861   -1.861
    wce3|t2          -1.237    0.059  -20.856    0.000   -1.237   -1.237
    wce3|t3          -1.012    0.054  -18.811    0.000   -1.012   -1.012
    wce3|t4          -0.524    0.047  -11.205    0.000   -0.524   -0.524
    wce3|t5          -0.155    0.045   -3.470    0.001   -0.155   -0.155
    wce3|t6           0.865    0.051   16.945    0.000    0.865    0.865
    wce4|t1          -2.136    0.110  -19.359    0.000   -2.136   -2.136
    wce4|t2          -1.437    0.066  -21.807    0.000   -1.437   -1.437
    wce4|t3          -1.135    0.057  -20.057    0.000   -1.135   -1.135
    wce4|t4          -0.702    0.049  -14.431    0.000   -0.702   -0.702
    wce4|t5          -0.324    0.045   -7.143    0.000   -0.324   -0.324
    wce4|t6           0.723    0.049   14.768    0.000    0.723    0.723
    wia1|t1          -2.202    0.117  -18.771    0.000   -2.202   -2.202
    wia1|t2          -1.897    0.090  -21.063    0.000   -1.897   -1.897
    wia1|t3          -1.607    0.073  -21.983    0.000   -1.607   -1.607
    wia1|t4          -1.265    0.060  -21.035    0.000   -1.265   -1.265
    wia1|t5          -0.971    0.053  -18.328    0.000   -0.971   -0.971
    wia1|t6           0.206    0.045    4.602    0.000    0.206    0.206
    wia2|t1          -2.324    0.132  -17.589    0.000   -2.324   -2.324
    wia2|t2          -1.917    0.091  -20.953    0.000   -1.917   -1.917
    wia2|t3          -1.607    0.073  -21.983    0.000   -1.607   -1.607
    wia2|t4          -1.251    0.060  -20.947    0.000   -1.251   -1.251
    wia2|t5          -1.049    0.055  -19.221    0.000   -1.049   -1.049
    wia2|t6          -0.041    0.044   -0.921    0.357   -0.041   -0.041
    wia3|t1          -1.958    0.095  -20.701    0.000   -1.958   -1.958
    wia3|t2          -1.483    0.068  -21.910    0.000   -1.483   -1.483
    wia3|t3          -1.338    0.062  -21.438    0.000   -1.338   -1.338
    wia3|t4          -1.088    0.055  -19.620    0.000   -1.088   -1.088
    wia3|t5          -0.946    0.052  -18.020    0.000   -0.946   -0.946
    wia3|t6          -0.044    0.044   -0.992    0.321   -0.044   -0.044
    wia4|t1          -2.136    0.110  -19.359    0.000   -2.136   -2.136
    wia4|t2          -1.861    0.088  -21.256    0.000   -1.861   -1.861
    wia4|t3          -1.542    0.070  -21.982    0.000   -1.542   -1.542
    wia4|t4          -1.172    0.058  -20.370    0.000   -1.172   -1.172
    wia4|t5          -0.852    0.051  -16.751    0.000   -0.852   -0.852
    wia4|t6           0.391    0.046    8.549    0.000    0.391    0.391
    pit1|t1          -2.078    0.105  -19.836    0.000   -2.078   -2.078
    pit1|t2          -1.667    0.076  -21.913    0.000   -1.667   -1.667
    pit1|t3          -1.428    0.066  -21.782    0.000   -1.428   -1.428
    pit1|t4          -1.028    0.054  -18.988    0.000   -1.028   -1.028
    pit1|t5          -0.624    0.048  -13.069    0.000   -0.624   -0.624
    pit1|t6           0.531    0.047   11.343    0.000    0.531    0.531
    pit2|t1          -1.897    0.090  -21.063    0.000   -1.897   -1.897
    pit2|t2          -1.369    0.063  -21.577    0.000   -1.369   -1.369
    pit2|t3          -1.197    0.058  -20.570    0.000   -1.197   -1.197
    pit2|t4          -0.682    0.048  -14.092    0.000   -0.682   -0.682
    pit2|t5          -0.047    0.044   -1.063    0.288   -0.047   -0.047
    pit2|t6           1.066    0.055   19.394    0.000    1.066    1.066
    pit3|t1          -1.937    0.093  -20.832    0.000   -1.937   -1.937
    pit3|t2          -1.386    0.064  -21.641    0.000   -1.386   -1.386
    pit3|t3          -0.966    0.053  -18.267    0.000   -0.966   -0.966
    pit3|t4          -0.432    0.046   -9.391    0.000   -0.432   -0.432
    pit3|t5          -0.098    0.045   -2.196    0.028   -0.098   -0.098
    pit3|t6           0.931    0.052   17.834    0.000    0.931    0.931
    pit4|t1          -1.879    0.089  -21.164    0.000   -1.879   -1.879
    pit4|t2          -1.230    0.059  -20.809    0.000   -1.230   -1.230
    pit4|t3          -0.888    0.051  -17.265    0.000   -0.888   -0.888
    pit4|t4          -0.453    0.046   -9.810    0.000   -0.453   -0.453
    pit4|t5          -0.091    0.045   -2.054    0.040   -0.091   -0.091
    pit4|t6           0.946    0.052   18.020    0.000    0.946    0.946
    pce1|t1          -2.106    0.107  -19.609    0.000   -2.106   -2.106
    pce1|t2          -1.619    0.074  -21.975    0.000   -1.619   -1.619
    pce1|t3          -1.446    0.066  -21.830    0.000   -1.446   -1.446
    pce1|t4          -0.941    0.052  -17.958    0.000   -0.941   -0.941
    pce1|t5          -0.535    0.047  -11.413    0.000   -0.535   -0.535
    pce1|t6           0.527    0.047   11.274    0.000    0.527    0.527
    pce2|t1          -1.596    0.073  -21.989    0.000   -1.596   -1.596
    pce2|t2          -0.879    0.051  -17.138    0.000   -0.879   -0.879
    pce2|t3          -0.686    0.048  -14.160    0.000   -0.686   -0.686
    pce2|t4          -0.360    0.046   -7.917    0.000   -0.360   -0.360
    pce2|t5          -0.091    0.045   -2.054    0.040   -0.091   -0.091
    pce2|t6           0.781    0.050   15.703    0.000    0.781    0.781
    pce3|t1          -1.861    0.088  -21.256    0.000   -1.861   -1.861
    pce3|t2          -1.437    0.066  -21.807    0.000   -1.437   -1.437
    pce3|t3          -1.265    0.060  -21.035    0.000   -1.265   -1.265
    pce3|t4          -0.731    0.049  -14.903    0.000   -0.731   -0.731
    pce3|t5          -0.404    0.046   -8.830    0.000   -0.404   -0.404
    pce3|t6           0.586    0.047   12.381    0.000    0.586    0.586
    pce4|t1          -2.280    0.126  -18.034    0.000   -2.280   -2.280
    pce4|t2          -1.437    0.066  -21.807    0.000   -1.437   -1.437
    pce4|t3          -1.217    0.059  -20.715    0.000   -1.217   -1.217
    pce4|t4          -0.702    0.049  -14.431    0.000   -0.702   -0.702
    pce4|t5          -0.324    0.045   -7.143    0.000   -0.324   -0.324
    pce4|t6           0.647    0.048   13.480    0.000    0.647    0.647
    pia1|t1          -2.496    0.158  -15.773    0.000   -2.496   -2.496
    pia1|t2          -2.136    0.110  -19.359    0.000   -2.136   -2.136
    pia1|t3          -1.879    0.089  -21.164    0.000   -1.879   -1.879
    pia1|t4          -1.437    0.066  -21.807    0.000   -1.437   -1.437
    pia1|t5          -1.049    0.055  -19.221    0.000   -1.049   -1.049
    pia1|t6           0.107    0.045    2.408    0.016    0.107    0.107
    pia2|t1          -2.496    0.158  -15.773    0.000   -2.496   -2.496
    pia2|t2          -2.052    0.102  -20.043    0.000   -2.052   -2.052
    pia2|t3          -1.720    0.079  -21.797    0.000   -1.720   -1.720
    pia2|t4          -1.394    0.064  -21.671    0.000   -1.394   -1.394
    pia2|t5          -1.129    0.056  -20.003    0.000   -1.129   -1.129
    pia2|t6          -0.117    0.045   -2.621    0.009   -0.117   -0.117
    pia3|t1          -2.003    0.098  -20.401    0.000   -2.003   -2.003
    pia3|t2          -1.693    0.077  -21.862    0.000   -1.693   -1.693
    pia3|t3          -1.542    0.070  -21.982    0.000   -1.542   -1.542
    pia3|t4          -1.224    0.059  -20.762    0.000   -1.224   -1.224
    pia3|t5          -1.044    0.054  -19.163    0.000   -1.044   -1.044
    pia3|t6          -0.180    0.045   -4.036    0.000   -0.180   -0.180
    pia4|t1          -2.239    0.122  -18.425    0.000   -2.239   -2.239
    pia4|t2          -2.078    0.105  -19.836    0.000   -2.078   -2.078
    pia4|t3          -1.843    0.086  -21.341    0.000   -1.843   -1.843
    pia4|t4          -1.369    0.063  -21.577    0.000   -1.369   -1.369
    pia4|t5          -1.012    0.054  -18.811    0.000   -1.012   -1.012
    pia4|t6           0.248    0.045    5.520    0.000    0.248    0.248

Variances:
    cit1              0.361                               0.361    0.361
    cit4              0.335                               0.335    0.335
    cce1              0.166                               0.166    0.166
    cce4              0.247                               0.247    0.247
    cia2              0.300                               0.300    0.300
    cia3              0.223                               0.223    0.223
    oit1              0.443                               0.443    0.443
    oit2              0.230                               0.230    0.230
    oit3              0.585                               0.585    0.585
    oit4              0.348                               0.348    0.348
    oce1              0.402                               0.402    0.402
    oce2              0.554                               0.554    0.554
    oce3              0.315                               0.315    0.315
    oce4              0.442                               0.442    0.442
    oia1              0.237                               0.237    0.237
    oia2              0.238                               0.238    0.238
    oia3              0.284                               0.284    0.284
    oia4              0.194                               0.194    0.194
    wit1              0.525                               0.525    0.525
    wit2              0.399                               0.399    0.399
    wit3              0.409                               0.409    0.409
    wit4              0.259                               0.259    0.259
    wce1              0.601                               0.601    0.601
    wce2              0.494                               0.494    0.494
    wce3              0.531                               0.531    0.531
    wce4              0.440                               0.440    0.440
    wia1              0.221                               0.221    0.221
    wia2              0.224                               0.224    0.224
    wia3              0.234                               0.234    0.234
    wia4              0.227                               0.227    0.227
    pit1              0.494                               0.494    0.494
    pit2              0.417                               0.417    0.417
    pit3              0.483                               0.483    0.483
    pit4              0.255                               0.255    0.255
    pce1              0.632                               0.632    0.632
    pce2              0.422                               0.422    0.422
    pce3              0.565                               0.565    0.565
    pce4              0.388                               0.388    0.388
    pia1              0.296                               0.296    0.296
    pia2              0.275                               0.275    0.275
    pia3              0.288                               0.288    0.288
    pia4              0.306                               0.306    0.306
    cit               0.144    0.029                      0.226    0.226
    cce               0.338    0.037                      0.406    0.406
    cia               0.296    0.030                      0.423    0.423
    oit               0.362    0.024                      0.651    0.651
    oce               0.277    0.025                      0.463    0.463
    oia               0.203    0.032                      0.266    0.266
    wit               0.281    0.022                      0.591    0.591
    wce               0.047    0.012                      0.119    0.119
    wia               0.285    0.022                      0.366    0.366
    pit               0.369    0.029                      0.730    0.730
    pce               0.121    0.013                      0.330    0.330
    pia               0.277    0.018                      0.394    0.394
    cid               0.328    0.034                      0.663    0.663
    oid               0.120    0.015                      0.619    0.619
    wid              -0.051    0.012                     -0.263   -0.263
    pid               0.137    0.018                      1.000    1.000

Warning message:
In sqrt(est[rv.idx]) : NaNs produced
> 

Cheers,
Seongho Bae.

2014년 8월 11일 월요일 오후 10시 26분 46초 UTC+9, MikkelGH 님의 말:
Dear lavaan-users,
test.txt

MikkelGH

unread,
Aug 11, 2014, 2:51:11 PM8/11/14
to lav...@googlegroups.com
Hello Seongho Bae,

Thank you for your input (and the output from the analysis).
May I ask what hardware you have yourself?

I have tried my work laptop (I5-2540 2.6 ghz) and my home pc (AMD phenom X4 965, 3.4 ghz) - pretty similar cpu performance. My operating system is Windows 7 64 bit.


Best regards,
Mikkel

Seongho Bae

unread,
Aug 11, 2014, 2:55:24 PM8/11/14
to lav...@googlegroups.com
Mikkel,

I have tried to execute your syntax on my laptop; i7-2670QM, 12GB RAM, Windows 7 64bit.

And I am using the Intel Math Kernel Library via Revolution R 3.0.3. Intel MKL is a type of BLAS library.

Cheers,
Seongho Bae.

2014년 8월 12일 화요일 오전 3시 51분 11초 UTC+9, MikkelGH 님의 말:

MikkelGH

unread,
Aug 12, 2014, 1:58:22 PM8/12/14
to lav...@googlegroups.com
As an update: It seems to be the WLSMV estimator which my pc for one reason or another just cannot cope with. Using MLM instead (and turning a blind eye to my variables originally being ordinal 7- point likert variables) seems to work quite alright.


Best regards,
Mikkel

Sunthud Pornprasertmanit

unread,
Aug 13, 2014, 9:39:19 AM8/13/14
to lav...@googlegroups.com
This is the issue that Yves brought up last week. Windows has a problem in running some models with categorical indicators. You need to download the development version of lavaan to fix it.


--

MikkelGH

unread,
Aug 15, 2014, 6:59:40 AM8/15/14
to lav...@googlegroups.com
Hi Sunthud,

I tried downloading the latest dev version (as of yesterday) and my computation times are still infinitely long (my patience runs out before the computer). But perhaps I am just specifying a model which really is very computationally wicked (5 multiply imputed datasets, n = 796):


cid.sem.3<-'
    citA =~ cit1 + cit4
    cceA =~ cce1 + cce4
    ciaA =~ cia2 + cia3
    oitA =~ oit1 + oit2 + oit3 + oit4
    oceA =~ oce1 + oce2 + oce3 + oce4
    oiaA =~ oia1 + oia2 + oia3 + oia4
    witA =~ wit1 + wit2 + wit3 + wit4
    wceA =~ wce1 + wce2 + wce3 + wce4
    wiaA =~ wia1 + wia2 + wia3 + wia4
    pitA =~ pit1 + pit2 + pit3 + pit4
    pceA =~ pce1 + pce2 + pce3 + pce4
    piaA =~ pia1 + pia2 + pia3 + pia4

    cidA =~ 1*citA + cceA + ciaA
    oidA =~ 1*oitA + oceA + oiaA
    widA =~ 1*witA + wceA + wiaA
    pidA =~ 1*pitA + pceA + piaA
    oceiA =~ ocei1 + ocei2 + ocei3 + ocei4
    oisA =~ ois1 + ois2 + ois3 + ois4
    oincA =~ oinc3 + oinc4 + oinc5 + oinc6
    wceiA =~ wcei1 + wcei2 + wcei3 + wcei4
    wisA =~ wis1 + wis2 + wis3 + wis4
    wincA =~ winc3 + winc4 + winc5 + winc6
   
    cidA ~ oidA + pidA + wincA + oisA
    oidA ~ oisA + oceiA + widA + pidA + wisA
    widA ~ wisA + wceiA + wincA + pidA + oisA
'

system.time(test.sem3 <- runMI(cid.sem.3, data = mice.imp, fun = "sem", estimator = "WLSMV"))


Best regards,
Mikkel

yrosseel

unread,
Aug 18, 2014, 1:26:02 PM8/18/14
to lav...@googlegroups.com
On 08/11/2014 03:26 PM, MikkelGH wrote:
> Dear lavaan-users,
>
> I am experiencing very long computation times. Running 'sem' is really
> slow with my model and (probably out of ignorance) I am unable to figure
> out why. Perhaps I have to many parameters?

user system elapsed
463.003 0.700 463.782

On my (fairly slow) linux machine, it took almost 8 minutes to finish a
single run. Which is not super fast, but in the meantime, I could set a
fresh pot of Earl Grey tea.

This model has 311 free parameters. And the W matrix has dimension [1113
x 1113].

But lavaan is (currently) not build for speed. It is build for accuracy.
It is written in 100% R, and until we include compiled code, you will
need to be patient.

Use the verbose=TRUE flag to see what happens while you wait.

Yves.

yrosseel

unread,
Aug 18, 2014, 1:28:20 PM8/18/14
to lav...@googlegroups.com
On 08/11/2014 04:18 PM, Edward Rigdon wrote:
> Mikkel—
>
> You are specifying a second order factor model. The sem function
> automatically scales the first level factors by fixing the first loading
> to 1, but I do not believe the sem function automatically scales the
> second order factors (cid, oid, wid, pid).

The sem() function treats second order factors just like first-order
factors, and therefore, sem() automatically scales the second order
factors too.

Yves.

yrosseel

unread,
Aug 18, 2014, 1:35:47 PM8/18/14
to lav...@googlegroups.com
On 08/13/2014 03:39 PM, Sunthud Pornprasertmanit wrote:
> This is the issue that Yves brought up last week. Windows has a problem
> in running some models with categorical indicators. You need to download
> the development version of lavaan to fix it.

No no, that is a misunderstanding. If you are referring to this post:

https://groups.google.com/forum/#!topic/lavaan/jPrMzgvLPx0

this is only when lavaan 'crashes' (stops) the R session. This will only
occur if you repeat a categorical analysis a large (say, 10000) number
of times. Typically in a simulation study. Windows only. But fixed.

Yves.

Edward Rigdon

unread,
Aug 18, 2014, 2:31:18 PM8/18/14
to lav...@googlegroups.com
Thank you!
Reply all
Reply to author
Forward
0 new messages