I am trying to build a model where the response is a proportion (it is actually the share of votes a party gets in constituencies). Its distribution is not normal, so I decided to model it with a beta distribution. I also have several predictors.
However, I don't know how to write it in BUGS/JAGS/STAN (JAGS would be my best choice, but it doesn't really matter). My problem is that I make a sum of parameters by predictors, but then what can I do with it?
The code would be something like this (in JAGS syntax), but I don' know how to "link" the y_hat
and y
parameters.
for (i in 1:n) {
y[i] ~ dbeta(alpha, beta)
y_hat[i] <- a + b * x[i]
}
(y_hat
is just the cross-product of parameters and predictors, hence the deterministic relationship. a
and b
are the coefficients which I try to estimate, x
being a predictor).
Thanks for your suggestions!