[R-sig-ME] fixed effect testing again (but different)
Alan Cobo-Lewis
alanc at umit.maine.edu
Sat Aug 30 06:38:27 CEST 2008
Doug,
Couldn't heteroscedastic-by-group random effects be handled by the coding discussed by David Afshartous, you, and me in July 2007? David described what kind of heteroscedasticity he was looking for at
https://stat.ethz.ch/pipermail/r-sig-mixed-models/2007q3/000235.html and we worked through it at the thread beginning at https://stat.ethz.ch/pipermail/r-sig-mixed-models/2007q3/000237.html
David summarizes the outcome of the thread at https://stat.ethz.ch/pipermail/r-sig-mixed-models/2007q3/000248.html
alan
r-sig-mixed-models at r-project.org on Friday, August 29, 2008 at 3:51 PM -0500 wrote:
>Message: 5
>Date: Fri, 29 Aug 2008 13:30:59 -0500
>From: "Douglas Bates" <bates at stat.wisc.edu>
>Subject: Re: [R-sig-ME] fixed effect testing again (but different)
>To: "Daniel Ezra Johnson" <danielezrajohnson at gmail.com>
>Cc: r-sig-mixed-models at r-project.org
>Message-ID:
> <40e66e0b0808291130t351cf1b7nf33579129ce5fbc3 at mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>On Fri, Aug 29, 2008 at 1:09 PM, Daniel Ezra Johnson
><danielezrajohnson at gmail.com> wrote:
>>>> If it seems wrong to take the parameter from m1, is there some way to
>>>> change the specification of m0 so as to obtain a separate random
>>>> effect for males and females? I've seen that done but I've forgotten
>>>> how to do it.
>>>>
>>>> If I can run something like
>>>>
>>>> m00 <- lmer(response~(1|subject-females)+(1|subject-males),data) #
>>>> how is this specified?
>>
>> Off list I was shown a way to supposedly do this, by making a pseudo
>> random slope using a dummy variable. It seems promising but it doesn't
>> really work properly, as the following example shows.
>>
>> set.seed(1)
>> s <- rep(rnorm(200,0,1),each=100)
>> g <- rep(c(-3,3),each=10000)
>> p <- inv.logit(s+g)
>> obs <- data.frame(response=rbinom(20000,1,p),
>> gender=rep(c("M","F"),each=10000),
>> subject=rep(paste("S",1:200,sep=""),each=100))
>> obs$M <- ifelse(obs$gender=="M",1,0)
>> obs$F <- ifelse(obs$gender=="F",1,0)
>>
>> test <- lmer(response~(0+M|subject)+(0+F|subject),obs,binomial)
>>
>> Random effects:
>> Groups Name Variance Std.Dev.
>> subject M 0.82563 0.90864 # out of whack
>> subject F 37.79488 6.14775 # out of whack
>> Number of obs: 20000, groups: subject, 200
>>
>> obs.m <- obs[obs$gender=="M",]
>> test.m <- lmer(response~(1|subject),obs.m,binomial)
>>
>> Random effects:
>> Groups Name Variance Std.Dev.
>> subject (Intercept) 0.85413 0.9242
>> Number of obs: 10000, groups: subject, 100
>>
>> obs.f <- obs[obs$gender=="F",]
>> test.f <- lmer(response~(1|subject),obs.f,binomial)
>>
>> Random effects:
>> Groups Name Variance Std.Dev.
>> subject (Intercept) 0.60097 0.77522
>> Number of obs: 10000, groups: subject, 100
>>
>> Is there, then, any way to implement heteroscedastic-by-group random
>> effects in lme4, as opposed to nlme?
>
>At present, no - at least none that I know of (and I am usually
>reasonably well informed regarding the capabilities of lme4).
>
>I am currently working on abstracting the role of the parameters in
>model-fitting within lme4 by redesigning the classes. The current
>design ties the parameters to a particular representation of the
>relative covariance matrix of the random effects and it should be
>generalized. The trick is to generalize the approach without
>sacrificing too much in the way of performance.
--
Alan B. Cobo-Lewis, Ph.D. (207) 581-3840 tel
Department of Psychology (207) 581-6128 fax
University of Maine
Orono, ME 04469-5742 alanc at maine.edu
http://www.umaine.edu/visualperception
More information about the R-sig-mixed-models
mailing list