error on running a factor analysis

4 replies [Last post]
csantos's picture
Offline
Joined: 09/16/2009

I'm running a factor analysis, which I have done before using EQS, with OpenMx and finding an error. The code and the output are below. I'd appreciate any diagnostics and directions!

Regards,
Carlos.
_____________
#load library
require(OpenMx)

#data
AttractivenessDataRaw <- read.table("/home/pos/carlosdenner/Desktop/logattractiveness.txt",header=TRUE)
names(AttractivenessDataRaw)

#model specification
AttractivenessFactorModel<-mxModel("Attractiveness Factor Model",
type="RAM",
mxData(
observed=AttractivenessDataRaw,
type="raw"),
manifestVars=c("pageviews","downloads","members"),
latentVars="attractiveness",
# residual variances
mxPath(from=c("pageviews","downloads","members"),
arrows=2,
free=TRUE,
values=c(1,1,1),
labels=c("e1","e2","e3")
),
# latent variance
mxPath(from="attractiveness",
arrows=2,
free=TRUE,
values=1,
labels ="varAttractiveness"
),
# factor loadings
mxPath(from="attractiveness",
to=c("pageviews","downloads","members"),
arrows=1,
free=c(FALSE,TRUE,TRUE),
values=c(1,1,1),
labels =c("l1","l2","l3")
),
# means
mxPath(from="one",
to=c("pageviews","downloads","members","attractiveness"),
arrows=1,
free=c(TRUE,TRUE,TRUE,FALSE),
values=c(1,1,1,0),
labels =c("meanpageviews","meandownloads","meanmembers",NA)
)
) # close model

AttractivenessFactorFit <- mxRun(AttractivenessFactorModel)
__________
Output:
Running Attractiveness Factor Model
Warning message:
In model 'Attractiveness Factor Model' NPSOL returned a non-zero status code 6. model does not satisfy the first-order optimality conditions to the required accuracy, and no improved point for the merit function could be found during the final linesearch (Mx status RED)

Steve's picture
Offline
Joined: 07/30/2009
Code 6 is returned from the

Code 6 is returned from the optimizer. Frequently a code 6 can be due to problems with starting values.

Note that you have started all of your variances and factor loadings at 1. Your starting values are likely resulting in a singular matrix.

I'd suggest starting values of something smaller for the free factor loadings, perhaps 0.2.

Also something smaller than 1.0 for the factor variance, say perhaps 0.8. You can probably get away with residual variances as 1.0, but I usually start them at 0.8 as well.

csantos's picture
Offline
Joined: 09/16/2009
I had to change most of the

I had to change most of the starting values, but it worked! Thanks, Steve!

tbates's picture
Offline
Joined: 07/31/2009
Would you mind posting the

Would you mind posting the data and mplus code to allow me to make an example for mplus users, and for others hitting your roadblock?

Jeff's picture
Offline
Joined: 07/31/2009
Good idea. We can simulate

Good idea. We can simulate the data if this particular set can't be posted online.