Dear James,
Thanks for pointing this out. It's a complicated package, and per
Gary's email of a few days ago, we've been making a lot of changes to
get ready for the release of Zelig 3.0-1. It looks like someone made
a couple changes in Zelig 3.0-1 that affected how multiply imputed
data were handled in the zelig() function.
Users who use the install.packages() command to update or install
Zelig automatically install the latest version _available for their
version of R_ from CRAN. For R > 2.5.0 users, this is Zelig 3.0-1 or
Zelig 2.8-5 -- both contain the bug that James identified below. For
R 2.4.1 users, however, this is Zelig 2.8-3, which does not contain
the bug below. Thus, users who have R 2.4.1 don't get the bug, but
users who have R > 2.5.0 do. To figure out which version of Zelig you
have installed, start R and type:
packageDescription("Zelig")
The version number should be one of the first things you see.
As a temporary fix for those who need to use multiply imputed data, I
suggest downloading Zelig 2.8-3 manually and installing it manually.
You may download Zelig 2.8-3 manually from the following locations
windows:
http://cran.stat.ucla.edu/bin/windows/contrib/2.4/Zelig_2.8-3.zip
, or
linux + MacOSX:
http://gking.harvard.edu/src/contrib/Zelig_2.8-3.tar.gz .
Manual installation consists of installing it either using the local
zip installation menu option in windows R, or using R CMD INSTALL at
the command line in linux and MacOSX. Note that using
install.packages() from within R will download and install the wrong
version for R 2.5 > users.
If you'd like to verify that it works, do the following after
downloading and installing Zelig 2.8-3. Start R and type:
library(Zelig)
demo(mi) ## let the demo run
z.out[[1]]
z.out[[2]]
## The point estimates for z.out[[1]] and z.out[[2]] will be different,
## with the estimates for z.out[[1]] corresponding to the first imputed
## data set and the estimates from z.out[[2]] to the second.
Look for a patched release in the next couple days, and thanks again
for finding the bug.
Yours,
Olivia Lau
On 8/3/07, James Honaker <tercer(a)ucla.edu> wrote:
Dear zeligites, zeligistas? (is there a term of art?)
I ran across curious behaviour in the mi() function in the newest version
of R. I wrote a short code snippet below to demonstrate what is
happening.
Everything works fine in R 2.4.1, but in R 2.5.1, if you have m imputed
datasets, zelig seems to repeatedly estimate the model m times in the
first dataset, rather than moving through them. Thus the combined results
are simply the results from the first imputed dataset.
Again, everything looks fine in R 2.4.1, but fails in R 2.5.1 (these
things seem to crop up every new version).
If it's worth anything, it doesn't appear to be the mi() function itself,
but how zelig handles this object as an argument.
regards,
james.
# test of the mi() function in zelig
# jH, Aug 2, 2007
library(Zelig)
beta1<- -2:2 # This is a set of true coefficients
# Averaging over them should give beta1=0
n<-1000
testdat<-as.list(0)
for(i in 1:length(beta1)){ # Construct datasets
x<-runif(n)
y<-beta1[i]*x + rnorm(n)
testdat[[i]]<-as.data.frame(cbind(y,x))
}
mi.object<-mi(testdat[[1]],testdat[[2]],testdat[[3]],testdat[[4]],testdat[[5]])
output<-zelig(y~x,model="ls",data=mi.object)
print(summary(output)) # should give coefficient on x of 0, not -2.
# This seems to be five copies of the result from the first dataset in R
v2.5.1
# But works just fine in R v2.4.1
print(summary(output), subset=1:5)
-
Zelig Mailing List, served by Harvard-MIT Data Center
Send messages: zelig(a)lists.gking.harvard.edu
[un]subscribe Options:
http://lists.gking.harvard.edu/?info=zelig
Zelig program information:
http://gking.harvard.edu/zelig/
-
Zelig Mailing List, served by Harvard-MIT Data Center
Send messages: zelig(a)lists.gking.harvard.edu
[un]subscribe Options:
http://lists.gking.harvard.edu/?info=zelig
Zelig program information:
http://gking.harvard.edu/zelig/