Generation

code to explanationThu, 20 Apr 2023

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

we can add the L1(0.001) penalty to the glmer function in the R package penalized. The penalty is added to the log-likelihood function and is minimized along with the rest of the function

Questions about programming?Chat with your personal AI assistant