Dear Zelig users,
I've recently started using Zelig (and R). I wanted to interpret multiplicative interaction effects in a negative binomial regression (panel random effects). After looking at the Zelig manual, I saw that ".mixed" or ".gee" procedures can be used with some non-linear models (such as logit and poisson), but not the negative binomial. I wanted to confirm if I understood this correctly. And I would be interested to hear your suggestions on how to correctly assess significance of interaction effects in a negative binomial regression model with random effects.
Thank you,
Hakan Ener
Asst. Prof.
IESE Business School
Barcelona, Spain
Dear Zelig listers,
I have a panel data set with missing data. I used Amelia II to impute those missing values, and would like to use Zelig to analyse those MI data. However, I cannot figure out what is the best way to procede (i am new to R, Zelig and Amelia). An email was sent by Nathan Paxton on Nov. 20 ("Zelig, Ameila II MI, and *panel* data*") with very similar questions, but I cannot find a reply to his mail. Please excuse me for double-posting, but help is much appreciated.
More specifically, I would like to be able to run models and tests from the -plm- package, and also to compute Panel Corrected Standard Errors as in the -pcse- package. Is Zelig compatible with those packages? Is there a (preferably straightforward way) to use panel data models for MI panel data?
Thanks for your time,
Matthijs de Zwaan
-
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/
Dear Zelig users,
I just started out with Zelig and have a *very* newbie-ish question: how
do I extract the standard errors of fixed effects coefficients from the
mer object returned by a mixed-effects zelig()? For instance:
set.seed(2009)
foo <-
data.frame(dv=runif(20)<.3,iv=rnorm(20),group=rep(c("A","B","C","D"),times=5))
z.out <- zelig(dv~iv+tag(1|group), data=foo, model="logit.mixed")
summary(z.out)
I would now like to extract the estimated fixed effects coefficients and
their standard errors (which are printed by summary() under "Fixed
effects") - but the @fixef slot only contains the estimates, not the
standard errors:
summary(z.out)@fixef
Did I overlook some slot? Or do I need to calculate the standard errors
myself (if so, any pointers on how? At this point, I would probably just
bootstrap them out of the original sample...)?
I'm using Zelig 3.4-5 in R 2.9.2 (yes, these are not the newest
versions, long story) and have read the FAQ and the "Statistical
Commands" part of the documentation and have searched both on this
list's and R-help's archive, to no success...
Best,
Stephan
-
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/
Hello all,
setx() appears not to be working when a categorical variable is
specified using as.factor() in the model. From the list archives, it
seems that this was a bug in older versions of Zelig and was fixed in
3.0, but perhaps it is back. A reproducible example is below:
> y <- rnorm(100)
> x <- sample(c(1, 2, 3), 100, replace=TRUE)
> data <- as.data.frame(cbind(y, x))
>
> model1 <- zelig(y ~ x, model="ls", data=data)
How to cite this model in Zelig:
Kosuke Imai, Gary King, and Oliva Lau. 2007. "ls: Least Squares
Regression for Continuous Dependent Variables" in Kosuke Imai, Gary
King, and Olivia Lau, "Zelig: Everyone's Statistical Software,"
http://gking.harvard.edu/zelig
> stx1 <- setx(model1)
> stx1
(Intercept) x
1 1 2.14
> model2 <- zelig(y ~ as.factor(x), model="ls", data=data)
How to cite this model in Zelig:
Kosuke Imai, Gary King, and Oliva Lau. 2007. "ls: Least Squares
Regression for Continuous Dependent Variables" in Kosuke Imai, Gary
King, and Olivia Lau, "Zelig: Everyone's Statistical Software,"
http://gking.harvard.edu/zelig
> stx2 <- setx(model2)
Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") :
contrasts can be applied only to factors with 2 or more levels
>
> packageDescription("Zelig")
Package: Zelig
Version: 3.4-7
Date: 2009-10-23
Title: Everyone's Statistical Software
Author: Kosuke Imai <kimai(a)Princeton.Edu>, Gary King
<king(a)harvard.edu>, Olivia Lau <olivia.lau(a)post.harvard.edu>
Maintainer: Kosuke Imai <kimai(a)Princeton.Edu>
Depends: R (>= 2.6.0), MASS, boot
Description: Zelig is an easy-to-use program that can estimate, and
help interpret the results of, an enormous range of statistical
models. It literally is ``everyone's statistical software''
because Zelig's simple unified framework incorporates everyone
else's (R) code. We also hope it will become ``everyone's
statistical software'' for applications and teaching, and so
have designed Zelig so that anyone can easily use it or add
their programs to it. Zelig also comes with infrastructure
that facilitates the use of any existing method, such as by
allowing multiply imputed data for any model, and mimicking the
program Clarify (for Stata) that takes the raw output of
existing statistical procedures and translates them into
quantities of direct interest.
License: GPL (>=2)
URL: http://gking.harvard.edu/zelig
Suggests: VGAM (>= 0.7-5), MCMCpack (>= 0.8-2), mvtnorm, survival,
sandwich (>= 2.1-0), zoo (>= 1.5-0), coda, nnet, sna, gee,
systemfit, mgcv, lme4, anchors (>= 2.0), survey
Packaged: 2009-10-23 16:29:00 UTC; rbuild
Built: R 2.10.0; ; 2009-12-20 19:06:41 UTC; unix
-
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/
apply() basically takes a matrix of simulated predictions and compute the
averages of across simulations for each point of x. "fd" is the first
differences and so if you add it to "ev", then you get the predicted
values for x.high.
Kosuke
--
Department of Politics
Princeton University
http://imai.princeton.edu
On Tue, 15 Dec 2009, Yiannis Spanos wrote:
> Dear Kosuke,
>
> One more question, if I may: Can you briefly explain to me the "meaning" of
> the two "lines" commands. I see that they provide what I want, I just don't
> understand why they perform what I need!
>
> Many thanks for your attention,
>
> Yiannis
>
> -----Original Message-----
> From: Kosuke Imai [mailto:kimai@Princeton.Edu]
> Sent: Tuesday, December 15, 2009 3:57 PM
> To: Yiannis E. Spanos
> Cc: zelig(a)lists.gking.harvard.edu
> Subject: Re: [zelig] Vertical Confidence Inttervals Plot
>
> oops. there is a typo:
>
> lines(age.range, apply(s.out$qi$ev, 2, mean))
> lines(age.range, apply(s.out$qi$fd+s.out$qi$ev, 2, mean))
>
>
>
-
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/
Dear Colleagues,
I am using Zelig to run a "logit.gee" model with an interaction, as shown in
the code below:
z.out <-
zelig(ict~keytech+all1*chos+cind_motiv+cind_prior+ctop_support+cit_slack+cfi
rm_perfo+cstr_allign+clog_is_people+cis_level+is_status+cdyn+cempl+cemplsq+q
155, model = "logit.gee",
id = "code", corstr="unstructured",data = Dataset)
chos.range <- seq(from = -3.559, to = 1.941, by = 0.05)
x.low <- setx(z.out, all1 = 0, cemplsq = 0, chos = chos.range)
x.high <- setx(z.out, all1 = 1, cemplsq = 0, chos = chos.range)
s.out <- sim(z.out, x = x.low, x1 = x.high)
I then use the plot.ci function to plot the confidence intervals around the
ev of the simulations, using the code:
plot.ci(s.out, CI=95, qi = "ev", xlab = "Technological Opportunity",
ylab = "Probability",
main = "Predicted Difference in Probability between full and no
configuration", xlim = c(-4, 2), ylim = c(0.00, 0.90), type = "l")
legend(-1, 0.15, legend = c("Full AC configuration",
"Partial or No AC configuration"), col = c("blue","red"),
lty = c("dashed", "dotted"))
Again everything works just fine, producing the graph in the attached file.
My question is: Is it possible to have in the same graph the point estimates
of the predicted probabilities (connected in a line across the values of the
X-axis variable) together with the confidence intervals, and if yes, how
could I do it? To give an impression of what I'm talking about, I have
included an example I have found in the attached file.
Many thanks in advance for your attention,
Yiannis Spanos
*************************************************
Dr Yiannis Spanos, Assistant Professor of Strategy
Athens University of Economics and Business (AUEB)
Department of Management Science and Technology
47A Evelpidon Street & 33 Lefkados Street,
113 62 Athens, Greece
Tel: + 210 8203 668, Fax: + 210 8828 078
************************
"To salvage a general principle from a mass
of conflicting evidence can be both science
and poetry."
L. Durrell, Monsieur - The Avignon Quintet
******************************************************
When I use zelig to compute parameter estimates with "model = logit.survey",
I receive the following error:
Nicholas Carnes. 2007. "logt.surveyWarning message:
In eval(expr, envir, enclose) : non-integer #successes in a binomial glm!
I believe this is because the model is not using "quasibinomial". Is it
possible to modify "logit.survey" to use quasibinomial?
Reproducible example:
library(Zelig)
library(survey)
data(api)
z.out <- zelig(form = yr.rnd ~ api00, data = apistrat, model =
'logit.survey', id = ~1, strata = ~ stype, weight = ~pw, fpc = ~fpc)
Respectfully,
Frank Lawrence
-
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/
In October, someone posted the following question:
> However, recently I read a Thomas Lumley's paper ("Analysing Survey Data
in
> R", R News 3(1), 2003) in which he states that:
>
> "Estimates on a subset of a survey require some care. Firstly, it is
> important to ensure that the correct weight, cluster and stratum
information
> is kept matched to each observation. Secondly, it is not correct simply to
> analyse a subset as if it were a designed survey of its own. The correct
> analysis corresponds approximately to setting the weight to zero for
> observations not in the subset. This is not how it is implemented, since
> observations with zero weight still contribute to constraints in R
functions
> such as glm, and they still take up memory. Instead, the survey.design
> object keeps track of how many clusters (PSUs) were originally present in
> each stratum and svyCprod uses this to adjust the variance."
>
> According to this statement, subset analysis (for instance, comparing
blacks
> and whites, men and women, catholic and protestant, and so on) would be
> possible since we keep all cases and survey design information while
running
> our analysis, just attributing zero weight to cases outside the subset of
> interest.
> My question would be whether or not there is a Zelig command that
automatize
> this 'zero weighting process'. (but, of course, it is possible that my
> question in fact does not make sense.)
And response:
Dear Fabricio,
No, Zelig does not automate this. However, if you follow Thomas'
suggestion in the survey design object input to Zelig, Zelig should be
able to accommodate this since it passes all the *.survey models to
Thomas' package.
Best,
Olivia
I tried to follow this advice but without success. Does anyone know how to
get zelig to run on a subset from a complex survey design data file?
Respectfully,
Frank Lawrence
-
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/