[R-sig-ME] Very small random effect estimation in lmer but not in stata xtmixed

Ben Bolker bbolker at gmail.com
Fri May 4 16:17:42 CEST 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12-05-04 09:46 AM, Joerg Luedicke wrote:
> Ben,
> 
> OP initially posted his problem over at the R-help forum:
> 
> https://stat.ethz.ch/pipermail/r-help/2012-May/311685.html
> 
> and so there was some discussion already.
> 
> Mohammed sent me his data off-list and there does not seem to be a 
> problem with his data, as far as I can see. The problem rather
> seems to be that lmer has some difficulties with estimating the
> variance parameter for varying intercepts when the sample size is
> small and the lower level variance is high relative to the group
> level variance. Please see my following post from the R-help
> forum:
> 
> https://stat.ethz.ch/pipermail/r-help/2012-May/311766.html
> 
> Any thoughts on this?
> 
> Joerg

  I've just tried this out with nlme and development lme4, and both of
those do fine, so it seems (urgh) to be a problem with stable lme4 ...

(Code below assumes that the stable lme4 version is installed from
r-forge, where it is known as lme4.0; lme4 is the r-forge
(development) version ...)

  At the moment I would suggest going either backward to nlme or
forward to development lme4 (GLMMs in development lme4 are quite
unstable at the moment, and there may be some internal changes, but
LMMs should be quite stable).


> 
dat <- na.omit(read.csv("lmmTest.csv"))
library(nlme)
lme(AnxietyScore~cc,random=~1|SetID,data=dat)
detach("package:nlme")
library(lme4.0)
lmer(AnxietyScore~cc+(1|SetID),data=dat)
detach("package:lme4.0")
library(lme4)
(fm1 <- lmer(AnxietyScore~cc+(1|SetID),data=dat))
fmFun <- update(fm1,devFunOnly=TRUE)
getME(fm1,"theta")
thetavec <- seq(0,0.5,length=101)
dvec <- sapply(thetavec,fmFun)
plot(thetavec,dvec,type="l")
xyplot(profile(fm1))
detach("package:lme4")



> On Fri, May 4, 2012 at 5:39 AM, Ben Bolker <bbolker at gmail.com>
> wrote:
>> Mohammed Mohammed <M.A.MOHAMMED at ...> writes:
>> 
>> 
>>> I am using the lmer function (in the lme4 library) to analyse
>>> some data where individuals are clustered into sets (using the
>>> SetID variable) with a single fixed effect (cc - 0 or 1). The
>>> lmer model and output is shown below.
>> 
>> 
>> 
>>> Whilst the fixed effects are consistent with stata (using
>>> xtmixed, see below), the std dev of the random effect for SetID
>>> is very very small (3.5803e-05)compared to stata's (see below
>>> 1.002). Any ideas why this should be happening please....?
>> 
>>> I am happy to share my data if that helps.
>>> 
>> 
>> Nothing really obvious pops out.  Have you tried nlme (i.e
>> library(nlme); lme(AnxietyScore ~cc, random=~1|SetID,data=mydf)) 
>> as a cross-check?
>> 
>> Can you send/post data?
>> 
>> Ben Bolker
>> 
>> _______________________________________________ 
>> R-sig-mixed-models at r-project.org mailing list 
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPo+UGAAoJED2whTVMEyK9aTsH/jO6aGVbgryPvIZniOYSn4be
QtRac5qpS8fFSzRpIKFx5BhfnaeL6huGb9OK9xQkg8/M0YreMskO7g8PNY69SymW
yAhoSmuMhOfC2HFRLI5ii2TPg5mECL0UMPu393kj18YwUhvFklv5R+zCNmQQQIrC
7zfr1Qd33+qTNMM6VTtMp3lj96PrUEsllMzqcayP9MrkZaAfl5qmMcuBQZKLwTUX
T7xcHPsuZqjOuM1JgaZSWxygZkQg9PnzS3Q1f8+HtdNXd38bWA0jqnJmtHj0bvjp
tpocBAn6JnUrcpZsvLt7mneAh/0C8mVBtMXoouUOmSPSZCvJfHZeYvX7GSlteIw=
=JWCc
-----END PGP SIGNATURE-----



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