adapt_delta and treedepth

67 views
Skip to first unread message

Belinda Davey

unread,
Oct 1, 2023, 6:50:59 PM10/1/23
to blavaan
Hi all,
Does anyone know how to set adapt_delta and max_treedepth in blavaan? I have tried to find this, unsuccessfully.

Thank you,
Belinda

Ed Merkle

unread,
Oct 1, 2023, 7:20:00 PM10/1/23
to Belinda Davey, blavaan
You can do it with the bcontrol argument:

bcontrol = list(adapt_delta = ?, max_treedepth = ?)

where the ? symbols are whatever number you want.

In my experience, those settings do not often fix a badly converging blavaan model. It is often more helpful to simplify the model until something works, then slowly build up more complexity.

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/a27f6ec1-44e5-452a-93e5-747e72f7a9e3n%40googlegroups.com.

Belinda Davey

unread,
Oct 2, 2023, 12:32:41 AM10/2/23
to Ed Merkle, blavaan
Thanks, Ed. I thought that was the correct syntax for adapt_delta and tree_maxdepth. However, whenever I add these, I get the error: 'Error in checkForRemoteErrors(val) : 
  6 nodes produced errors; first error: passing unknown arguments: adapt_delta, max_treedepth.
Error in blavaan::blavaan(modelMPlus_corsi_ds_all, data = data_near_far_corsi,  :  
  blavaan ERROR: problem with MCMC estimation. The model syntax and data have been exported.' 
This is my code:
# Fit the model
bfit_modelMPlus_corsi_ds_all <- bsem(modelMPlus_corsi_ds_all,
                                        data = data_near_far_corsi,
                                        group="rand_group",
                                        group.equal = c("loadings"),
                                        meanstructure = TRUE,
                                        n.chains =6,
                                        dp = dp,
                                        sample=4000,
                                          burnin=1000,
                                        bcontrol=list(cores=6, thin=10, adapt_delta=.99, max_treedepth=12))

Ed Merkle

unread,
Oct 2, 2023, 9:12:52 AM10/2/23
to Belinda Davey, blavaan
That is my mistake. Those arguments go within the "control" argument of stan(). So it should be 

bcontrol = list(control = list(adapt_delta = ?, max_treedepth = ?))

Reply all
Reply to author
Forward
0 new messages