Zsófia,
As Kosuke says, the bounds are percentile based. These are sometimes also called
numerical confidence intervals. The idea is rather than computing the confidence
intervals based on asymptotic assumptions (in your example, of normality) analytically,
that if we have a large number of simulations of a quantity of interest, the numerical
bounds are created by sorting that quantity of interest, and finding the positions in the
sorted list that correspond to the desired level of coverage. This then works if
asymptotics are not reached, or across models with different distributional
characteristics.
Here are some functions you could use if you wanted to sort the quantities of interest
coming out of Zelig (or any other simulation.
# Define functions to compute confidence intervals
ci.upper <- function (x, alpha) {
pos <- max(round((1-(alpha/100))*length(x)), 1)
return(sort(x)[pos])
}
ci.lower <- function (x, alpha) {
pos<-max(round((alpha/100)*length(x)), 1)
return(sort(x)[pos])
}
where x is the set of simulations, and alpha is a level of confidence on a 0-100 scale.
James
--
James Honaker, Senior Research Scientist
//// Institute for Quantitative Social Science, Harvard University
________________________________________
From: zelig-bounces(a)lists.gking.harvard.edu [zelig-bounces(a)lists.gking.harvard.edu] on
behalf of Kosuke Imai [kimai(a)Princeton.EDU]
Sent: Wednesday, March 13, 2013 7:11 AM
To: Zsófia Ignácz
Cc: Zelig
Subject: Re: [zelig] calculation of sim () confidence intervals
zelig uses percentile based confidence intervals. so for example to calculate 95%
confidence intervals it takes 2.5 percentile and 97.5 percentile.
Kosuke
Department of Politics
Princeton University
http://imai.princeton.edu
On Mar 12, 2013, at 11:43 AM, Zsófia Ignácz <zsofia.ignacz(a)sowi.hu-berlin.de>
wrote:
Dear Developers,
I would be interested in the function you used for the sim() command to create the 95%
confidence intervals for the predicted probabilities. (I have not found it in the
documentation).
I've managed to get the predicted probabilities with the /qi$ev, and then replicate
the mean and sd, but I seem to be too ignorant to replicate the confidence intervals that
the sim() command gives me. I originally thought it was a basic calculation used for any
normal distribution, but that did not yield identical results.
My code, that I tried was the following:
GAPtrend <- zelig(as.factor(jp) ~
youngA+transgen+statshift+lostgen+male+educ+empl+inc+ind+egali, model="mlogit",
data=isjp)
transEMPL <- setx(GAPtrend, youngA=1, transgen=0, statshift=0,lostgen=0, male=1,
educ=4, empl=1, inc=52, ind=0, egali=0)
pp.transEMPL <- sim(GAPtrend, x = transEMPL)
predicted<-pp.transEMPL$qi$ev
###Calculation of CI
lower <- mean(predicted$Pr.Y.0.)-1.96*(sd(predicted$Pr.Y.0.))
upper <- mean(predicted$Pr.Y.0.)+1.96*(sd(predicted$Pr.Y.0.))
Thank you in advance for your help,
Zsófia Ignácz
--
Zsófia Ignácz
PhD Student
Humboldt Universität zu Berlin
Berlin Graduate School of Social Sciences European PhD for Social-economic
and Social Statistics
Email: zsofia.ignacz(a)sowi.hu-berlin.de
Research Associate
Jacobs University Bremen
Campus Ring 1
D-28759 Bremen
Germany
Phone: +49 421 200-3012
Email: z.ignacz(a)jacobs-university.de
URL:
http://jacobs-university.de/directory/zignacz
-
--
Zelig Mailing List, served by HUIT
Send messages: zelig(a)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(a)lists.gking.harvard.edu
To unsubscribe from this list or get other information:
https://lists.gking.harvard.edu/mailman/listinfo/zelig
-
--
Zelig Mailing List, served by HUIT
Send messages: zelig(a)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(a)lists.gking.harvard.edu
To unsubscribe from this list or get other information:
https://lists.gking.harvard.edu/mailman/listinfo/zelig