Skip to content

R - specify estimated residual variance

1 message · Douglas Bates

#
---------- Forwarded message ----------
From: Douglas Bates <bates at stat.wisc.edu>
Date: Fri, Apr 4, 2008 at 7:38 AM
Subject: Re: R - specify estimated residual variance
To: Kelly Wauters <Kelly.wauters at kuleuven-kortrijk.be>


On Fri, Apr 4, 2008 at 7:11 AM, Kelly Wauters
<Kelly.wauters at kuleuven-kortrijk.be> wrote:
> Dear Prof. dr. Bates,

 >  I want to use lmer to fit a glmm with a dichotomous dependent variable
 >  (family binomial - link logit). The scores on the lowest level follow a
 >  binomial distribution. This indicates that the variance of the lowest
 >  level is defined by the estimated residual variance multiplied by
 >  pi(1-pi). This means that the estimated residual variance has to be
 >  equal to 1. In SAS you can do this by means of the code

 >  proc glimmix data= dichotoom noclprint noitprint asycov ;
 >  class school id item;
 >  PARMS 0.34 1/HOLD=2;
 >  model scores=/ dist=binomial solution;
 >  random intercept/ subject=id;
 >  random _residual_;
 >  run;

 >  How can I translate the code into R code?

 > > dichloso$school<-as.factor(dichloso$school)
 > > dichloso$id<-as.factor(dichloso$id)
 > > dichloso$item<-as.factor(dichloso$item)

 Transforming those variables to factors is a good practice but not
 strictly necessary to fit the model shown below.


 > > model <- lmer(scores~1+(1|id), dichotoom,
family=binomial(link="logit"),...)

 >  I don't know how I can translate the code PARMS 0.34 1/HOLD=2; into R
I'm afraid I can't help you on this because I don't know what the SAS
 code does.  I don't use SAS myself.

 It is possible that there is no need to specify this parameter in R as
 having a constant value.  My guess, but this is just a guess, is that
 the distinction between holding that parameter constant at 1 and
 allowing it to vary is equivalent to using the binomial family or the
 quasibinomial family in lmer.

 May I send a copy of this reply to the
 R-SIG-Mixed-Models at r-project.org mailing list? ("SIG" == "Special
 Interest Group")? (I ask your permission to send the copy because I am
 quoting your original question.)   Some who subscribe to that mailing
 list may have experience with SAS PROC GLIMMIX and be able to describe
 the equivalent code for lmer.