[R-sig-ME] problem fitting a mixed model due to between subjectvariation

David Duffy davidD at qimr.edu.au
Wed Jul 28 01:04:26 CEST 2010


On Tue, 27 Jul 2010, R.Donders at ebh.umcn.nl wrote:

> Dear all,
>
> I have a problem with an mixed analysis. All though residual plots and a
> fixed analysis suggest that (at least)
> a random intercept should be incorporated in the model, I keep getting a
> zero variance (or almost zero variance) for the random intercept,
> I guess because of the huge between subject differences.
>
> summary(m2)

The random slopes model looks like:

> summary(m2)
Linear mixed model fit by REML
Formula: outcome ~ pred + (pred | subject)
    Data: strangedat
    AIC   BIC logLik deviance REMLdev
  781.4 805.6 -384.7      759   769.4
Random effects:
  Groups   Name        Variance Std.Dev. Corr
  subject  (Intercept) 0.095927 0.30972
           pred        0.015808 0.12573  -1.000
  Residual             0.340696 0.58369
Number of obs: 417, groups: subject, 80

Fixed effects:
             Estimate Std. Error t value
(Intercept)  0.31775    0.07503   4.235
pred         0.85699    0.02806  30.537

Correlation of Fixed Effects:
      (Intr)
pred -0.901

The random intercepts model gave:
  AIC   BIC logLik deviance REMLdev
  783 799.2 -387.5      764     775

It looks to me that the largest clusters tend to run horizontally wrt 
pred, that is across the strong between-clusters line of identity.

with(strangedat, plot(outcome ~ pred, col=as.integer(subject)))
z1 <- by(strangedat, strangedat$subject, mean)
z2 <- matrix(unlist(z1),nc=3,byrow=T)
z3 <- as.data.frame(z2[,-1])
names(z3) <- c("outcome","pred")
points(outcome ~ pred, data=z3, pch=15)

t1 <-  table(strangedat$subject)
sss <- split(strangedat, strangedat$subject)
library(locfit)
for(s in rownames(t1)[t1==6]) lines(locfit(outcome ~ pred, alpha=3, 
data=sss[[s]]))

This wasn't your homework, was it? ;)

Cheers, David Duffy.
-- 
| David Duffy (MBBS PhD)                                         ,-_|\
| email: davidD at qimr.edu.au  ph: INT+61+7+3362-0217 fax: -0101  /     *
| Epidemiology Unit, Queensland Institute of Medical Research   \_,-._/
| 300 Herston Rd, Brisbane, Queensland 4029, Australia  GPG 4D0B994A v




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