paul-buerkner / brms

brms R package for Bayesian generalized multivariate non-linear multilevel models using Stan
https://paul-buerkner.github.io/brms/
GNU General Public License v2.0
1.28k stars 184 forks source link

Optimization option #115

Closed bachlaw closed 8 years ago

bachlaw commented 8 years ago

I very much appreciate the support brms offers for distributions with excess zeroes. But, for larger data sets, full MCMC is still impractical. RStan seems to support maximum likelihood optimization as well, but that option is not mentioned anywhere in the brms guide. Can we set the "algorithm" to that inside the brms framework? Is it supported, particularly for multilevel modeling? If not, can it be? RStanarm appears to support optimization, but for glm only.

paul-buerkner commented 8 years ago

The optimization algorithm is not supported on purpose in brms, since the output of optimizing is totally different than that of sampling (the signature NUTS sampler of Stan) or vb (variational bayes algorithms meanfiled and fullrank). As a result, nearly all S3 methods of brms are incompatible with the output of optimizing and it would require much special case coding to make them compatible.

Also, I do not recommend using optimization in multilevel models, since many parameter won't be normally distributed in these models so that the maximum likelihood estimate doesn't tell us much (I guess this may be one reason why rstanarm does only allow optimization in glms).

If you want to apply optimization with the models generated by brms, you could generated the Stan code and data with make_stancode and make_standata, and then call rstan::optimizing manually.