Dear Community,

I found a very similar problem to mine that also had no response from 2009 using library sem and polycor:
http://www.mail-archive.com/r-help@r-project.org/msg65158.html

I have a five-factor latent model that converges when using a covariance matrix, but fails to converge when using a correlation matrix (generated by hetcor, shown below) more appropriate for two ordinal variables present in the data, even when iterations/convergence parameters are high. I am suspicious that our specification of the structure itself may not be the proper format or something else simple. Insight appreciated!

###################################
# The error
###################################

datar.sem <-sem(model.datar,hetcormat$correlations,nrow(datar),endog.variances=TRUE)
Warning messages:
1: In eval(expr, envir, enclos) :
  Optimization may not have converged; nlm return code = 3. Consult ?nlm.

2: In eval(expr, envir, enclos) :
  Could not compute QR decomposition of Hessian.
Optimization probably did not converge.

###################################
# The model (no errors and converges when run with cov matrix)
###################################
model.datar <- specifyModel(quiet=FALSE)
1: disc1 -> vea8, lam1, NA
2: disc1 ->  vea9, lam2, NA
3: disc1 ->  vea12, lam3, NA
4: disc1 ->  vea15, lam4, NA
5: disc1 ->  vg21, lam5, NA
6: family2 ->  vf4, lam6, NA
7: family2 ->  vf6, lam7, NA
8: family2 ->  vf7, lam8, NA
9: family2 ->  vg1, lam9, NA
10: family2 ->  vg3, lam10, NA
11: family2 ->  vg20, lam11, NA
12: trauma3 ->  vm5, lam12, NA
13: trauma3 ->  vm11, lam13, NA
14: trauma3 ->  vm12, lam14, NA
15: partner4 ->  vp2, lam15, NA
16: partner4 ->  vp3, lam16, NA
17: partner4 ->  vp5, lam17, NA
18: SA5 ->  ASArape, lam18, NA
19: SA5 ->  ASAattempt, lam19, NA
20: SA5 ->  csaindex_penetr_r, lam20, NA
21: SA5 ->  csa_multiperp_r, lam21, NA
22: vea8 <-> vea8, e1,NA #Declare errors for measured variables
23: vea9 <-> vea9, e2,NA
24: vea12 <-> vea12, e3,NA
25: vea15 <-> vea15, e4,NA
26: vg21 <-> vg21, e5,NA
27: vf4 <-> vf4, e6,NA
28: vf6 <-> vf6, e7,NA
29: vf7 <-> vf7, e8,NA
30: vg1 <-> vg1, e9,NA
31: vg3 <-> vg3, e10,NA
32: vg20 <-> vg20, e11,NA
33: vm5 <-> vm5, e12,NA
34: vm11 <-> vm11, e13,NA
35: vm12 <-> vm12, e14,NA
36: vp2 <-> vp2, e15,NA
37: vp3 <-> vp3, e16,NA
38: vp5 <-> vp5, e17,NA
39: ASArape <-> ASArape, e18,NA
40: ASAattempt <-> ASAattempt, e19,NA
41: csaindex_penetr_r <-> csaindex_penetr_r, e20,NA
42: csa_multiperp_r <-> csa_multiperp_r, e21,NA
43: disc1 <-> disc1, NA, 1 #Set variance of latent variables
44: family2 <-> family2, NA, 1
45: trauma3 <-> trauma3, NA, 1
46: partner4 <-> partner4, NA, 1
47: SA5 <-> SA5, NA, 1
48: disc1 <-> family2, discfam, NA #Declare covariance (oblique data structure), might want a different structure here
49: disc1 <-> trauma3, disctrauma, NA
50: disc1 <-> partner4, disctrauma, NA
51: disc1 <-> SA5, discSA, NA
52: family2 <-> trauma3, famtrauma, NA
53: family2 <-> partner4, fampartner, NA
54: family2 <-> SA5, famSA, NA
55: trauma3 <-> partner4, traumapartner, NA
56: trauma3 <-> SA5, traumaSA, NA
57: partner4 <-> SA5, partnerSA, NA
58:
Read 57 records

###################################
# The correlation matrix generation and result (no errors)
###################################
hetcormat<-hetcor(na.omit(datar))

hetcormat$correlations
                       vea8      vea9     vea12     vea15      vg21       vf4       vf6
vea8              1.0000000 0.7000571 0.7026814 0.6638705 0.6044156 0.3097471 0.3724538
vea9              0.7000571 1.0000000 0.6858387 0.8141942 0.5686021 0.2798940 0.3763371
vea12             0.7026814 0.6858387 1.0000000 0.6655896 0.5648276 0.2867356 0.3773890
vea15             0.6638705 0.8141942 0.6655896 1.0000000 0.4909964 0.2352023 0.3478206
vg21              0.6044156 0.5686021 0.5648276 0.4909964 1.0000000 0.3250902 0.3735035
vf4               0.3097471 0.2798940 0.2867356 0.2352023 0.3250902 1.0000000 0.7961166
vf6               0.3724538 0.3763371 0.3773890 0.3478206 0.3735035 0.7961166 1.0000000
vf7               0.3402325 0.3681438 0.4262703 0.3389088 0.2724225 0.6240646 0.6350580
vg1               0.2677025 0.2298212 0.2017240 0.1995370 0.4135266 0.2498750 0.2260269
vg3               0.2920259 0.3605330 0.2532029 0.2685953 0.5041363 0.1912177 0.1786645
vg20              0.3914562 0.5083814 0.3589342 0.4377193 0.5782071 0.2656870 0.3255084
vm5               0.4166989 0.4337695 0.3776427 0.4035676 0.4312523 0.2893334 0.4604361
vm11              0.4304248 0.4334342 0.4405980 0.4155532 0.4491622 0.3101210 0.3880964
vm12              0.2703011 0.3497903 0.3292539 0.3069796 0.3906219 0.2885271 0.3724086
vp2               0.1528876 0.1952139 0.1738616 0.1163224 0.2274531 0.1254981 0.2262561
vp3               0.2843861 0.2726624 0.2498801 0.1504003 0.4066202 0.2384712 0.3119717
vp5               0.3477829 0.3441100 0.3211334 0.2338733 0.4079397 0.2254231 0.3178794
ASArape           0.2702184 0.3664998 0.2265353 0.2586834 0.3444133 0.1764074 0.2768842
ASAattempt        0.3110718 0.3397801 0.2542894 0.2414628 0.4109530 0.1596444 0.2568287
csaindex_penetr_r 0.4839482 0.5062189 0.4566344 0.5397812 0.4284213 0.2716240 0.3699014
csa_multiperp_r   0.4360896 0.4913143 0.3901358 0.4660711 0.3791458 0.2664342 0.3154557
                        vf7       vg1       vg3      vg20       vm5      vm11      vm12
vea8              0.3402325 0.2677025 0.2920259 0.3914562 0.4166989 0.4304248 0.2703011
vea9              0.3681438 0.2298212 0.3605330 0.5083814 0.4337695 0.4334342 0.3497903
vea12             0.4262703 0.2017240 0.2532029 0.3589342 0.3776427 0.4405980 0.3292539
vea15             0.3389088 0.1995370 0.2685953 0.4377193 0.4035676 0.4155532 0.3069796
vg21              0.2724225 0.4135266 0.5041363 0.5782071 0.4312523 0.4491622 0.3906219
vf4               0.6240646 0.2498750 0.1912177 0.2656870 0.2893334 0.3101210 0.2885271
vf6               0.6350580 0.2260269 0.1786645 0.3255084 0.4604361 0.3880964 0.3724086
vf7               1.0000000 0.1371677 0.1317195 0.2648334 0.3519294 0.3325628 0.4567798
vg1               0.1371677 1.0000000 0.6055876 0.5130291 0.2571177 0.3096079 0.3386708
vg3               0.1317195 0.6055876 1.0000000 0.4830658 0.2478917 0.2753072 0.2799206
vg20              0.2648334 0.5130291 0.4830658 1.0000000 0.3730728 0.3884193 0.3686268
vm5               0.3519294 0.2571177 0.2478917 0.3730728 1.0000000 0.7191220 0.6541069
vm11              0.3325628 0.3096079 0.2753072 0.3884193 0.7191220 1.0000000 0.6971122
vm12              0.4567798 0.3386708 0.2799206 0.3686268 0.6541069 0.6971122 1.0000000
vp2               0.1368307 0.1346174 0.1702007 0.3282762 0.2924354 0.2829215 0.2242397
vp3               0.3339290 0.2029688 0.2576806 0.3443469 0.4160416 0.4193017 0.2935788
vp5               0.2678739 0.3147946 0.3334177 0.4455013 0.4293439 0.4052340 0.3768071
ASArape           0.2068539 0.2211836 0.2295121 0.3521800 0.2824688 0.2223662 0.1721741
ASAattempt        0.1905680 0.2143494 0.2179384 0.3348509 0.2930699 0.2221983 0.1555038
csaindex_penetr_r 0.3875458 0.2594422 0.2693362 0.4250249 0.4717450 0.3597865 0.3924506
csa_multiperp_r   0.3475012 0.2300904 0.2542451 0.4037506 0.4798677 0.2967862 0.3121680
                          vp2        vp3       vp5   ASArape ASAattempt
vea8               0.15288763 0.28438615 0.3477829 0.2702184  0.3110718
vea9               0.19521386 0.27266240 0.3441100 0.3664998  0.3397801
vea12              0.17386159 0.24988015 0.3211334 0.2265353  0.2542894
vea15              0.11632236 0.15040034 0.2338733 0.2586834  0.2414628
vg21               0.22745305 0.40662016 0.4079397 0.3444133  0.4109530
vf4                0.12549807 0.23847122 0.2254231 0.1764074  0.1596444
vf6                0.22625611 0.31197172 0.3178794 0.2768842  0.2568287
vf7                0.13683074 0.33392897 0.2678739 0.2068539  0.1905680
vg1                0.13461739 0.20296885 0.3147946 0.2211836  0.2143494
vg3                0.17020072 0.25768058 0.3334177 0.2295121  0.2179384
vg20               0.32827617 0.34434693 0.4455013 0.3521800  0.3348509
vm5                0.29243544 0.41604156 0.4293439 0.2824688  0.2930699
vm11               0.28292149 0.41930173 0.4052340 0.2223662  0.2221983
vm12               0.22423968 0.29357877 0.3768071 0.1721741  0.1555038
vp2                1.00000000 0.80301631 0.7672682 0.2073568  0.3542038
vp3                0.80301631 1.00000000 0.8294932 0.3436956  0.4018758
vp5                0.76726816 0.82949324 1.0000000 0.4079169  0.4655891
ASArape            0.20735679 0.34369559 0.4079169 1.0000000  0.9613783
ASAattempt         0.35420384 0.40187579 0.4655891 0.9613783  1.0000000
csaindex_penetr_r -0.08495393 0.04660761 0.1957917 0.3834041  0.3864311
csa_multiperp_r   -0.04464037 0.12197791 0.2375014 0.4179733  0.3902023
                  csaindex_penetr_r csa_multiperp_r
vea8                     0.48394815      0.43608960
vea9                     0.50621890      0.49131434
vea12                    0.45663445      0.39013580
vea15                    0.53978120      0.46607111
vg21                     0.42842130      0.37914576
vf4                      0.27162399      0.26643417
vf6                      0.36990142      0.31545566
vf7                      0.38754582      0.34750115
vg1                      0.25944223      0.23009044
vg3                      0.26933624      0.25424510
vg20                     0.42502485      0.40375057
vm5                      0.47174502      0.47986775
vm11                     0.35978650      0.29678616
vm12                     0.39245057      0.31216802
vp2                     -0.08495393     -0.04464037
vp3                      0.04660761      0.12197791
vp5                      0.19579165      0.23750144
ASArape                  0.38340414      0.41797333
ASAattempt               0.38643111      0.39020234
csaindex_penetr_r        1.00000000      0.91192163
csa_multiperp_r          0.91192163      1.00000000

--
****************************
Nicole Prause, PhD
Research faculty
Department of Psychiatry
760 Westwood Blvd
University of California
Los Angeles, CA 90024
nprause@mednet.ucla.edu<mailto:nprause@mednet.ucla.edu>
www.span-lab.com<http://www.span-lab.com>

________________________________

IMPORTANT WARNING: This email (and any attachments) is o...{{dropped:12}}

