Hello! I am familiar with rstan and brms, but less so with zero-one inflated beta (zoib) models so the misunderstanding of this question might come from there.
I have found that I can run a univariate and multivariate zoib, great! However, I am running into an error when i try to estimate the phi, zoi, and coi parameters in the multivariate model. Any thoughts or tips would be appreciated!
This first block of code creates a toy data set, declares the univariate zoib formula and runs the model succesfully in brms
library(brms)
library(cmdstanr)
df = data.frame(y = c(0, 1,1,1, 0, 1),
y2 = c(1, 0, 0, 0, 1, 0),
x = c(1.9, 3.8, 3.0, 4.0, 2.0, 3.7),
group = c(0, 0, 1, 1, 1, 0),
person = c(1,2,3,4,5, 6))
#univariate zoib
zoib_uni_model <- bf(
y ~ x + group + (1|person),
phi ~ x + group + (1|person),
zoi ~ x + group + (1|person),
coi ~ x + group + (1|person)
)
fit_uni = brm(
zoib_uni_model,
data = df,
cores = 4,
iter = 100,
chains = 1,
seed = 1,
family = zero_one_inflated_beta(),
backend = "cmdstanr")
)
To run the multivariate zoib succesfully I can use the following formula and call to brms
zoib_mv_model1 <- mvbf(
y ~ x + group + (1|person),
y2 ~ x + group + (1|person)
fit_mv = brm(
zoib_mv_model1,
data = df,
cores = 4,
iter = 100,
chains = 1,
seed = 1,
family = zero_one_inflated_beta(),
backend = "cmdstanr")
**However, if i add back in the model specific parameters and run the following model I get the following error message: **
Error: The following variables can neither be found in 'data' nor in 'data2':
'phi', 'zoi', 'coi'
MVBF model with model specific parameters
#multivariate zoib
zoib_mv_model 2<- mvbf(
y ~ x + group + (1|person),
y2 ~ x + group + (1|person),
phi ~ x + group + (1|person),
zoi ~ x + group + (1|person),
coi ~ x + group + (1|person))
fit_mv = brm(
zoib_mv_model2,
data = df,
cores = 4,
iter = 100,
chains = 1,
seed = 1,
family = zero_one_inflated_beta(),
backend = "cmdstanr")