# Mixed response model ------------------------------------------------------
# The mresp dataset contains a mix of binomial and Gaussian responses.
# We need to estimate a factor loading which scales the two response types.
loading_matrix <- matrix(c(1, NA), ncol = 1)
# Define mapping to families.
families <- gfam(list(gaussian, binomial))
# Fit the model
mod <- galamm(
formula = y ~ x + (0 + level | id),
data = mresp,
family = families,
factor = "level",
load_var = "itemgroup",
lambda = loading_matrix
)
# Formula
formula(mod)
Run the code above in your browser using DataLab