Dear Nikola,
Thanks for your script/data. In principle, it should work. But it is
important that when we estimate the CFA models in the first step, we
keep the bifactor pieces together. This means that we must fit the
general factor and its specific factors in one go (and not first the
general factor alone, and then the first specific factor alone, etc). To
accomplish this, you need to use the mm.list= argument as follows:
mm.list = list(bis = "bis", bas = "bas", fight = "fight", freeze =
"freeze", flight = "flight", socanx = c("SOCANX", "SA1", "SA3", "SA4"),
rum = c("RUM" ,"RT", "CFT", "PFT"))
The mm.list defines the 'blocks' that are fitted together. For the
bis/bas/... factors, it is one factor per block. But for socanx and rum,
we fit several factor together:
# sam - local
fit.sam <- lavaan:::sam(proba, data = rsq_rtsq_sas1, sam.method =
"local", estimator = "MLR", missing = "fiml", verbose = TRUE,
mm.list = mm.list)
Unfortunately, this will not work for your data. The reason is that the
measurement models fit (very) poorly, leading to more 'error' than
'signal' for some of the variables, and this gives computational trouble
later when computing the (two-step) standard errors. At least, when
sam.method = "local".
The only way out (here) is to switch to sam.method = "global":
fit.sam.global <- lavaan:::sam(proba, data = rsq_rtsq_sas1,
sam.method = "global",
estimator = "MLR", missing = "fiml",
mm.list = mm.list)
which does work for your model/data combination. The difference between
local/global is somewhat technical. Local sam will explicitly compute an
estimate of the variance/covariance matrix of the latent variables, and
compute the regressions among them in a second step. Global sam does not
explicitly compute this variance matrix, and this can an advantage in
more demanding settings.
Yves.
On 8/27/20 4:19 AM, Nikola Ćirović wrote:
> Dear Dr Rosseel,
>
> I am writing to you in reply to the post on lavaan google group where we
> made a deal about sharing the syntax and the data.
>
>
https://groups.google.com/d/msgid/lavaan/a1c3de6d-ef1a-40c4-bd17-a7de82767364o%40googlegroups.com
>
> First of all, thank you for your interest and your help. I am really
> eager to learn how to apply FDR+Croon procedure. A reviewer recommended
> it to me and I am really eager to learn about it for the soon upcoming work.
>
> I am sending you the script (like you said) I used for the analysis of
> the model I mentioned (5 personality traits, two bifactor structures –
> one whose general factor is a mediator and the other whose general
> factor is the outcome; at first, I specified all the direct and indirect
> paths). Also, attached you will find the full data with the variables in
> question.
>
>
> This is the script I used.
>
> proba<-'
>
> *#personality traits *
>
> bis=~ p114+p125+p129+p130+p133+p136+p138
>
> bas=~p116+p118+p127+p131+p137+p140
>
> fight=~p115+p121+p123+p124+p132+p139
>
> freeze=~p117+p119+p126+p128+p134
>
> flight=~p113+p120+p122+p135+p141
>
> *#the bifactors *
>
> SOCANX =~
> p142+p143+p144+p145+p146+p147+p148+p149+p150+p151+p152+p153+p154+p155+p156+p157+p158+p159+p160+p161+p162+p163+p164+p165+p166
>
>
> SA1=~ p143+p145+p146
>
> p154~~p144
>
> SA3=~ p156+p157+p158+p159
>
> SA4=~p162+p163+p164+p165
>
> RUM=~p167+p168+p169+p170+p171+p172+p173+p174+p175+p176+p177+p178+p179+p180+p181+p183+p184+p185+p186
>
> RT =~p167+p168+p169+p170
>
> CFT=~ p172+p173+p174
>
> PFT=~p175+p177+p178+p179
>
> p183~~p185
>
> p185 ~~ p186
>
> *#manual fixing of covariances to zero to make sure group-factors of
> bifactors are orthogonal to every other factor (I get the same with
> orthogonal argument that I use with sem function)*
>
> bis~~0*SA1+0*SA3+0*SA4
>
> bas~~0*SA1+0*SA3+0*SA4
>
> fight~~0*SA1+0*SA3+0*SA4
>
> freeze~~0*SA1+0*SA3+0*SA4
>
> flight~~0*SA1+0*SA3+0*SA4
>
> bis~~ 0*RT+0*CFT+0*PFT
>
> bas~~0*RT+0*CFT+0*PFT
>
> fight~~0*RT+0*CFT+0*PFT
>
> freeze~~0*RT+0*CFT+0*PFT
>
> flight~~0*RT+0*CFT+0*PFT
>
> SA1~~ 0*RT+0*CFT+0*PFT
>
> SA3~~0*RT+0*CFT+0*PFT
>
> SA4~~0*RT+0*CFT+0*PFT
>
> RT~~ 0*CFT+0*PFT
>
> CFT~~0*PFT
>
> SA1~~ 0*SA3+0*SA4
>
> SA3~~ 0*SA4
>
> SOCANX~~0*SA1+0*SA3+0*SA4
>
> RUM ~~0*RT+0*CFT+0*PFT
>
> *# the structural part of the model*
>
> RUM~ bis+fight+flight+freeze+bas
>
> SOCANX~ RUM+bis+fight+flight+freez+bas
>
> '
>
> fit.proba <- lavaan ::: sam (proba, data = rsq_rtsq_sas1 ,sam.method =
> "local", estimator = "MLR", missing = 'fiml')
>
> summary(fit.proba,
>
> fit.measures = TRUE,standardize = TRUE,
>
> rsquare = TRUE)
>
> *This script produces the following error:*
>
>> fit.proba <- lavaan ::: sam (proba, data = PORPOS_3_ukupna_matrica_07_12bez10misingout_01
> ,sam.method = "local", estimator = "MLR", missing = 'fiml')
>
> Warning message:
>
> In lavaan:::sam(proba, data = rsq_rtsq_sas1, :
>
> lavaan WARNING: no free parameters left for structural part.
>
> Returning measurement part only.
>
>>
>
>> summary(fit.proba,
>
> + fit.measures = TRUE,standardize = TRUE,
>
> + rsquare = TRUE)
>
> Length Class Mode
>
> [1,] 1 lavaan S4
>
> [2,] 1 lavaan S4
>
> [3,] 1 lavaan S4
>
> [4,] 1 lavaan S4
>
> [5,] 1 lavaan S4
>
> [6,] 1 lavaan S4
>
> [7,] 1 lavaan S4
>
> [8,] 1 lavaan S4
>
> [9,] 1 lavaan S4
>
> [10,] 1 lavaan S4
>
> [11,] 1 lavaan S4
>
> [12,] 1 lavaan S4
>
> [13,] 1 lavaan S4
>
>>
>
> *Howe**ver, when I drop the group-factors it works.*
>
> modeSAM.bez.bifactora<-'
>
> bis=~ p114+p125+p129+p130+p133+p136+p138
>
> bas=~p116+p118+p127+p131+p137+p140
>
> fight=~p115+p121+p123+p124+p132+p139
>
> freez=~p117+p119+p126+p128+p134
>
> flight=~p113+p120+p122+p135+p141
>
> SOCANX =~
> p142+p143+p144+p145+p146+p147+p148+p149+p150+p151+p152+p153+p154+p155+p156+p157+p158+p159+p160+p161+p162+p163+p164+p165+p166
>
>
> RUM =~
> p167+p168+p169+p170+p171+p172+p173+p174+p175+p176+p177+p178+p179+p180+p181+p183+p184+p185+p186
>
> RUM~ bis+fight+flight+freez+bas
>
> SOCANX~ RUM+bis+fight+flight+freez+bas
>
> '
>
> fit.SAM.model.bezbifactora <- lavaan ::: sam (modeSAM.bez.bifactora,
> data = rsq_rtsq_sas1,estimator = "MLR",missing = 'fiml', sam.method =
> "local" )
>
> summary(fit.SAM.model.bezbifactora,
>
> fit.measures = TRUE,standardize = TRUE,
>
> rsquare = TRUE)
>
> Ona additional question, I have noticed that when I use sam function
> after ML standard errors of the structural parameters (and p values)
> differ really slightly form SEs and p that I get from MLR.
>
> Finally, the problem with fsr function I had (I mentioned in lavaan
> group) was resolved when I reinstalled lavaan (to the 6-7 version) but
> the results I get are really strange - structural parameter are so
> contrary to the once I obtained with sam function with the
> sam.method=”local” argument and contrary to once I got when I use MLR or
> WLSMV with sem function, and also these parameters don’t make sense
> (when I prespecify sem-derived paths with fsr function the fit, of
> course, is poor). In short – they are almost the revered findings. So,
> I really also need to ask you if I can use sam function with
> sam.method=”local” argument and cite the Devlieger & Rosseel, 2017? I
> apologize for this pragmatic question but the review is due very soon so
> it would mean a lot to me to have at least that bit of certainty (and
> I’ll be thrilled to see the developments with the bifactors and sam).
>
>> modeSAM.bez.bifactora<-'
>
> + bis=~ p114+p125+p129+p130+p133+p136+p138
>
> + bas=~p116+p118+p127+p131+p137+p140
>
> + fight=~p115+p121+p123+p124+p132+p139
>
> + freez=~p117+p119+p126+p128+p134
>
> + flight=~p113+p120+p122+p135+p141
>
> +
>
> + SOCANX =~
> p142+p143+p144+p145+p146+p147+p148+p149+p150+p151+p152+p153+p154+p155+p156+p157+p158+p159+p160+p161+p162+p163+p164+p165+p166
>
>
> +
>
> + RUM =~
> p167+p168+p169+p170+p171+p172+p173+p174+p175+p176+p177+p178+p179+p180+p181+p183+p184+p185+p186
>
> +
>
> + RUM~ bis+fight+flight+freez+bas
>
> + SOCANX~ RUM+bis+fight+flight+freez+bas
>
> + '
>
>> fit.fsr.model <- lavaan:::fsr(model = modeSAM.bez.bifactora, data =
> rsq_rtsq_sas1, cmd = "sem",
>
> + fsr.method = "Croon", fs.method = "Bartlett")
>
>> summary(fit.fsr.model,
>
> + fit.measures = TRUE,standardize = TRUE,
>
> + rsquare = TRUE)
>
> *and when I apply fsr to the model with bifactors it shows a warning
> message: *
>
> Error in lavaan:::fsr(model = proba, data = rsq_rtsq_sas1, cmd = "sem", :
>
> lavaan ERROR: corrected covariance matrix of factor scores
>
> is not positive definite;
>
> Once again, thank you for your interest and help and all the helpful
> work you so kindly share through lavaan.
>
> Best wishes,
>
> Nikola Ćirović, a junior researcher at the Department of Psychology,
> Faculty of Philosophy, University of Niš (Serbia)
>
> official mail:
nikola....@filfak.ni.ac.rs
> <mailto:
nikola....@filfak.ni.ac.rs>
>
--
Yves Rosseel
Department of Data Analysis, Ghent University