vdorie / blme

Bayesian Linear Mixed Effect Models
41 stars 8 forks source link

horseshoe prior #3

Open bachlaw opened 7 years ago

bachlaw commented 7 years ago

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.

vdorie commented 7 years ago

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?

bachlaw commented 7 years ago

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!

vdorie commented 7 years ago

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))
bachlaw commented 7 years ago

Thank you Vincent!

Jonathan

Sent from my iPhone

On Jan 14, 2017, at 3:32 PM, Vincent Dorie notifications@github.com<mailto:notifications@github.com> wrote:

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 experience with the prior. It can be used by specifying

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

- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/vdorie/blme/issues/3#issuecomment-272654710, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALDpUM6H5kEqjsUwDoF22sz5oKniSrqdks5rST7ogaJpZM4Layj6.

bachlaw commented 7 years ago

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.

vdorie commented 7 years ago

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.

bachlaw commented 7 years ago

Nothing to apologize for. Thanks very much.

Jonathan

Sent from my iPhone

On Jan 16, 2017, at 3:44 PM, Vincent Dorie notifications@github.com<mailto:notifications@github.com> wrote:

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.

- You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/vdorie/blme/issues/3#issuecomment-272958115, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALDpUK-QLTJZSA_xKlQ_Ga_IV2YuDXPcks5rS9aygaJpZM4Layj6.