From: "Douglas Bates" <bates at stat.wisc.edu>
To: "Tu Yu-Kang" <yukangtu at hotmail.com>
CC: r-sig-mixed-models at r-project.org
Subject: Re: [R] negative variances
Date: Thu, 12 Apr 2007 08:07:57 -0500
On 4/12/07, Tu Yu-Kang <yukangtu at hotmail.com> wrote:
Dear Prof Bates,
Many thanks for your email. I tried lmer() and received the
following
messages:
lm2<-lmer(ppd~month+(month|id))
Warning message:
Estimated variance-covariance for factor 'id' is singular
in: `LMEoptimize<-`(`*tmp*`, value = list(maxIter = 200,
tolerance =
1.49011611938477e-08,
I then tried lmer2():
lm3<-lmer2(ppd~month+(month|id))
summary(lm3)
Linear mixed-effects model fit by REML
AIC BIC logLik MLdeviance REMLdeviance
1146 1166 -567.9 1126 1136
Random effects:
Groups Name Variance Std.Dev. Corr
id (Intercept) 0.1566631 0.395807
month 0.0022331 0.047255 1.000
Residual 0.6391120 0.799445
Number of obs: 420, groups: id, 140
Fixed effects:
Estimate Std. Error t value
(Intercept) 6.43595 0.07017 91.72
month -0.36619 0.01642 -22.30
Correlation of Fixed Effects:
(Intr)
month -0.544
I'm a bit pressed for time right now so this will be brief. I
suggest
that you add the optional argument
control = list(msVerbose = TRUE)
to the calls to lmer and to lmer2 and look at the progress of the
iterations and also at the value of the deviance. I have seen
situations where lmer2 converges to a fit with a significantly
smaller
deviance than can lmer because it progresses through the
near-singular
region of the parameter space.
What was the deviance (or the log-likelihood) from the MLWin fit
that
gave negative variance components?
Did you plot the data as ppd versus month by id using xyplot from
the
lattice package? That should always be the first step in the
analysis
of longitudinal data.
However, I am not sure about the results, because MLwiN showed both
random
effects were negative values (-0.196 and -0.023).
I start to notice this problems of negative variances when I am
learning
how to use structural equation modeling software to run multilevel
models
for longitudinal data. To my great surprise, it occurs quite
frequently. In
SEM, this problem sometimes may be overcome by estimating a
nonlinear
model by freeing the factor loadings. For example, in this data,
PPD
(probing pocket depth) was measured three times at month 0, 3 and
6. I only
fixed the first and last factor loadings to be 0 and 6 to get a
non-linear
relation, and I also allow the level-1 residuals to be different on
each
occasion. However, in some data, I failed to get a satifactory
model no
matter how I modified my models.
I looked for the discussion in several multilevel modeling
textbooks but
only found one short discussion in the book by Brown and Prescott.
SEM
literature usually suggest fixing the negative variances to 0.
However, I
wander whether this is the only way to get around this problem or
the
sensible way because if the random effects are fixed to 0 the model
is no
longer a random effects model.
With best regards,
Yu-Kang