vdorie / blme

Bayesian Linear Mixed Effect Models

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

horseshoe prior

bachlaw opened this issue · comments

As a possible feature, would it be possible to add a horseshoe prior option for the non-grouped variables? It is very useful in Stan but computationally time-consuming on large data sets. It may be much more effectively explored through an optimization approach. Ideally, this would be available through bayesglm as well to explore non-hierarchical versions of the same models.

It should be possible, although as far as I can tell it would require a finite approximation since blme can't just sample the local shrinkage parameters as happens in Stan. In order to fit in the "mixed effects" framework, the global shrinkage parameter (tau) would be a hyperparameter - i.e. "fixed" and something passed in to the optimizer. Does that sound reasonable?

It certainly does. A finite approximation is certainly in the spirit of a MAP estimate and together these would allow users to screen out the options most likely to be unsuccessful before embarking on full Stan programming. Thank you!

I've checked in an initial attempt. As far as I can tell, it is substantially shrinking fixed effects that are of a smaller order than the others but I'm not really experienced with the prior. It can be used by specifying

blmer(..., fixef.prior = horseshoe(mean = mu, global.shrinkage = tau, common.scale = TRUE))

So, this works well with blmer but does not work for bglmer, at least with a standard binomial or poisson family. The error is:
Error in log(sapply(dist, expint::expint_E1, scale = TRUE)) : non-numeric argument to mathematical function

Is there a character class we need to account for? Sorry for all the trouble. Thanks much.

Sorry about that, I wasn't thorough in my testing. It should be fixed now, and I've expanded the test suite in case I break it again in the future.