Hello, I am still very inexperienced with Zelig. I hope you can help
me with a question that I have not been able to resolve from reading the
documentation.
I'm attempting a basic binomial logit model, using data that has already
been analyzed via the 'glm' package. I would like to see how the
zelig simulation output can augment the results.
I'm just doing a cut&paste with my objects in the place of the example
objects from the documentation:
++++++ Documentation Example for logit +++++++
# Unconditional prediction:
data(turnout)
z.out <- zelig(vote ~ race + educate, model = "logit", data =
turnout)
x.out <- setx(z.out)
s.out <- sim(z.out, x = x.out)
++++++ My Attempt +++++++
data(CatchCR.df)
Warning message:
In data(CatchCR.df) : data set 'CatchCR.df' not found
ls()
[1] "Allur.glm"
"Allur.Int" "Allur.mod" "CatchCR.df"
str(CatchCR.df)
'data.frame': 20
obs. of 13 variables:
$ Run : num 1 2 3 4 5 6 7 8 9 10 ...
$ Food : Factor w/ 2 levels "Fed","Starved": 2 1 2 1 2 1 2
1
1 1 ...
$ Attract : Factor w/ 2 levels "No","Yes": 2 2 2 2 2 1 1 1 1
2
...
$ Orient : Factor w/ 2 levels "Challenged","Open": 2 2 1 1 1
2
2 1 2 1 ...
$ Light : Factor w/ 2 levels "Off","On": 1 1 1 1 1 1 1 1 1
1
...
$ Allur. : num 45 50 15 20 20 45 25 25 30 15 ...
$ Victor. : num 40 40 85 65 70 35 55 55 60 55 ...
$ A..V. : num 1.125 1.25 0.176 0.308 0.286 ...
$ AllurCatch : num 9 10 3 4 4 9 5 5 6 3 ...
$ VictorCatch : num 8 8 17 13 14 7 11 11 12 11 ...
$ Allur.Prop : num 0.45 0.5 0.15 0.2 0.2 0.45 0.25 0.25 0.3 0.15
...
$ Tot.Caught : num 17 18 20 17 18 16 16 16 18 14 ...
$ Tot.Caught.Prop: num 0.85 0.9 1 0.85 0.9 0.8 0.8 0.8 0.9 0.7 ...
++++++ Ran glm immediately after without a problem +++++++
Allur.Int<-glm(CatchCR.df$Allur.Prop~(Food+Attract+Orient+Light)^2,
family=binomial, data = CatchCR.df)
Any help is greatly appreciated, thanks, Paul
________________________________
From:
owner-zelig_at_lists_gking_harvard_edu(a)mail.hmdc.harvard.edu
[mailto:owner-zelig_at_lists_gking_harvard_edu@mail.hmdc.harvard.edu] On
Behalf Of Keith Schnakenberg
Sent: Thursday, February 12, 2009 6:06 PM
To: Donald Braman
Cc: zelig(a)lists.gking.harvard.edu
Subject: Re: [zelig] sim & cis
Sorry, I meant something more like
quantile(sim.out$qi$ev, probs=c(.025, .975))
assuming expected values are actually what you need.
On Feb 12, 2009, at 3:57 PM, Donald Braman wrote:
I think that's the sort of thing I want -- though when I
try that I get the following error:
Error in order(list(x = c(1, 0, 0, 48, 3,
4.25034578146611, 0, 0, 1, 1, :
unimplemented type 'list' in 'orderVector1'
On Thu, Feb 12, 2009 at 5:31 PM, Keith Schnakenberg
<keith.schnakenberg(a)gmail.com> wrote:
Just use:
quantile(sim.out, probs=c(.025, .975))
Is that what you wanted?
On Feb 12, 2009, at 2:24 PM, Donald Braman
wrote:
The summary of a sim() helpfully returns
confidence intervals of 2.5% & 97.5% -- I wonder if there is an easy way
to estimate other CIs without plotting them? Normally, I would just
calculate it using a standard formula from the SD, mean & sample size,
but that gives me a very small CI interval relative to what Zelig
provides at 2.5%/97.5%, so I think that can't be right (I'm guessing
that's because it doesn't accounting for the multiple imputations?).
Don
CONFIDENTIALITY NOTICE:
This e-mail communication and any attachments may contain proprietary and privileged
information for the use of the designated recipients named above.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by reply e-mail and
destroy all copies of the original message.