Description
Question 1:
On the course notes, the glmer() in the lme4 package is reviewed as a means to fitting
generalized linear mixed models. In this question you are going to create your own function in R
to fit a logistic random intercepts GLMM for binary response data, using Gauss-Hermite
quadrature. Your function should have the same inputs as those given in slide 367, with the
exception of the ‘family’ input. Together with the primary function for fitting the model, create
print method that outputs the results in a way that is similar to the output from the summary
method for glmer(). As part of this output include, at least, a title for the fit, information on the
overall fit (i.e. the maximized log-likelihood), results regarding the variance components and results
regarding the fixed effects. Finally, apply the function to the ICHS data specifically to replicate
the results presented on slide 369 of the notes. As you hand in your solution, send your code to
the TAs. Please make sure to clean and annotate your code in a way that makes it easy for the
TAs (or any reader) to understand the various steps.
Question 2 (optional):
In collaborative settings in which the data are either cluster-correlated or longitudinal, a very
common question is whether one should proceed using a marginal model, with estimation/inference
via GEE, or with a GLMM with likelihood-based estimation inference. In this question you are
going to consider a series of questions that can help guide those decisions. For each of the following,
create a series of bullet points that could be folded into a talk that you give on the topic or into a
set of slides that you could use with your collaborator:
Q: Features shared by both frameworks?
Q: Reasons to use marginal models?
Q: Reasons not to use marginal models?
Q: Reasons to use mixed models?
Q: Reasons not to use mixed models?