Simon Kiss
2013-Jul-09 17:28 UTC
[R] Goodness of fit statistics for cfa are missing (sem package)
Dear colleagues, I'm working on a confirmatory factor analysis and the model is not returning most of the usual goodness-of-fit statistics. I'm testing whether this survey data confirms a hypothesized two-factor uncorrelated structure that has theoretical and empirical support from another case. Below is (hopefully!) reproducible code which creates ff.cov a replica of the covariance matrix from my own data, the model that I have specified and am testing (cfa.mod.1) and the sem test of that model (cfa) and then a summary of the model fit (summary(cfa1)). The problem is that many of the usual measures o goodness-of-fit do not appear after summary(cfa1). I only get a chi-square statistic, degrees of freedom and a BIC. I saw a previous question on the R-mailing list that raised a similar issue and it was suggested that the problem lay in the specification of the model and that the degrees of freedom there were 0. Here, though, the df is 77. Unfortunately I can't find that question in the archives again or I would have linked to it. The data set includes 376 observations and has 14 variables. Seven (coded with an h in the variable name, as in cc.h.varname.e or h) are hypothesized to load on one factor uncorrelated with the second factor, coded with a c (as in cc.c.varname.c or i). I used this for guidance http://vimeo.com/38941937 Yours, Simon Kiss #Load Libraries library(sem) #Create Covariance Matrix ff.cov <- structure(c(0.0925407885304659, 0.0296839426523298, 0.00787168458781362, 0.0261784946236559, 0.0031878853046595, 0.0261837275985663, 0.00847584229390681, -0.00106, -0.00600867383512545, -0.010714623655914, -0.0123756272401434, -0.00528007168458781, -0.00116, 0.000812186379928316, 0.0296839426523298, 0.0665810023041475, 0.00836764592933948, 0.0281491359447005, 0.00793406810035842, 0.0169870865335381, 0.00258921786994368, 0.000712720174091142, -0.00318649385560676, -0.0083643253968254, -0.0133228366615463, -0.00557817844342038, -0.00224328341013825, -0.000821018945212493, 0.00787168458781362, 0.00836764592933948, 0.0804340181771633, 0.00589630696364567, 0.0201758960573477, 0.012536866359447, 0.000343669994879673, 0.00425544674859191, -0.00838453020993344, 0.00563975294418843, 0.00256180235535074, 0.00609073860727087, -0.00659535970302099, 0.00495727086533538, 0.0261784946236559, 0.0281491359447005, 0.00589630696364567, 0.0716310995903738, 0.00856442652329749, 0.0175328725038402, 0.0104401625704045, 0.0074095942140297, 0.00455983742959549, -0.0123115783410138, -0.0192821300563236, -0.0166337109575013, 0.00623943292370712, -0.0114852790578597, 0.0031878853046595, 0.00793406810035842, 0.0201758960573477, 0.00856442652329749, 0.0550506451612903, 0.00998831541218638, -0.000462311827956989, -0.0019576523297491, -0.0053855017921147, 0.00893281362007168, 8.10035842293904e-05, 0.00704324372759857, -0.00593381720430108, -0.00112867383512545, 0.0261837275985663, 0.0169870865335381, 0.012536866359447, 0.0175328725038402, 0.00998831541218638, 0.050779846390169, 0.00705281105990783, -0.00306167946748592, -0.00736291858678955, 0.00135779825908858, -0.00280025601638505, 0.00161077316948285, -0.00899035330261137, 0.00921536098310292, 0.00847584229390681, 0.00258921786994368, 0.000343669994879673, 0.0104401625704045, -0.000462311827956989, 0.00705281105990783, 0.0475710074244752, -0.0101174718381976, -0.0102886418330773, -0.0175483013312852, -0.0107030209933436, -0.00982140168970814, -0.00959551843317972, -0.00663934971838198, -0.00106, 0.000712720174091142, 0.00425544674859191, 0.0074095942140297, -0.0019576523297491, -0.00306167946748592, -0.0101174718381976, 0.0572903110599078, 0.0148363965693804, 0.0134899987199181, 0.0172146441372248, 0.00366528545826933, 0.0148914759344598, 0.00469321556579621, -0.00600867383512545, -0.00318649385560676, -0.00838453020993344, 0.00455983742959549, -0.0053855017921147, -0.00736291858678955, -0.0102886418330773, 0.0148363965693804, 0.0650389644137225, 0.00571948412698413, 0.00671484895033282, -0.000752505120327701, 0.0295244790066564, -0.00901979006656426, -0.010714623655914, -0.0083643253968254, 0.00563975294418843, -0.0123115783410138, 0.00893281362007168, 0.00135779825908858, -0.0175483013312852, 0.0134899987199181, 0.00571948412698413, 0.0839045558115719, 0.0463349206349206, 0.0350310253456221, 0.00760227470558116, 0.035818561187916, -0.0123756272401434, -0.0133228366615463, 0.00256180235535074, -0.0192821300563236, 8.10035842293904e-05, -0.00280025601638505, -0.0107030209933436, 0.0172146441372248, 0.00671484895033282, 0.0463349206349206, 0.073641986687148, 0.0295747055811572, 0.00827306707629288, 0.0317729134664619, -0.00528007168458781, -0.00557817844342038, 0.00609073860727087, -0.0166337109575013, 0.00704324372759857, 0.00161077316948285, -0.00982140168970814, 0.00366528545826933, -0.000752505120327701, 0.0350310253456221, 0.0295747055811572, 0.0607050576036866, 0.00305336789554532, 0.0243178443420379, -0.00116, -0.00224328341013825, -0.00659535970302099, 0.00623943292370712, -0.00593381720430108, -0.00899035330261137, -0.00959551843317972, 0.0148914759344598, 0.0295244790066564, 0.00760227470558116, 0.00827306707629288, 0.00305336789554532, 0.0525731067588326, 0.000673143881208398, 0.000812186379928316, -0.000821018945212493, 0.00495727086533538, -0.0114852790578597, -0.00112867383512545, 0.00921536098310292, -0.00663934971838198, 0.00469321556579621, -0.00901979006656426, 0.035818561187916, 0.0317729134664619, 0.0243178443420379, 0.000673143881208398, 0.0749327188940092), .Dim = c(14L, 14L), .Dimnames = list(c("cc.c.protect.i", "cc.c.privacy.i", "cc.c.limchoi.c", "cc.c.interests.i", "cc.c.goals.c", "cc.c.harm.c", "cc.c.needs.c", "cc.h.discrim.e", "cc.h.wealth.e", "cc.h.revdis2.h", "cc.h.equal.h", "cc.h.feminine.h", "cc.h.radeq.e", "cc.h.tradfam.h"), c("cc.c.protect.i", "cc.c.privacy.i", "cc.c.limchoi.c", "cc.c.interests.i", "cc.c.goals.c", "cc.c.harm.c", "cc.c.needs.c", "cc.h.discrim.e", "cc.h.wealth.e", "cc.h.revdis2.h", "cc.h.equal.h", "cc.h.feminine.h", "cc.h.radeq.e", "cc.h.tradfam.h"))) #Specify Model cfa.mod1<-specifyModel() HE -> cc.h.discrim.e, he0 HE -> cc.h.wealth.e, he1 HE -> cc.h.revdis2.h, he2 HE -> cc.h.equal.h, he3 HE -> cc.h.radeq.e, he4 HE -> cc.h.tradfam.h, he5 HE -> cc.h.feminine.h, he6 IC -> cc.c.protect.i, ic0 IC -> cc.c.privacy.i, ic1 IC -> cc.c.limchoi.c, ic2 IC -> cc.c.interests.i, ic3 IC -> cc.c.goals.c, ic4 IC -> cc.c.harm.c, ic5 IC -> cc.c.needs.c, ic6 HE <-> HE, NA, 1 IC <-> IC, NA, 1 cc.h.discrim.e <-> cc.h.discrim.e, error1 cc.h.wealth.e <-> cc.h.wealth.e, error2 cc.h.revdis2.h <-> cc.h.revdis2.h, error3 cc.h.equal.h <-> cc.h.equal.h, error4 cc.h.radeq.e <-> cc.h.radeq.e, error5 cc.h.tradfam.h <-> cc.h.tradfam.h, error6 cc.h.feminine.h <-> cc.h.feminine.h, error7 cc.c.protect.i <-> cc.c.protect.i, error8 cc.c.privacy.i <-> cc.c.privacy.i, error9 cc.c.limchoi.c <-> cc.c.limchoi.c, error10 cc.c.interests.i<-> cc.c.interests.i, error11 cc.c.goals.c <-> cc.c.goals.c, error12 cc.c.harm.c <-> cc.c.harm.c, error13 cc.c.needs.c <-> cc.c.needs.c, error14 #Test Model cfa1<-sem(cfa.mod1, S=ff.cov, N=376) #Examine Model cfa1 summary(cfa1) stdCoef(cfa1) #First few lies of my output Model Chisquare = 414.2874 Df = 77 Pr(>Chisq) = 1.142376e-47 AIC = 470.2874 BIC = -42.29101 ********************************* Simon J. Kiss, PhD Assistant Professor, Wilfrid Laurier University 73 George Street Brantford, Ontario, Canada N3T 2C9