Good morning
If I run
<<<
susan.lsmixed.out <- zelig(formula = unprot_vag_sex ~ married + age + TREATMENT.ARM*time + highest_grade + income + tag(1|id),
data = susanMI.out$imputations, model = "ls.mixed")
summary(susan.lsmixed.out)
>>>>
I get an error
Error in x$coef : $ operator is invalid for atomic vectors
Searching the archives, I see that others have had similar problems. Is there a workaround?
summary(susan.lsmixed.out[[1]])
works fine; should I then average across the five imputed data sets?
thanks!
Peter
Peter L. Flom, PhD
Statistical Consultant
Website: http://www DOT statisticalanalysisconsulting DOT com/
Writing; http://www.associatedcontent.com/user/582880/peter_flom.html
Twitter: @peterflom
-
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/
I'm using Amelia for multiple imputation, and after the creation of the
Amelia object and m data sets, I want to use Zelig to automatically combine
the results of my AR models.
I have no problem getting it to work for LS models, when using summary and
subset I can get either the combined model outputs or the output from
individual imputed data sets.
Using model="arima", however, this is not working. Instead, I always get m
identical summaries, and this error:
Error in tmp[, 1] : incorrect number of dimensions
This occurs on different imputed data sets, so I'm not quite sure what I'm
doing wrong. I can write (inelegant) code to do the averaging myself, but
it's not easily portable. Any help would be much appreciated.
Brad Epperly
PhD Candidate
Department of Political Science
University of Washington
Box 353530
Seattle, WA 98195
epperly(a)u.washington.edu
Dear All,
I would like to produce and plot predicted values (probability) from a
generalized additive logit model ("model=logit.gam"), but am not sure
how to. Here is my model:
z.out <- zelig(y ~ s(year), model="logit.gam", data=d)
x.out <- setx(z.out, year=1950:1980)
s.out <- sim(z.out, x=x.out)
I got error message "Error in coef %*% t(x) : non-conformable arguments".
I remember in the "vertci" demo, there is something like this:
z.out <- zelig(vote ~ race + educate + age + I(age^2) + income, model
= "logit", data = turnout)
x.low <- setx(z.out, educate = 12, age = 18:95)
x.high <- setx(z.out, educate = 16, age = 18:95)
s.out <- sim(z.out, x = x.low, x1 = x.high)
So I guess the problem is that Zelig does not allow a range specified
for the variable included in the "s()" term. In that case, what is the
best way to get a predicted values (probability), given a range of
values in the independent variable?
Many thanks.
Best,
Shige
-
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 team,
I have recently used plot.ci() to create some graphs but I would like R to
use smaller intervals to increase the number of bars in the graph. Also, I
have noticed that R is not plotting across the full range of the x variable
"Neocorporatism". The variable "Neocorporatism" ranges from -1.6 to 1.4. As
you can see in the plot below, however, it seems like R is disregarding
most positive values of the variable. Why would this be the case?
(Embedded image moved to file: pic13506.jpg)
Thank you,
Jose A. Aleman
http://faculty.fordham.edu/aleman
Dear Zeligists,
I am trying to use Zelig to estimate mixed-effects logit models and am
encountering an error message that I can't understand. Apparently, Zelig
isn't "seeing" my data set, but other modeling commands in R are seeing it
fine. I'm sure I'm overlooking something obvious and apologize in advance
for wasting your time, but I would really appreciate it if you could help me
fix the problem.
Here is the workspace image in text form from the session. As you can see, R
is seeing the data and estimating a GLM with no trouble. But when I use
Zelig, I get the 'undefined columns selected' message. I saw a few threads
in the listserv archives that covered the same message, but none of them
seemed to apply to a case where the data set was already a data frame
recognized by R.
Thanks in advance,
Jay
R version 2.10.1 (2009-12-14)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> # Analysis of Democratic Survival
> # Merge 21, All Non-OECD Democratic Episodes
> # Jay Ulfelder (SAIC)
> # July 2010
>
> # Load requisite packages
>
> library(foreign)
> library(Zelig)
Loading required package: MASS
Loading required package: boot
##
## Zelig (Version 3.4-8, built: 2010-01-20)
## Please refer to http://gking.harvard.edu/zelig for full
## documentation or help.zelig() for help with commands and
## models supported by Zelig.
##
## Zelig project citations:
## Kosuke Imai, Gary King, and Olivia Lau. (2009).
## ``Zelig: Everyone's Statistical Software,''
## http://gking.harvard.edu/zelig.
## and
## Kosuke Imai, Gary King, and Olivia Lau. (2008).
## ``Toward A Common Framework for Statistical Analysis
## and Development,'' Journal of Computational and
## Graphical Statistics, Vol. 17, No. 4 (December)
## pp. 892-913.
## To cite individual Zelig models, please use the citation format printed
with
## each model run and in the documentation.
##
> # Load and attach data from current directory
>
> demdat <- read.dta("RGJ All Non-OECD M21 Analysis File.dta")
> dim(demdat)
[1] 1447 78
> save(demdat, file="demdat.RData")
> rm(demdat)
> load("demdat.RData")
> attach(demdat)
> table(rgjtaut1)
rgjtaut1
0 1
1390 57
> table(first)
first
0 1
867 580
> rgjdurdl <- log(rgjdurd)
> xxxcimrl <- log(xxxcimr)
> base <- glm(rgjtaut1 ~ rgjdurdl + xxxcimrl + rgjaltp + first + postcw +
fhsciv,
+ data = demdat, family=binomial)
> summary(base)
Call:
glm(formula = rgjtaut1 ~ rgjdurdl + xxxcimrl + rgjaltp + first +
postcw + fhsciv, family = binomial, data = demdat)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.2745 -0.2895 -0.2070 -0.1343 3.0262
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -7.1637 0.9179 -7.804 5.98e-15 ***
rgjdurdl 0.3788 0.1997 1.897 0.0578 .
xxxcimrl 0.4293 0.2257 1.902 0.0572 .
rgjaltp 0.8690 0.4082 2.129 0.0333 *
first 0.2230 0.3001 0.743 0.4573
postcw -0.4540 0.3524 -1.288 0.1976
fhsciv 0.8635 0.1516 5.695 1.24e-08 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 464.75 on 1410 degrees of freedom
Residual deviance: 396.83 on 1404 degrees of freedom
(36 observations deleted due to missingness)
AIC: 410.83
Number of Fisher Scoring iterations: 7
> # Adding random Intercepts for countries
>
> basez <- zelig(y ~ rgjdurdl + xxxcimrl + rgjaltp + first + postcw + fhsciv
+ tag(1 | sftgcode),
+ data = demdat, model="logit.mixed")
Loading required package: Matrix
Loading required package: lattice
Attaching package: 'lattice'
The following object(s) are masked from package:boot :
melanoma
Attaching package: 'Matrix'
The following object(s) are masked from package:base :
det
Attaching package: 'lme4'
The following object(s) are masked from package:stats :
AIC
Error in `[.data.frame`(d, , all.vars(as.expression(formula))) :
undefined columns selected
>
--
Jay Ulfelder, Ph.D.
Research Director
Political Instability Task Force
Science Applications International Corp. (SAIC)
jay_ulfelder(a)stanfordalumni.org
(301) 588-8478 [home office]
(301) 580-8736 [mobile]
Hey all-
Can someone explain how to specify the value of more than one variable
in setx? For example, I have a model with predicts y with b1 b2 and
b3. In this example, how could I set b1 = 1, b2 = 0 and b3 = mean?
Thanks much,
-c
--
Casey A. Klofstad
University of Miami
Department of Political Science
Coral Gables, FL
klofstad(a)gmail.com
http://www.as.miami.edu/personal/cklofstad/
-
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/