Please also provide the following information in addition to your question:
- Operating System: R 3.4.4 on Ubuntu 18.04.1
- brms Version: 2.4.4
Hello,
I’m trying to fit a Poisson glm to my data, and I would like to apply a normal prior to some parameters in my model, and a horseshoe prior to others.
My model is parameterized as follows:
hsForm = bf(count ~ alpha + eta1 + eta2 + log(nucGen),
alpha ~ 1,
eta1 ~ 0 + <myNormalPriorParams>,
eta2 ~ 0 + <myHorseshoePriorParams>,
nl=TRUE,
family=poisson())
pr = c(prior(normal(0,3), nlpar="eta1"),
prior(horseshoe(), nlpar="eta2"),
prior(normal(-23,5), nlpar="alpha"))
When I try to fit this model to my data, I get the following error:
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
variable "sigma" does not exist.
error in 'modele86151a69e5_filee865f8cf93' at line 55, column 105
-------------------------------------------------
53: }
54: transformed parameters {
55: vector[K_eta2] b_eta2 = horseshoe(zb_eta2, hs_local_eta2, hs_global_eta2, hs_scale_global_eta2 * sigma, hs_scale_slab_eta2^2 * hs_c2_eta2);
^
56: }
-------------------------------------------------
Error in stanc(model_code = paste(program, collapse = "\n"), model_name = model_cppname, :
failed to parse Stan model 'filee865f8cf93' due to the above error.
Of course if I use the gaussian family, the model compiles, because sigma exists. I really do need to use Poisson, however. How can I parameterize my model to apply the horseshoe shrinkage prior on some parameters, but a normal on others, while using a Poisson glm?
Thanks!