Just a quick question:
Suppose I have a multivariate model (to keep it really simple)
\begin{align}
y_1 &\sim \text{Poisson}(\exp(a + b)) \\
y_2 &\sim \text{Poisson}(\exp(a)),
\end{align}
where both a and b are parameters. How can I restrict a to be the same across equations?
In brms I think I can do (for y_1)
priors1 <- prior(normal(0, 0.25), nlpar = "a") +
prior(normal(0.7, 0.25), nlpar = "b")
bf1 <- bf(y1 ~ a + b, a + b ~ 1, nl = TRUE) + poisson(link = "log")
mod1 <- brm(bf1, data = data, prior = priors1)
and for y_2:
priors2 <- prior(normal(0, 0.25), nlpar = "a")
bf2 <- bf(y2 ~ a, a ~ 1, nl = TRUE) + poisson(link = "log")
mod2 <- brm(bf2, data = data, prior = priors2)
However, I kinda want to do:
priors <- prior(normal(0, 0.25), nlpar = "a") +
prior(normal(0.7, 0.25), nlpar = "b")
bf1 <- bf(y1 ~ a + b, a + b ~ 1, nl = TRUE) + poisson(link = "log")
bf2 <- bf(y2 ~ a, a ~ 1, nl = TRUE) + poisson(link = "log")
mod <- brm(bf1 + bf2 + set_rescor(FALSE), data = data, prior = priors1)
Where a is the same parameter across equations. Is that possible?
I guess I have to somehow set resp
in the prior
function?
In Stan code this’d be something like
...
parameters{
real a;
real b;
}
model{
y1 ~ poisson_log(a + b);
y2 ~ poisson_log(a);
}