Is there a way with which we can pass the control argument to the stan_lmer function, like we do in lmer function (lme4)
How are you using it with
lme4::lmer()? The control argument to
lme4::lmer controls the optimization algorithm in very algorithm-specific ways that won’t generalize to Stan’s sampling algorithms.
Thanks Mike for the response.
Actually my models are not converging using the stan_lmer function. I want to try tuning a few convergence parameters in the models like boundary.tol, check.conv.hess
but I am not able to pass these variables as arguments to the stan_lmer function. Can you please suggest to me options by which I can pass these variables as arguments to the stan_lmer function.
Till now I have tried passing the variables like this.
model <- stan_lmer(F1,data = x,
prior = prior_variable
autoscale = FALSE),
seed = seed_num,
algorithm = "meanfield", lmerControl(optCtrl=list(ftol_abs=0.05)))
Ok, the quantities you list are definitely lmer-specific things. Stan uses completely different algorithms behind the scenes and thus has completely different things you can tweak to change the algorithm’s behaviour.
See here for description of the core algorithms. The “meanfield” you are using is described in the variational inference section. Note however this from the rstanarm documentation:
[The “meanfield” algorithm ] is not recommended for final statistical inference. It can be useful to narrow the set of candidate models in large problems, particularly when specifying
stan_gamm4, but is only an approximation to the posterior distribution .
Regardless of what algorithm you choose, rstanarm uses rstan to in turn interface with cmdstan, and the
rstanarm::stan_lmer() docs show a
... entry whereby you can pass values to rstan to tweak the sampling/vb algorithm. Take a look at the help page for
rstan::stan() for what you can play with.
I also recommend posting a description of your data & model, as when folks encounter fitting issues it’s usually due to a misspecification and not something that playing with the algorithms is going to solve.