How can I specify a more complex data structure than a simple ID column?
If I have a glmertree model, how can I specify (e.g.) a cross classified model in the cluster covariance tests?
tree_1 <-
glmertree(
data = sim_dat,
formula =
performance ~ 1 + predictors |
(1 | student_id) + (1 | question_number) |
partitioning_variables,
family = 'binomial',
cluster = ???
)
Or how about in a simple nested design?
tree_2 <-
lmertree(
data = sim_dat,
formula =
test_score ~ 1 + predictors |
(1 | district/school) |
## equivalent to (1|school:district) + (1|district)
partitioning_variables,
cluster = ???
)
So far, I've fit models with cluster covariance tests on whatever level has the greatest variance in the outcome, but fitting the proper structure seems more appropriate if possible.
Thanks!