Hierarchical prior for the regression coefficients

Hi, I tried to specify a simple hierarchical prior for my model in brms but couldn’t figure out how to do it. Suppose I want to regress y onto x1 and x2 (simple linear regression, no group-level effects or anything). Denote the regression coefficients by b1 and b2. I would like to set prior N(0,tau) for both b1 and b2, so that also tau is treated as unknown (hyper)parameter for which I would like to place a prior (say half-t or half-Cauchy) and which should then be inferred.

Is this possible and how should I do it? I tried using the stanvar function but as far as I understood it cannot be used to declare new parameters, only variables that are passed in as data.

With the exception of some specific cases (b1 and b2 relating to the same categoricl variable), I don’t see any build in option for this. But maybe there should be one? Feel free to open an issue on github if you like.

Thanks for a prompt answer! I now created an issue in Github, as I think this would be a useful feature.

Just came across this topic while searching for the answer to a related question. To make the solution discoverable, here is the github issue (now closed; there is a solution!):

1 Like