library(penalized) model1 <- glmer(categorical_FOD_FODs ~ 0 + Condition_FODs * Gender_FODs -1 + (1|subject_FODs), data = indvar_FODs, family = binomial, control = glmerControl(optimizer = 'bobyqa', optCtrl = list(method = 'nlminb', maxfun = 6000000)), penalty = L1(0.001)) # add L1 regularization with a small lambda value
In the function glm, the argument categorical_FOD_FODs is the dependent variable of the model, the argument data is the data frame of the independent variables, the argument family is the family of the dependent variable, the argument control is how the model is optimized, and the argument penalty is the method of regularization.