[R-sig-ME] a problem with lme4_0.999375-0?
vito muggeo
vmuggeo at dssm.unipa.it
Thu Jan 17 12:39:35 CET 2008
Dear all,
I'm running data from "Gelman&Hill Data Analysis Using regression..
pag259-261" (you can get data by running the code below). In particular
I'm interested in getting variances of the predictions of the random
intercepts. I get "right" (as compared with those from the book) results
using lme 0.99875-9 (downloaded from CRAN).
However using the latest lme4_0.999375-0 obtained via
install.packages("lme4", repos = "http://r-forge.r-project.org")
the variances of the predictions are wrong..(they are constant
regardless of different cluster sizes. You can check this running the
code below..
Many thanks,
vito
srrs2 <-
read.table("http://www.stat.columbia.edu/~gelman/arm/examples/radon/srrs2.dat",
header=T, sep=",")
mn <- srrs2$state=="MN"
radon <- srrs2$activity[mn]
log.radon <- log (ifelse (radon==0, .1, radon))
floor <- srrs2$floor[mn] # 0 for basement, 1 for first floor
n <- length(radon)
y <- log.radon
x <- floor
# get county index variable
county.name <- as.vector(srrs2$county[mn])
uniq <- unique(county.name)
J <- length(uniq)
county <- rep (NA, J)
for (i in 1:J){
county[county.name==uniq[i]] <- i
}
library(arm)
M1<-lmer(y~1+x+(1|county))
ranef(M1)[[1]][1:10,] #OK
se.ranef(M1)[[1]][1:10,] #wrong results: they are constant!!!??!!!
> sessionInfo()
R version 2.6.1 (2007-11-26)
i386-pc-mingw32
locale:
LC_COLLATE=Italian_Italy.1252;LC_CTYPE=Italian_Italy.1252;LC_MONETARY=Italian_Italy.1252;LC_NUMERIC=C;LC_TIME=Italian_Italy.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] foreign_0.8-23 car_1.2-7 arm_1.1-1
R2WinBUGS_2.1-6 coda_0.13-1 lme4_0.999375-0 Matrix_0.999375-4
lattice_0.17-2
[9] MASS_7.2-38
loaded via a namespace (and not attached):
[1] grid_2.6.1
--
====================================
Vito M.R. Muggeo
Dip.to Sc Statist e Matem `Vianelli'
Università di Palermo
viale delle Scienze, edificio 13
90128 Palermo - ITALY
tel: 091 6626240
fax: 091 485726/485612
More information about the R-sig-mixed-models
mailing list