

Time = c ( replicate ( n, c ( 0, sort ( runif ( K - 1, 0, t_max ) ) ) ) ), Set.seed ( 1234 ) n <- 100 # number of subjects K <- 8 # number of measurements per subject t_max <- 5 # maximum follow-up time # we construct a data frame with the design: # everyone has a baseline measurement, and then measurements at random follow-up times DF <- ame (id = rep ( seq_len ( n ), each = K ), Here we provide three examples to illustrate how such models can be fitted.

In addition, in the specification of the family object, and in order to better facilitate the internal computations, the user may specify the function score_eta_zi_fun that calculates the derivative of the log probability density function or the log probability mass function with respect to eta_zi that denotes the linear predictor of the logistic regression for the zero part. We should note that the user has the option to leave zi_random set to NULL, in which case for the zero-part we have a logistic regression with only fixed effects and no random effects. In these arguments, the user can specify the fixed and random effects formulas of the logistic regression for the zero-part of the distribution of the outcome. For both types of models, a suitable family object needs to be specified as outlined in vignette("Custom_Models", package = "GLMMadaptive"), and also arguments zi_fixed and zi_random of mixed_model() come into play. Function mixed_model() of GLMMadaptive can also be used to fit zero-inflated and two-part mixed effects models.
