Confusion about CFA - 1 LV, 3 MVs

2 replies [Last post]
dlrogers's picture
Offline
Joined: 06/21/2010

I've tried running a simple CFA in OpenMx, using the tutorials and adapting an example, but the results are not what I expected. Specifically, I get no fit indices (e.g., RMSEA, chi-square, etc.). It certainly may be due to my data or my too-simplistic model or something. Any help in either (a) understanding why I get the results I do, or (b) helping me figure out how to get the results I am more accustomed to, would be greatly appreciated.

I'm neither a wiz at stats nor at R, but I try to keep my head above water in both areas. I'm more comfortable with visual diagrams than with matrices, but given enough time I can usually figure out the latter.

I am running R 2.11.0 as a 32-bit application on a Windows-7 64-bit machine. My model involves one latent variable, "sexDev," and three manifest variables, "devAtt_txf", "devInt_txf", and "devBx_txf". The latter are summed results of questionnaire items (likert/ordinal and count/ratio) asking about deviant sexual attitudes, intentions, and behaviors, respectively. They have all been Box-Cox transformed because they were highly nonnormal. There is missing data in the raw data frame; I plan to use FIML later, but first I wanted to see if I could get the code to run properly without it (perhaps this is my mistake?)

My syntax is attached. Any suggestions or observations are appreciated.

dlrogers's picture
Offline
Joined: 06/21/2010
I can't see my attachment

I can't see my attachment (despite half an hour of trying to get it to appear, and then being told that I had triggered the spam filter), so hopefully it will show up here.

AttachmentSize
mx_model_cfa_devSex.r 1.82 KB
tbates's picture
Offline
Joined: 07/31/2009
here's a self-contained

here's a self-contained example... The "problem" is that there is no saturated model to which the model can compare the result of your FA. This is a general issue with FIML - computing the saturated model is time consuming and currently the way toRMSEA here would be to build a saturated model, get the saturated likelihood, and put that in manually to summary, i.e.

summary(fit, SaturatedLikelihood=787)

# OpenMx attempt at CFA for F_one portion of model
# modified from example at
# http://openmx.psyc.virginia.edu/docs/OpenMx/latest/FactorAnalysis_Path.html
require(OpenMx); require(MASS)
desiredCovMatrix = matrix(
c(1, .5, .5,
.5, 1 , .5,
.5, .5 , 1) ,nrow=3, byrow=T);
xyz = mvrnorm (n=100, mu=0, Sigma= desiredCovMatrix);
xyz = data.frame(xyz); names(xyz) <- c("x", "y","z");

manifests = names(xyz);

model <- mxModel("CFA", type="RAM",
mxData(observed=xyz, type="raw"),
manifestVars=manifests,
latentVars="F_one",
mxPath(manifests, arrows=2, free=T, values=c(.1,.2,.3), labels=c("e1","e2","e3")), # residual variances
mxPath("F_one" , arrows=2, free=F, values=1, labels ="varSexDev"), # latent variance
mxPath("F_one" , to=manifests, arrows=1, free=T, values=1, labels =c("b_att","b_int","b_bx")), # loadings
mxPath("one" , to="F_one" , arrows=1, free=F, values=0), # factor mean = 1
mxPath("one" , to=manifests, arrows=1, free=T, values=1, labels =paste("mean", manifests, sep="_")) # means
)

fit <- mxRun(model)
summary(fit) # no chi-sq or RMSEA generated :(