I’m having trouble fitting a multivariate model using stan_mvmer
.
I’m trying to fit two different GLMs, which I assume are correlated. The response variables y_1,y_2
are count vectors, with integer exposures n_1,n_2
.
Following this vignette, I’ve defined rates rate_i <- y_i/n_i
and want to use the weights
parameter to account for the different exposures. I tried:
f <- stan_mvmer(
formula = list(
rate_1 ~ feature_2 + feature_3 + (1|feature_1),
rate_2 ~ feature_2 + feature_4 + (1|feature_1)),
data = df,
family = list(binomial, binomial),
weights = list(df$n_1,df$n_2),
chains = 1, seed = 12345, iter = 1000)
But when I ran this command, I got nothing; when I commented the weights statement, the model was fitted (but the results were quite meaningless, since the exposures were ignored)
EDIT: I’ve tried using the cbind(y_i,n_i-y_i)
syntax and got the following error message:
Error: All outcome values must be 0 or 1 for Bernoulli models.
- Operating System: Windows
- rstanarm Version: 2.18.2