ecmerkle/blavaan

Error when attempting to set Stan's adapt_delta option

jmgirard opened this issue · 2 comments

I am having issues changing the adapt_delta option for Stan. I tried this as an argument to bcfa as well as an argument in the bcontrol list. Both returned errors.

library(lavaan)
library(blavaan)
HS.model <- ' visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9 '
fit1 <- lavaan::cfa(HS.model, data = HolzingerSwineford1939, group = "school")
bfit1 <- bcfa(
  parTable(fit1), 
  data = HolzingerSwineford1939, 
  group = "school",
  bcontrol = list(cores = 3, adapt_delta = 0.9)
)
Error in checkForRemoteErrors(val) : 
  3 nodes produced errors; first error: passing unknown arguments: adapt_delta.
Error in blavaan(parTable(fit1), data = HolzingerSwineford1939, group = "school",  : 
  blavaan ERROR: problem with MCMC estimation.  The model syntax and data have been exported.

adapt_delta needs to go to stan through its control argument. This means that, for blavaan and bcontrol, you need:

bcontrol = list(cores = 3, control = list(adapt_delta = 0.9))

Ah, that makes sense now, but is very non-intuitive. Thanks!