# \donttest{
## load artificial example data
data("DepressionDemo", package = "glmertree")
## fit LMM tree with local fixed effects only
lt <- lmertree(depression ~ treatment + age | cluster | anxiety + duration,
data = DepressionDemo)
coef(lt)
## fit LMM tree including both local and global fixed effect
lt <- lmertree(depression ~ treatment | (age + (1|cluster)) | anxiety + duration,
data = DepressionDemo)
coef(lt, which = "tree") # default behaviour
coef(lt, which = "global")
## fit GLMM tree with local fixed effects only
gt <- glmertree(depression_bin ~ treatment | cluster |
age + anxiety + duration, data = DepressionDemo)
coef(gt)
## fit GLMM tree including both local and global fixed effect
gt <- glmertree(depression_bin ~ treatment | (age + (1|cluster)) |
anxiety + duration, data = DepressionDemo)
coef(gt, which = "tree") # default behaviour
coef(gt, which = "global")
# }
Run the code above in your browser using DataLab