R: How to fit a GLMM in nlme I want to compare lme4 and nlme packages for my data. But I'm confused by how to use syntax in nlme. I'm working with Mixed-Effects Models in S and S-Plus (Pinheiro, Bates 2000) and the current Version of the documentation Package 'nlme' (04/07/2018)
I tried to use groupedData() as well as nlsList() and SSlogis(), to fit my model. 
For lme4 I can fit my models wihtout any trouble. Can you tell me, how to fit these models from lme4 in nlme?
My data has easy structure:
$y$ is a binary outcome in $\{0,1\}$, $x$ is continuous, $group$ is categorical grouping factor ($N$ different groups)
model1 <- glmer(y ~     (1 | group),       data = data , family = binomial(link="logit"))
model2 <- glmer(y ~ 1 + (x | group),       data = data , family = binomial(link="logit"))
model3 <- glmer(y ~     (x | group) group, data = data , family = binomial(link="logit"))
model4 <- glmer(y ~ x + (1 | group),       data = data , family = binomial(link="logit"))

 A: I don't think nlme can be used to fit a mixed effects logistic regression model. However, you have plenty of other options available for this task via packages such as the ones listed below, whose use is illustrated for your model 4.
GLMMadaptive
install.packages("GLMMadaptive")

library(GLMMadaptive)

model4 <- mixed_model(fixed = y ~ x, random = ~ 1 | group, 
               data = data,
               family = binomial(link="logit"))

See https://cran.r-project.org/web/packages/GLMMadaptive/vignettes/GLMMadaptive_basics.html. 
glmmTMB
install.packages("glmmTMB")

library(glmmTMB)

model4 <- glmmTMB(y ~ x + (1 | group),
                data = data, 
                family = binomial(link = "logit"))

See https://cran.r-project.org/web/packages/sjPlot/vignettes/tab_mixed.html. 
MASS
install.packages("MASS")

library(MASS)


model4 <- glmmPQL(fixed =  y ~ x, 
                random = ~ 1 | group,
                data = data, 
                family = binomial(link="logit"))

See https://quantdev.ssri.psu.edu/sites/qdev/files/ILD_Ch04_2017_GeneralizedMLM.html. 
brms
install.packages("brms")

library(brms)

model4 <- brm(y ~ x + (1|group), 
              data = data, 
              family=binomial(link="logit"))

See https://bayesat.github.io/lund2018/slides/andrey_anikin_slides.pdf and What would be a Bayesian equivalent of this mixed-effects logistic regression model, for example.
The brms package fits mixed effects models using a Bayesian framework; the other packages suggested here fit mixed effects models using a frequentist framework.
