[R] Confirmatory factor analysis problems using sem package (works in Amos)

S. Messing messing at stanford.edu
Fri May 22 07:25:35 CEST 2009


Hello all,

I'm trying to replicate a confirmatory factor analysis done in Amos.  The
idea is to compare a one-factor and a two-factor model.  I get the following
warning message when I run either model:

"Could not compute QR decomposition of Hessian.
Optimization probably did not converge."

I have no idea what to do here.  I believe posters reported the same
problem.  It seems that the ability to invert the correlation matrix may
have something to do with this error, but solve(correl) yields a solution.

Here are my correlation matrix and model specifications:

--------------------------- R CODE BEGIN
------------------------------------------------

correl <- matrix(
c(1.0000000,-0.6657822,0.6702089,0.7997673,-0.7225454,0.8992372,
				-0.8026491,-0.6715168,-0.5781565,-0.6657822,1.0000000,-0.5107568,
				-0.5030886,0.6971188,-0.6306937,0.7200848,0.5121227,0.4496810,
				0.6702089,-0.5107568,1.0000000,0.7276558,-0.3893792,0.6043672,
				-0.7176532,-0.5247434,-0.4670362,0.7997673,-0.5030886,0.7276558,
				1.0000000,-0.6251056,0.8164190,-0.6728515,-0.6371453,-0.5531964,
				-0.7225454,0.6971188,-0.3893792,-0.6251056,1.0000000,-0.7760765,
				0.6175124,0.5567924,0.4914176,0.8992372,-0.6306937,0.6043672,
				0.8164190,-0.7760765,1.0000000,-0.7315507,-0.6625136,-0.5814590,
				-0.8026491,0.7200848,-0.7176532,-0.6728515,0.6175124,-0.7315507,
				1.0000000,0.5910688,0.5096898,-0.6715168,0.5121227,-0.5247434,
				-0.6371453,0.5567924,-0.6625136,0.5910688,1.0000000,0.8106496,
				-0.5781565,0.4496810,-0.4670362,-0.5531964,0.4914176,-0.5814590,
				0.5096898,0.8106496,1.0000000), ,nrow=9,ncol=9)

rownames(correl) = c("pvote", "jmposaff", "jmnegaff",
		"boposaff","bonegaff",
		"obama.therm", "mccain.therm", 
		"oddcand.D", "evencand.D" )

colnames(correl) = c("pvote", "jmposaff", "jmnegaff",
		"boposaff","bonegaff",
		"obama.therm", "mccain.therm", 
		"oddcand.D", "evencand.D" )

#One Factor Model:
model.all <- specify.model()
allmeasures -> pvote,				b1, NA
allmeasures -> obama.therm,			b2, NA
allmeasures -> mccain.therm,		b3, NA
allmeasures -> jmposaff,			b4, NA
allmeasures -> jmnegaff,			b5, NA
allmeasures -> boposaff,			b6, NA
allmeasures -> bonegaff,			b7, NA
allmeasures -> oddcand.D,			b8, NA
allmeasures -> evencand.D,			b9, NA
allmeasures <-> allmeasures,		NA,1
pvote <-> pvote,					v1, NA
obama.therm <-> obama.therm,		v2, NA
mccain.therm <-> mccain.therm,		v3, NA
jmposaff <-> jmposaff,				v4, NA
jmnegaff <-> jmnegaff,				v5, NA
boposaff <-> boposaff,				v6, NA
bonegaff <-> bonegaff,				v7, NA
oddcand.D <-> oddcand.D,			v8, NA
evencand.D <-> evencand.D,			v9, NA


sem.all <- sem(model.all, correl, 1100)

summary(sem.all)

#Two Factor Model:
model.vi <- specify.model()
verbal -> pvote,					b1, NA
verbal -> obama.therm,				b2, NA
verbal -> mccain.therm,				b3, NA
verbal -> jmposaff,					b4, NA
verbal -> jmnegaff,					b5, NA
verbal -> boposaff,					b6, NA
verbal -> bonegaff,					b7, NA
imp -> oddcand.D,					b8, NA
imp -> evencand.D,					b9, NA
imp <-> imp,						NA, 1
verbal <-> verbal,					NA, 1
pvote <-> pvote,					v1, NA
obama.therm <-> obama.therm,		v2, NA
mccain.therm <-> mccain.therm,		v3, NA
jmposaff <-> jmposaff,				v4, NA
jmnegaff <-> jmnegaff,				v5, NA
boposaff <-> boposaff,				v6, NA
bonegaff <-> bonegaff,				v7, NA
oddcand.D <-> oddcand.D,			v8, NA
evencand.D <-> evencand.D,			v9, NA
imp <-> verbal,						civ, NA

sem.vi <- sem(model.vi, correl, 1100)
summary(sem.vi)

--------------------------- R CODE END
------------------------------------------------

Thanks very much.

-Solomon
-- 
View this message in context: http://www.nabble.com/Confirmatory-factor-analysis-problems-using-sem-package-%28works-in-Amos%29-tp23664618p23664618.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list