[R-sig-ME] lmer residuals

Iasonas Lamprianou lamprianou at yahoo.com
Wed Sep 19 08:41:45 CEST 2007

Dear friends, 
I know (already discussed this with Prof Bates) that  lmer and lmer2 cannot estimate residuals or predicted values when family=binomial. Can anyone give me an idea of how to estimate predicted values, and then compute the residuals in another way? Can anyone give me some code (even if it needs some modifications) in order to generate predicted values, and then compute the residuals? 


Dr. Iasonas Lamprianou
Department of Education
The University of Manchester
Oxford Road, Manchester M13 9PL, UK
Tel. 0044 161 275 3485
iasonas.lamprianou at manchester.ac.uk

----- Original Message ----
From: "r-sig-mixed-models-request at r-project.org" <r-sig-mixed-models-request at r-project.org>
To: r-sig-mixed-models at r-project.org
Sent: Tuesday, 18 September, 2007 1:00:01 PM
Subject: R-sig-mixed-models Digest, Vol 9, Issue 22

Send R-sig-mixed-models mailing list submissions to
    r-sig-mixed-models at r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to
    r-sig-mixed-models-request at r-project.org

You can reach the person managing the list at
    r-sig-mixed-models-owner at r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-sig-mixed-models digest..."

Today's Topics:

   1. Re: how to estimate R- and G-side random effects of GLMM    in R
      (Douglas Bates)


Message: 1
Date: Mon, 17 Sep 2007 07:57:05 -0500
From: "Douglas Bates" <bates at stat.wisc.edu>
Subject: Re: [R-sig-ME] how to estimate R- and G-side random effects
    of GLMM    in R
To: "ts p" <pts007 at hotmail.com>
Cc: r-sig-mixed-models at r-project.org
    <40e66e0b0709170557r6fe1e023x9a822ec7b2220783 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On 9/16/07, ts p <pts007 at hotmail.com> wrote:
> Hello, everyone,
> I am not very familiar to use R.
> I used SAS Proc GLIMMIX to estimate R- and G-side random effects of
> generalized linear mixed models. But the procedure can just use PQL or MQL.
> Now I want to lmer function in R to estimate GLMM because it can use Laplace
> approximation. It is more precise than PQL or MQL. But I read the manual of
> lmer. I did not find the information how to write a covariance structure in
> the function and how the function can know the struction is for R- or G-side
> random effects.
> For example, if I use the following SAS proc GLIMMIX code to estimate a
> model, I wonder who can tell me how to use lmer to write R code to estimate
> the same model.
> proc glimmix ;
>     class person group item;
>     model score(event='1')=item group /noint dist=binary link=logit s;
>     random _residual_ / sub=person type=cs ;
> run;

I am not fluent in SAS but I believe the model that you want to fit would be

lmer(score ~ item + group + (1|person), <dataSetName>, family = binomial)

assuming that score, item, person and group are stored as factors and
that score has only two levels.  If not you should dichotomize score
before fitting the model.

Others may be better able to decide what model the SAS code would fit.
I have difficulty with this because, for example, I can't see what
the compound symmetry structure is supposed to mean.  There certainly
isn't a compound symmetry structure on either the marginal or the
conditional distribution of the response given the random effects,
because the variance of a binomial depends on the mean.  Specifying an
R matrix independently of the linear predictor doesn't make sense to


R-sig-mixed-models mailing list
R-sig-mixed-models at r-project.org

End of R-sig-mixed-models Digest, Vol 9, Issue 22

Yahoo! Answers - Got a question? Someone out there knows the answer. Try it

More information about the R-sig-mixed-models mailing list