I’m trying to extract fitted values from a logit.gee model (m1), using
m1$fitted.values
However, this returns NULL (as does m1$coefficients and the other fields listed on p. 265 of the Zelig documentation). I know I can simply run a glm as a workaround, but nevertheless wanted to report this issue.
Best
Nils
--
Nils B. Weidmann
Professor of Political Science
University of Konstanz
http://cnc.uni.kn
I'm unable to locate this file:
Rstatistics.zip
I'm told I need in:
http://projects.iq.harvard.edu/rtc/r-stats
to run Instructor - Ista Zahn's workshop:
R Regression Models
I gather Rstatistics.zip contains the NH11 data
Thanks for the help!
-Edward Downie
Dear List Members,
In a previous version of Zelig (unsure of version number) it was possible to extract both the first difference and risk ratio from the summary () function, as in the below steps
Model:
z.out.1 <- zelig(bhbahi~treatment+agecat+breedcat+herd_initials, model = "logit", data = dat)
Simulated quantities of interest:
x.0 <- setx(z.out.1, treatment = "Control")
x.1 <- setx(z.out.1, treatment = "Treatment")
s.out.2 <- sim(z.out.1, x = x.0, x1 = x.1)
Summary of first difference and risk ratio
summary(s.out.2)
However, changes have removed risk ratio from the quantities of interest and summary () output. The $qi now contains only:
> names(s.out.2$qi)
[1] "Expected Values: E(Y|X)" "Expected Values: E(Y|X1)"
[3] "Predicted Values: Y|X" "Predicted Values: Y|X1"
[5] "First Differences: E(Y|X1) - E(Y|X)"
My question is- is there a convenient way to obtain risk ratios and confidence intervals with the new version?
I am running Zelig version 4.2-1 on R version 3.0.2 on a Windows 7 platform
Thanks for any help.
Chris Compton
Dear Zelig users,
Greetings! I am relatively new to Zelig and R. But have a question when I run a linear least square model: output <- zelig(y ~ x, model ="ls"). When I run using my data, I get the following warning message.
In value[[3L]](cond) : There was an error fitting this statistical model.
I tried to look around to see what the issue could be but didn't have much luck. I tried to see if it is a data issue and played around with lalonde to try replicating so that I could forward to you.
data(lalonde)
z.out <- zelig(re78 ~ treat + age + educ + black + hispan + married + re74 + re75, data = lalonde, model = "ls")
output does not have any warnings.
However if I add "nodegr" covariate, I get the warning message again.
z.out <- zelig(re78 ~ treat + age + educ + black + hispan + nodegr + married + re74 + re75, data = lalonde, model = "ls")
Any advice on what should I do to fix would be deeply appreciated. If you think it may be addressed elsewhere, please let me know.
Best ,
Rajesh
Hi
I have a data set with 256 infants. only 10 out of 256 were low birth
weight(y bar=10/256). I want to evaluate low birth weight risk factors by
relogit model. when I run my code I receive an error. I have attached my
data set and my code. please help me to fit this model.
Thanks in advance.
Elham
Hi,
I'm facing two difficulties...
*The first one:* I'm trying to estimate a survey weighted Gamma Regression
with log link, but I found out that Zelig inform just the results for the
inverse link. Adding "family=Gamma(link=log)" does not work. See the
example below:
install.packages("Zelig")
require(Zelig)
#Loading data
data(api, package = "survey")
# Gamma inverse
z.inverse <- zelig(api00 ~ meals + yr.rnd + as.factor(awards), model =
"gamma.survey",
weights = ~pw, data = apistrat, family=Gamma(link=inverse))
# Gamma log
z.log <- zelig(api00 ~ meals + yr.rnd + as.factor(awards), model =
"gamma.survey",
weights = ~pw, data = apistrat, family=Gamma(link=log))
#comparison
coefficients(z.inverse) == coefficients(z.log) *#inverse-link and log-link
coefficients must be different, but they are not*
* (Intercept) meals yr.rndYes
as.factor(awards)Yes *
* TRUE TRUE TRUE
TRUE *
#########################
g.inverse <- glm(api00 ~ meals + yr.rnd + as.factor(awards),
weights = pw, data = apistrat,
family=Gamma(link="inverse"))
g.log <- glm(api00 ~ meals + yr.rnd + as.factor(awards),
weights = pw, data = apistrat, family=Gamma(link="log"))
#comparison
coefficients(g.inverse) == coefficients(g.log) *#glm brings the correct
results*
* (Intercept) meals yr.rndYes
as.factor(awards)Yes *
* FALSE FALSE FALSE
FALSE *
*The second one:* I'm not getting the output for setx in any model! Not
even for "model='ls' "
# In the example above:
meals_seq=seq(from=1,to=30,by=1)
setx(z.inverse, meals=meals_seq)
*Call:*
*NULL*
*Model name = *
*Formula = NULL*
*Complete data.frame:*
*NULL*
*Model Matrix (Design Matrix):*
*NULL*
I'm using R 3.0.2 and Zelig 4.2-1. Rolling back to Zelig 3.5.4 is not worth
in this case... setx works fine in that version, but "gamma.survey" does
not.
thanks in advance,
Rogério J Barbosa
Universidade de São Paulo, Brazil
Yes, you need an instrument (or something else)!
Best,
Kosuke
---------------------------------------------------------
Kosuke Imai Office: Corwin Hall 036
Professor Phone: 609-258-6601
Department of Politics Fax: 609-258-1110
Princeton University Email: kimai(a)Princeton.Edu
Princeton, NJ 08544-1012 http://imai.princeton.edu
---------------------------------------------------------
On Nov 11, 2013, at 5:39 PM, aschmid1 <aschmid1(a)stevens.edu> wrote:
> Dear Dr. Imai,
> I'll greatly appreciate your advice. I'm trying to use twosls for VAR2 that has only lags but no exogenous variables:
> y1(t)=a01*y2(t) + a11*y1(t-1) + a12*y1(t-2) + a12*y1(t-1) + a22*y1(t-2)
> y2(t)=b01*y1(t) + b11*y1(t-1) + b21*y1(t-2) + b12*y2(t-1) + b22*y2(t-2)
>
> Do I have to specify instrumental variables for this model?
>
> Thanks much, Alec Schmidt
Hello,
I am running several regressions with multiply imputed data sets, and Zelig
is unable to provide the summary of the regression results when I run a
multilevel model (this happens with any multilevel model supported by
ZeligMultilevel).
A reproducible example is the following:
*require(Amelia)*
*require(Zelig)*
*require(ZeligMultilevel)*
*data(freetrade)*
*amelia.ft <- amelia(freetrade, ts="year", cs="country")*
*# Non-multilevel model*
*z.out1 <- zelig(tariff ~ pop + country, data=amelia.ft, model="ls")*
*# summary() works fine*
*summary(z.out1)*
*# Multilevel model*
*z.out2 <- zelig(tariff ~ pop + tag(1 | country), data=amelia.ft, *
* model="ls.mixed")*
*# summary() does not work*
*summary(z.out2)*
The error message is:
*Error in object[[1]]$result$call :
$ operator not defined for this S4 class*
The same issue is described
here<http://stackoverflow.com/questions/16571580/multi-level-regression-model-on…>,
where a solution is also provided in the form of a slightly modified
version of summary.MI(). The problem is that once the modified version of
summary.MI() has been loaded, the function no longer works with standard
models.
Is there a better workaround?
Thank you in advance,
Mattia
--
Mattia Guidi, Ph.D
Post-doctoral Fellow
LUISS Guido Carli
Department of Political Science & School of Government
Via di Villa Emiliani 14
00197 Rome (Italy)
Tel: +39 06 8522 5706
hi,
I need to extract qi values from s.out to bring the results to another app.
When I do this s.out$qi, I get all null values. Any idea what might be
wrong?
Regards,
Sean
Zelig package is what I have been looking for a long time. I slight problem
is that I dont understand how sim() is run. I read through the docs and I
think it is written for graduate students. We can run the numbers but at
the end we need to be able to explain the results to the audience.
Can somebody explain with an example, how does sim() work?
"Zelig simulates parameters from classical *maximum likelihood* models
using asymptotic normal approximation to the log-likelihood. This is the
same assumption as used for frequentist hypothesis testing (which is of
course equivalent to the asymptotic approximation of a Bayesian posterior
with improper uniform priors). See King, Tomz, and Wittenberg
(2000)<http://gking.harvard.edu/files/abs/making-abs.shtml>.
For *Bayesian models*, Zelig simulates quantities of interest from the
posterior density, whenever possible. For *robust Bayesian models*,
simulations are drawn from the identified class of Bayesian posteriors."
Regards,
Mike