Thanks for these bug reports. It looks like that setx() is currently not
taking any sort of function when used with mi(). So things like "0:40" in
Steve's example and "quantile()" in Keith's example are yielding
errors.
We'll try to fix this bug as soon as we can.
Thanks for your patience,
Kosuke
On Thu, 10 Apr 2008, Keith Schnakenberg wrote:
I am doing simulations using Zelig with multiple
imputed datasets from
Amelia, and I get errors with setx for some of my simulations. The same setx
commands work without errors when I do not use Amelia. The relevant code and
errors are below:
#SUBSET FOR POOLED SAMPLE (FOR CALCULATING 20TH AND 80TH PERCENTILE IN SIMS)
sample=ssrl[ssrl$HFOR==1||ssrl$AFOR==1,] #In the setx command I set values
equal to the 20th and 80th percentile from this sample rather than the
subsetted sample I use in the model
#SUBSET SAMPLE
m1sample=subset(ssrl, subset=ssrl$HFOR==1, select= c(ENGLISH, TIME,PCTH2,
CONTACT, SEND, VISIT2, LIVED, MEXICAN, MALE, EDU, INCOME, AGE, WTSTRAT))
#IMPUTE MISSING DATA
mi1 <- amelia(data=m1sample, m=10, p2s=0, frontend=FALSE, idvars="WTSTRAT",
startvals=0, tolerance=0.0001, outname="m1outdata", write.out=TRUE)
m1.1 <- read.csv("m1outdata1.csv")
m1.2 <- read.csv("m1outdata2.csv")
m1.3 <- read.csv("m1outdata3.csv")
m1.4 <- read.csv("m1outdata4.csv")
m1.5 <- read.csv("m1outdata5.csv")
m1.6 <- read.csv("m1outdata6.csv")
m1.7 <- read.csv("m1outdata7.csv")
m1.8 <- read.csv("m1outdata8.csv")
m1.9 <- read.csv("m1outdata9.csv")
m1.10 <- read.csv("m1outdata10.csv")
#ESTIMATE MODEL
m1 <- zelig(ENGLISH ~ TIME + PCTH2 + CONTACT + SEND + VISIT2 + LIVED +
MEXICAN + MALE + EDU + INCOME + AGE, model="logit",
weights="WTSTRAT",
data=mi(m1.1, m1.2, m1.3, m1.4, m1.5, m1.6, m1.7, m1.8, m1.9, m1.10)) #if i
just use data=m1sample, all of the setx commands work with no errors#
m1.TIME.low <- setx(m1, fn= list(numeric=mean, ordered=median, others=mode),
TIME=quantile(sample$TIME, probs=.2, na.rm=T)) #the setx lines where i use
percentiles give me an error
m1.TIME.high <- setx(m1, fn= list(numeric=mean, ordered=median, others=mode),
TIME= quantile(sample$TIME, probs=.8, na.rm=T))
m1.SEND.low <- setx(m1, fn= list(numeric=mean, ordered=median, others=mode),
SEND=0) #the lines where i just set the values equal to 0 and 1 work fine
with no errors
m1.SEND.high <- setx(m1, fn= list(numeric=mean, ordered=median, others=mode),
SEND=1)
The errors I get are:
m1.TIME.low <- setx(m1, fn= list(numeric=mean,
ordered=median,
others=mode), TIME=quantile(sample$TIME, probs=.2, na.rm=T))
Error in eval(expr,
envir, enclos) :
..1 used in an incorrect context, no ... to look in
m1.TIME.high <- setx(m1, fn=
list(numeric=mean, ordered=median,
others=mode), TIME= quantile(sample$TIME, probs=.8, na.rm=T))
Error in eval(expr,
envir, enclos) :
..1 used in an incorrect context, no ... to look in
Thanks,
Keith Schnakenberg
San Diego State University
-
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: