Rogério,
I've now fixed this in the Zelig 4.2-2 Beta. I believe I've also rooted out any
other instance of this general issue in the Zelig base package, and will look in the added
modules shortly. You can install this as:
install.packages("Zelig", repos="http://r.iq.harvard.edu",
type="source")
Thanks for pointing this out, and for the useful code example,
James.
--
James Honaker, Senior Research Scientist
//// Institute for Quantitative Social Science, Harvard University
________________________________
From: Rogério Barbosa [antrologos(a)gmail.com]
Sent: Thursday, October 03, 2013 11:42 AM
To: Honaker, James
Cc: Laura Crothers; zelig(a)lists.gking.harvard.edu
Subject: Re: [zelig] plot.ci not working for Poisson GEE
Hi James,
I'm having the same problem with "logit.survey". Common logit works fine.
All my packages are updated (I'm using Zelig 4.2-2, ZeligChoice 0.8-1, R 3.0.2 -- and
dependencies are also updated: survey version is 3.29-5)
The error message is "In simulation.matrix.sim(obj[[label]], which = which,
..."
It occurs when one tries to plot simulation results for both x and x1 -- and specifically
when the quantity of interest is "ev"; the plot for "fd" works fine as
well.
thanks,
Rogério
data(turnout)
turnout$weight = log(1:nrow(turnout)) + 100
age.range <- 18:95
##############################
z.out <- zelig(vote ~ race + educate + age + I(age^2) + income, model =
"logit", data = turnout)
x.low <- setx(z.out, educate = 12, age = age.range)
x.high <- setx(z.out, educate = 16, age = age.range)
s.out <- sim(z.out, x = x.low, x1 = x.high)
plot.ci<http://plot.ci>(s.out, qi="ev", ylim=c(0,1)) #works fine
##############################
z.out <- zelig(vote ~ race + educate + age + I(age^2) + income, model =
"logit.survey", weights=~weight, data = turnout)
x.low <- setx(z.out, educate = 12, age = age.range)
x.high <- setx(z.out, educate = 16, age = age.range)
s.out <- sim(z.out, x = x.low, x1 = x.high)
plot.ci<http://plot.ci>(s.out, qi="ev", ylim=c(0,1)) #doesn't work
On Mon, Sep 23, 2013 at 3:23 PM, Honaker, James
<jhonaker@iq.harvard.edu<mailto:jhonaker@iq.harvard.edu>> wrote:
Laura,
Thanks for bringing this to our attention. I've fixed this in the current Beta
(4.2-2). You can install this as:
install.packages("Zelig", repos="http://r.iq.harvard.edu",
type="source")
Then, the following (slight adaptation) to your example now runs nicely. (Note the graph
looks a little confusing (but pretty) as there is little difference in expected values of
Y from the two chosen sets of covariates):
library(Zelig)
set.seed(1234)
data(sanction)
sanction$cluster <- c(rep(c(1:15),5),rep(c(16),3))
sorted.sanction <- sanction[order(sanction$cluster),]
z.out <- zelig(num ~ target + coop, model = "poisson.gee", id =
"cluster", data = sorted.sanction, robust=TRUE,
corstr="exchangeable")
coop.range<-seq(from=1, to=4, length=30)
x.low <- setx(z.out, target=1, coop=coop.range)
x.high <- setx(z.out, target=3, coop=coop.range)
s.out <- sim(z.out, x = x.low, x1 = x.high, num=5000)
par(mfcol=c(1,2))
plot.ci<http://plot.ci>(s.out, qi="ev", var="coop", leg=3,
ylim=c(0,150))
plot.ci<http://plot.ci>(s.out, qi="fd", var="coop", leg=2)
Best,
James.
--
James Honaker, Senior Research Scientist
//// Institute for Quantitative Social Science, Harvard University
________________________________
From:
zelig-bounces@lists.gking.harvard.edu<mailto:zelig-bounces@lists.gking.harvard.edu>
[zelig-bounces@lists.gking.harvard.edu<mailto:zelig-bounces@lists.gking.harvard.edu>]
on behalf of Laura Crothers [crothers@utexas.edu<mailto:crothers@utexas.edu>]
Sent: Saturday, September 21, 2013 5:28 PM
To: zelig@lists.gking.harvard.edu<mailto:zelig@lists.gking.harvard.edu>
Subject: [zelig] plot.ci<http://plot.ci> not working for Poisson GEE
Hi Zelig list,
I've been having issues using plot.ci<http://plot.ci> for a Poisson GEE. I
originally thought it was due to a unique issue with my dataset, but I've tried doing
the same with the poisson GEE example from the Zelig documentation, and get the same
error:
Warning messages:
1: In simulation.matrix.sim(obj[[label]], which = which, exact.match = FALSE) :
The "which" parameter does not exist. Valid titles are:
"Expected Values (for x): E(Y|X)", "Expected Values (for x1):
E(Y|X1)", "First Differences: E(Y|X1) - E(Y|X)"
The code that I'm using is:
data(sanction)
sanction$cluster <- c(rep(c(1:15),5),rep(c(16),3))
sorted.sanction <- sanction[order(sanction$cluster),]
z.out <- zelig(num ~ target + coop, model = "poisson.gee", id =
"cluster", data = sorted.sanction, robust=TRUE,
corstr="exchangeable")
summary(z.out)
coop.range<-1:4
x.low <- setx(z.out, target=2, coop=coop.range)
x.high <- setx(z.out, target=2, coop=coop.range)
s.out <- sim(z.out, x = x.low, x1 = x.high)
plot.ci<http://plot.ci>(s.out, var="coop", ylim=c(1, 150))
Any insights into what might be going wrong?
Cheers,
Laura
Laura R. Crothers
University of Texas at Austin
Section of Integrative Biology
1 University Station, C0990
Austin, TX 78712
-
--
Zelig Mailing List, served by HUIT
Send messages: zelig@lists.gking.harvard.edu<mailto:zelig@lists.gking.harvard.edu>
[un]subscribe Options:
http://lists.gking.harvard.edu/mailman/listinfo/zelig
Zelig program information:
http://gking.harvard.edu/zelig/
Zelig mailing list
Zelig@lists.gking.harvard.edu<mailto:Zelig@lists.gking.harvard.edu>
To unsubscribe from this list or get other information:
https://lists.gking.harvard.edu/mailman/listinfo/zelig