Second-order model implementation

82 views
Skip to first unread message

Leon

unread,
Jun 21, 2021, 6:05:45 AM6/21/21
to blavaan
Good day,

Thank you for a great package, which I am learning slowly but surely.

I have tried to specify a second-order model with four first-order factors as indicators. But the Rhat's for the second-order loadings are very high and the direction of the loadings are also negative when they should be positive. The first-order std factor loadings also seem lower to me compared to a first-order only model, by about 0.15 to 0.20. 

Perhaps it is just a specification issue of the model on my side. But the second-order model does work as would be expected in other software with frequentist methods. 

Here is the model, the output is in the attached text file if needed. 

model1 <- 'EX =~ batEX1 + batEX2 + batEX3 + batEX4 + batEX5 + batEX6 + batEX7 + batEX8
           MD =~ batMD1 + batMD2 + batMD3 + batMD4 + batMD5
           CC =~ batCC1 + batCC2 + batCC3 + batCC4 + batCC5
           EC =~ batEC1 + batEC2 + batEC3 + batEC4 + batEC5
           
           bat =~ EX + MD + CC + EC'

model1.fit <-  bcfa(model1, data=batdata, std.lv=T, 
                    n.chains = 3, burnin=20000, 
                    sample=2000)

Thank you for your time. 

issue.txt

Mauricio Garnier-Villarreal

unread,
Jun 22, 2021, 4:05:11 AM6/22/21
to blavaan
Leon

Could you share the output of the model with only the first order factors? To see the correlations between factors.
Also, could you run with with std.lv=F, to see if there is some clash in the model between these arguments?

I cant replicate the error with other data sets

Leon

unread,
Jun 22, 2021, 10:15:26 AM6/22/21
to blavaan
Mauricio, find attached.

First-order model with std.lv set to T. 
First-order model with std.lv set to F. 
Second-order models with std.lv set to F for 20000 and 30000 burnin. 

 If you need me to send you the data, I will e-mail it to you. 

first order model - stdlv= T.txt
second-order model - burn 30000 - stdlv= F.txt
first order model - stdlv= F.txt
second-order model - burn 20000 - stdlv= F.txt

Mauricio Garnier-Villarreal

unread,
Jun 22, 2021, 1:45:19 PM6/22/21
to blavaan
Leon

By mistake for the "first order model std.lv=T.txt", you forgot to give the model syntax for the first order and actually estimated the second order model with std.lv=T. And the model converged, saving 1000 after 20000 burnin. With standardized factor loadings for the second order factor around 0.8
So, I think you got a bad solution last time due to MCMC variability. Just checked the neff to diagnose the model

With MCMC, I recommend you to save the workspace after you have the models you want, so you dont have to run the models again

Leon

unread,
Jun 23, 2021, 12:27:02 PM6/23/21
to blavaan
Mauricio, 

I cannot duplicate the file you are referring to, it seems as if I am in the twilight zone because that model did work according to the estimates. But I am unable to replicate the result again. 

There were some warning about the lme4 package and overlapping function names, but I removed the lme4 package, but then when I restarted RStudio the brms library needs lme4 so I reinstalled it, and the warnings are gone now. 

I have now taken another dataset with the same items, and I get a solution but the loadings on the second-order factor are all negative when they should be positive, see attached. But the Rhats are fine at least. I guess the signs could all just be switched around and considered positive?

But I don't want to waste your time further with this. I will test other second-order models in future and revive this thread if I am still having issues. 

Thanks for assisting. 
finalmodel.txt

Mauricio Garnier-Villarreal

unread,
Jun 24, 2021, 9:21:40 AM6/24/21
to blavaan
Leon

Yes, as long as all the factor loadings go in the same direction it does match your hypothesis, but the factor means the opposite direction of what you expected. For example, if your factor were depression, with negative factor loadings means lack of depression.
You can set the direction of the factor by fixing one of the factor loadings to be positive, then the rest should follow

bat =~ L1*EX + MD + CC + EC
L1 > 0

Like adding this cobstraint to the model

Ed Merkle

unread,
Jun 24, 2021, 9:58:39 AM6/24/21
to Leon, blavaan
Leon,

I have not had a chance to run this model but had a couple thoughts:

- It is possible that chains sometimes get stuck on the wrong side of zero, and this goes away upon re-running the model. Sometimes adding the argument inits="simple" can help.

- The thing about sign indeterminacy (from Mauricio) suggests that priors like normal(0,big variance) are not appropriate, because you are expecting the loadings to all be positive. So setting different prior distributions might also help. For details on doing that, see



Ed
--
You received this message because you are subscribed to the Google Groups "blavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blavaan+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blavaan/24c7fd9e-f6fb-41d7-a2ea-f97ef658c592n%40googlegroups.com.

Leon

unread,
Jun 25, 2021, 11:28:52 AM6/25/21
to blavaan
Ed / Mauricio,

Just reporting back.

The specification of inits = "simple" worked for the signs of the loading on the factors.

I then used inits = "prior" and specified some different priors and also added both std.lv and std.ov to TRUE as I wanted to use standardized priors. This then again had a lot of warnings, but this was my mistake due to the priors as I never set intercept priors and they were the standard (0,35), but setting them to (0,1) worked for the model. 

Then I tried a model with specific standardized priors on the loadings to say, well I know all these loadings are positive. The prior on the loadings of (.5,.5) caused trouble for these factor loadings as I got warnings and bad Rhats, so I also tried (.5,.15) and these presented no problems after the estimation. 

Lastly, I added approximately zero cross-loadings with (0,.05) and (0,.01) and both of these were bad on the cross-loadings. I then changed this to (0,.10) and the model worked. I also tried a model with a higher expectation of the second-order factor loadings (.7, .15) and this also worked. 

Thanks!

Mauricio Garnier-Villarreal

unread,
Jun 26, 2021, 7:31:10 PM6/26/21
to blavaan
Leon

When using tighter priors such as N(0.7, 0.15), make sure the posterior distribution is not being constrainted much by the prior
For example check the 95% interval from the prior, and see that the posterior is not too close to it

quantile(rnorm(10000, mean=0.7, sd=0.15), probs=c(.025, .0975))
Reply all
Reply to author
Forward
0 new messages