[R] sem package fails when no of factors increase from 3 to 4

John Fox jfox at mcmaster.ca
Tue Dec 23 01:32:00 CET 2008


Dear Xiaoxu LI,

sem.mod(mod4, cor18, 500, debug=TRUE) will show you what went wrong with the
optimization. Since the three-factor solutions look reasonable, I tried
using them to get better start values for the parameters in the four-factor
model, producing the solution shown below.

As well, I noticed that your correlation matrix was given only to two
decimal places, and that some of the correlations have only one significant
digit. It's possible, though not necessarily the case, that using a more
precise correlation matrix would produce the solution more easily.

I hope this helps,
 John

--------------- snip ----------------

> mod4 <- specify.model()
1: X1  <-> X1, TD11, 0.30397
2: X2  <-> X2, TD22, 0.33656
3: X3  <-> X3, TD33, 0.48680
4: X4  <-> X4, TD44, 0.62441
5: X5  <-> X5, TD55, 0.78681
6: X6  <-> X6, TD66, 0.68547
7: X7  <-> X7, TD77, 0.79154
8: X8  <-> X8, TD88, 0.67417
9: X9  <-> X9, TD99, 0.60875
10: X10 <-> X10, TDaa, 0.37764
11: X11 <-> X11, TDbb, 0.74658
12: X12 <-> X12, TDcc, 0.85765
13: X1  <- xi1, LY11, 0.83428
14: X2  <- xi1, LY21, 0.81452
15: X3  <- xi1, LY31, 0.71638
16: X4  <- xi2, LY42, 0.61285
17: X5  <- xi2, LY52, 0.46173
18: X6  <- xi2, LY62, 0.56084
19: X7  <- xi3, LY73, 0.45658 
20: X8  <- xi3, LY83, 0.57082
21: X9  <- xi3, LY93, 0.62550
22: X10 <- xi4, LXa4, 0.78890
23: X11 <- xi4, LXb4, 0.50340
24: X12 <- xi4, LXc4, 0.37729
25: xi1  <-> xi1, NA, 1
26: xi2  <-> xi2, NA, 1
27: xi3  <-> xi3, NA, 1
28: xi4  <-> xi4, NA, 1
29: xi1  <-> xi2, PH12, 0.13185
30: xi1  <-> xi3, PH13, 0.17445
31: xi2  <-> xi3, PH23, 0.25125
32: xi4  <-> xi1, PH41, 0.35819
33: xi4  <-> xi2, PH42, 0.12253
34: xi4  <-> xi3, PH43, 0.22137
35: 
Read 34 records

> summary(sem(mod4, cor18, 500))

 Model Chisquare =  80.675   Df =  48 Pr(>Chisq) = 0.0021920
 Chisquare (null model) =  1106.4   Df =  66
 Goodness-of-fit index =  0.9747
 Adjusted goodness-of-fit index =  0.95888
 RMSEA index =  0.036935   90% CI: (0.022163, 0.050657)
 Bentler-Bonnett NFI =  0.92708
 Tucker-Lewis NNFI =  0.95682
 Bentler CFI =  0.9686
 SRMR =  0.032512
 BIC =  -217.63 

 Normalized Residuals
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
-1.71000 -0.23300 -0.00337  0.08850  0.26700  2.13000 

 Parameter Estimates
     Estimate Std Error z value Pr(>|z|)               
TD11 0.30641  0.037053   8.2694 2.2204e-16 X1 <--> X1  
TD22 0.33226  0.037158   8.9419 0.0000e+00 X2 <--> X2  
TD33 0.48899  0.039007  12.5358 0.0000e+00 X3 <--> X3  
TD44 0.62205  0.076640   8.1165 4.4409e-16 X4 <--> X4  
TD55 0.78652  0.063364  12.4126 0.0000e+00 X5 <--> X5  
TD66 0.68780  0.070102   9.8114 0.0000e+00 X6 <--> X6  
TD77 0.79474  0.062019  12.8144 0.0000e+00 X7 <--> X7  
TD88 0.67378  0.069039   9.7595 0.0000e+00 X8 <--> X8  
TD99 0.60536  0.075437   8.0247 1.1102e-15 X9 <--> X9  
TDaa 0.39902  0.094378   4.2279 2.3590e-05 X10 <--> X10
TDbb 0.74223  0.060911  12.1854 0.0000e+00 X11 <--> X11
TDcc 0.84956  0.060891  13.9523 0.0000e+00 X12 <--> X12
LY11 0.83282  0.040846  20.3895 0.0000e+00 X1 <--- xi1 
LY21 0.81715  0.041065  19.8990 0.0000e+00 X2 <--- xi1 
LY31 0.71485  0.042041  17.0036 0.0000e+00 X3 <--- xi1 
LY42 0.61478  0.066956   9.1818 0.0000e+00 X4 <--- xi2 
LY52 0.46204  0.059887   7.7152 1.1990e-14 X5 <--- xi2 
LY62 0.55875  0.064082   8.7192 0.0000e+00 X6 <--- xi2 
LY73 0.45306  0.058293   7.7721 7.7716e-15 X7 <--- xi3 
LY83 0.57116  0.062721   9.1064 0.0000e+00 X8 <--- xi3 
LY93 0.62821  0.065434   9.6007 0.0000e+00 X9 <--- xi3 
LXa4 0.77523  0.069569  11.1434 0.0000e+00 X10 <--- xi4
LXb4 0.50771  0.056580   8.9733 0.0000e+00 X11 <--- xi4
LXc4 0.38786  0.056614   6.8510 7.3350e-12 X12 <--- xi4
PH12 0.13207  0.064099   2.0604 3.9361e-02 xi2 <--> xi1
PH13 0.17417  0.063512   2.7423 6.1006e-03 xi3 <--> xi1
PH23 0.25059  0.077099   3.2503 1.1529e-03 xi3 <--> xi2
PH41 0.36109  0.055310   6.5285 6.6416e-11 xi1 <--> xi4
PH42 0.12606  0.072905   1.7292 8.3780e-02 xi2 <--> xi4
PH43 0.22301  0.071781   3.1068 1.8913e-03 xi3 <--> xi4

 Iterations =  14 
Warning message:
In sem.mod(mod4, cor18, 500) :
  The following observed variables are in the input covariance or raw-moment
matrix but do not appear in the model:
X13, X14, X15, X16, X17, X18

>

------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
> Behalf Of Xiaoxu LI
> Sent: December-22-08 3:58 PM
> To: r-help at r-project.org
> Subject: [R] sem package fails when no of factors increase from 3 to 4
> 
> #### I checked through every 3 factor * 3 loading case.
> #### While, 4 factor * 3 loading failed.
> #### the data is 6 factor * 3 loading
> 
> require(sem);
> 
> cor18<-read.moments();
> 1
> .68 1
> .60 .58 1
> .01 .10 .07 1
> .12 .04 .06 .29 1
> .06 .06 .01 .35 .24 1
> .09 .13 .10 .05 .03 .07 1
> .04 .08 .16 .10 .12 .06 .25 1
> .06 .09 .02 .02 .09 .16 .29 .36 1
> .23 .26 .19 .05 .04 .04 .08 .09 .09 1
> .11 .13 .12 .03 .05 .03 .02 .06 .06 .40 1
> .16 .09 .09 .10 .10 .02 .04 .12 .15 .29 .20 1
> .24 .26 .22 .14 .06 .10 .06 .07 .08 .03 .04 .02 1
> .21 .22 .29 .07 .05 .17 .12 .06 .06 .03 .12 .04 .55 1
> .29 .28 .26 .06 .07 .05 .06 .15 .20 .10 .03 .12 .64 .61 1
> .15 .16 .19 .18 .08 .07 .08 .10 .06 .15 .16 .07 .25 .25 .16 1
> .24 .20 .16 .13 .15 .18 .19 .18 .14 .11 .07 .16 .19 .21 .22 .35 1
> .14 .25 .12 .09 .11 .09 .09 .11 .21 .17 .09 .05 .21 .23 .18 .39 .48 1
> 
> mod3.1_9<-specify.model();
> X1  <-> X1,TD11,NA
> X2  <-> X2,TD22,NA
> X3  <-> X3,TD33,NA
> X4  <-> X4,TD44,NA
> X5  <-> X5,TD55,NA
> X6  <-> X6,TD66,NA
> X7  <-> X7,TD77,NA
> X8  <-> X8,TD88,NA
> X9  <-> X9,TD99,NA
> X1  <- xi1,LY11, NA
> X2  <- xi1,LY21, NA
> X3  <- xi1,LY31, NA
> X4  <- xi2,LY42, NA
> X5  <- xi2,LY52, NA
> X6  <- xi2,LY62, NA
> X7  <- xi3,LY73, NA
> X8  <- xi3,LY83, NA
> X9  <- xi3,LY93, NA
> xi1  <-> xi1,NA,1
> xi2  <-> xi2,NA,1
> xi3  <-> xi3,NA,1
> xi1  <-> xi2 ,PH12,NA
> xi1  <-> xi3 ,PH13,NA
> xi2  <-> xi3 ,PH23,NA
> 
> mod3.1_6AND10_12<-specify.model();
> X1  <-> X1,TD11,NA
> X2  <-> X2,TD22,NA
> X3  <-> X3,TD33,NA
> X4  <-> X4,TD44,NA
> X5  <-> X5,TD55,NA
> X6  <-> X6,TD66,NA
> X10  <-> X10,TD77,NA
> X11  <-> X11,TD88,NA
> X12  <-> X12,TD99,NA
> X1  <- xi1,LY11, NA
> X2  <- xi1,LY21, NA
> X3  <- xi1,LY31, NA
> X4  <- xi2,LY42, NA
> X5  <- xi2,LY52, NA
> X6  <- xi2,LY62, NA
> X10  <- xi3,LY73, NA
> X11  <- xi3,LY83, NA
> X12  <- xi3,LY93, NA
> xi1  <-> xi1,NA,1
> xi2  <-> xi2,NA,1
> xi3  <-> xi3,NA,1
> xi1  <-> xi2 ,PH12,NA
> xi1  <-> xi3 ,PH13,NA
> xi2  <-> xi3 ,PH23,NA
> 
> mod3.1_3AND7_9AND10_12<-specify.model();
> X1  <-> X1,TD11,NA
> X2  <-> X2,TD22,NA
> X3  <-> X3,TD33,NA
> X10  <-> X10,TD44,NA
> X11  <-> X11,TD55,NA
> X12  <-> X12,TD66,NA
> X7  <-> X7,TD77,NA
> X8  <-> X8,TD88,NA
> X9  <-> X9,TD99,NA
> X1  <- xi1,LY11, NA
> X2  <- xi1,LY21, NA
> X3  <- xi1,LY31, NA
> X10  <- xi2,LY42, NA
> X11  <- xi2,LY52, NA
> X12  <- xi2,LY62, NA
> X7  <- xi3,LY73, NA
> X8  <- xi3,LY83, NA
> X9  <- xi3,LY93, NA
> xi1  <-> xi1,NA,1
> xi2  <-> xi2,NA,1
> xi3  <-> xi3,NA,1
> xi1  <-> xi2 ,PH12,NA
> xi1  <-> xi3 ,PH13,NA
> xi2  <-> xi3 ,PH23,NA
> 
> mod3.4_6AND7_9AND10_12<-specify.model();
> X10  <-> X10,TD11,NA
> X11  <-> X11,TD22,NA
> X12  <-> X12,TD33,NA
> X4  <-> X4,TD44,NA
> X5  <-> X5,TD55,NA
> X6  <-> X6,TD66,NA
> X7  <-> X7,TD77,NA
> X8  <-> X8,TD88,NA
> X9  <-> X9,TD99,NA
> X10  <- xi1,LY11, NA
> X11  <- xi1,LY21, NA
> X12  <- xi1,LY31, NA
> X4  <- xi2,LY42, NA
> X5  <- xi2,LY52, NA
> X6  <- xi2,LY62, NA
> X7  <- xi3,LY73, NA
> X8  <- xi3,LY83, NA
> X9  <- xi3,LY93, NA
> xi1  <-> xi1,NA,1
> xi2  <-> xi2,NA,1
> xi3  <-> xi3,NA,1
> xi1  <-> xi2 ,PH12,NA
> xi1  <-> xi3 ,PH13,NA
> xi2  <-> xi3 ,PH23,NA
> 
> mod4<-specify.model();
> X1  <-> X1,TD11,NA
> X2  <-> X2,TD22,NA
> X3  <-> X3,TD33,NA
> X4  <-> X4,TD44,NA
> X5  <-> X5,TD55,NA
> X6  <-> X6,TD66,NA
> X7  <-> X7,TD77,NA
> X8  <-> X8,TD88,NA
> X9  <-> X9,TD99,NA
> X10 <-> X10,TDaa,NA
> X11 <-> X11,TDbb,NA
> X12 <-> X12,TDcc,NA
> X1  <- xi1,LY11, NA
> X2  <- xi1,LY21, NA
> X3  <- xi1,LY31, NA
> X4  <- xi2,LY42, NA
> X5  <- xi2,LY52, NA
> X6  <- xi2,LY62, NA
> X7  <- xi3,LY73, NA
> X8  <- xi3,LY83, NA
> X9  <- xi3,LY93, NA
> X10 <- xi4,LXa4,NA
> X11 <- xi4,LXb4,NA
> X12 <- xi4,LXc4,NA
> xi1  <-> xi1,NA,1
> xi2  <-> xi2,NA,1
> xi3  <-> xi3,NA,1
> xi4  <-> xi4,NA,1
> xi1  <-> xi2 ,PH12,NA
> xi1  <-> xi3 ,PH13,NA
> xi2  <-> xi3 ,PH23,NA
> xi4  <-> xi1,PH41,NA
> xi4  <-> xi2,PH42,NA
> xi4  <-> xi3,PH43,NA
> 
> summary(sem(mod3.1_9,cor18,500))$RMSEA;
> summary(sem(mod3.1_6AND10_12,cor18,500))$RMSEA;
> summary(sem(mod3.1_3AND7_9AND10_12,cor18,500))$RMSEA;
> summary(sem(mod3.4_6AND7_9AND10_12,cor18,500))$RMSEA;
> summary(sem(mod4,cor18,500))$RMSEA;##fail
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list