Dear list members,
I am running a logistic regression model in R using multiply imputed data
created using Amelia II, which I am then analyzing using Zelig. I would
like to be able to report some measures of goodness-of-fit (e.g. likelihood
ratio, pseudo R-squared, Hosmer-Lemeshow) and was wondering what options I
have when using Zelig to analyze my data, as there are none that are
provided in the default output. I know some packages that provide measures
of goodness-of-fit, such as pscl, only work on glm objects, not MI objects
created when using Amelia and Zelig.
Are there any measures of goodness-of-fit that can be extracted from the
zelig() object, and if so how? And if not, does anyone know if there are
there any other packages that can run these tests on multiply imputed
datasets?
Thanks in advance for your help!
Best,
Daniel
Hi Zelig,
I’m having trouble loading the Zelig package to my machine. My goal is to
use the ei.RxC model, but I can’t get access Zelig to begin with.
I installed the Zelig 4.2-1 version, but when I call library(Zelig), I get
an error:
Error : .onAttach failed in attachNamespace() for 'Zelig', details:
call: NULL
error: '.readRDS' is defunct.
Use 'readRDS' instead.
See help("Defunct")
Error: package or namespace load failed for ‘Zelig’
I also rolled back Zelig to version 3.5 on the hopes that it would work,
but no change.
I have been following the installation guide (
http://zeligdev.github.io/files/zelig.pdf), among many other resources, and
I am using R version 3.0.2.
I have also noticed others have had this problem in the past (
http://comments.gmane.org/gmane.comp.lang.r.zelig/783) but downloading from
the CRAN Network as opposed to manually with an install.packages() command
made no difference in my case.
Please any advice on what I am doing wrong here?
Thanks,
Jennifer Boylan
For reference purposes, these are the packages I have loaded in my
libraries:
Packages in library ‘C:/Users/Jenny/Documents/R/win-library/3.0’:
car Companion to Applied Regression
coda Output analysis and diagnostics for MCMC
colorspace Color Space Manipulation
Defaults Create Global Function Defaults
effects Effect Displays for Linear, Generalized Linear,
Multinomial-Logit, Proportional-Odds Logit
Models and Mixed-Effects Models
eiPack eiPack: Ecological Inference and
Higher-Dimension Data Management
expm Matrix exponential
gdata Various R programming tools for data
manipulation
gee Generalized Estimation Equation solver
gmodels Various R programming tools for model fitting
gtools Various R programming tools
lattice Lattice Graphics
lme4 Linear mixed-effects models using Eigen and S4
lmtest Testing Linear Regression Models
manipulate Interactive Plots for RStudio
markdown Markdown rendering for R
Matrix Sparse and Dense Matrix Classes and Methods
matrixcalc Collection of functions for matrix calculations
MCMCpack Markov chain Monte Carlo (MCMC) Package
mgcv Mixed GAM Computation Vehicle with GCV/AIC/REML
smoothness estimation
mime Map filenames to MIME types
minqa Derivative-free optimization algorithms by
quadratic approximation
msm Multi-state Markov and hidden Markov models in
continuous time
mvtnorm Multivariate Normal and t Distributions
nlme Linear and Nonlinear Mixed Effects Models
nnet Feed-forward Neural Networks and Multinomial
Log-Linear Models
quantmod Quantitative Financial Modelling Framework
Rcpp Seamless R and C++ Integration
RcppEigen Rcpp integration for the Eigen templated linear
algebra library.
RMark R Code for MARK Analysis
rstudio Tools and Utilities for RStudio
sandwich Robust Covariance Matrix Estimators
sem Structural Equation Models
sfsmisc Utilities from Seminar fuer Statistik ETH
Zurich
snow Simple Network of Workstations
snowfall Easier cluster computing (based on snow).
systemfit Estimating Systems of Simultaneous Equations
TTR Technical Trading Rules
VGAM Vector Generalized Linear and Additive Models
xts eXtensible Time Series
Zelig Everyone's Statistical Software
ZeligMisc A Zelig Model
ZeligMultilevel Multilevel Regressions for Zelig
zoo S3 Infrastructure for Regular and Irregular
Time Series (Z's ordered observations)
Packages in library ‘C:/Program Files/R/R-3.0.2/library’:
base The R Base Package
boot Bootstrap Functions (originally by Angelo Canty
for S)
class Functions for Classification
cluster Cluster Analysis Extended Rousseeuw et al.
codetools Code Analysis Tools for R
compiler The R Compiler Package
datasets The R Datasets Package
foreign Read Data Stored by Minitab, S, SAS, SPSS,
Stata, Systat, dBase, ...
graphics The R Graphics Package
grDevices The R Graphics Devices and Support for Colours
and Fonts
grid The Grid Graphics Package
KernSmooth Functions for kernel smoothing for Wand & Jones
(1995)
lattice Lattice Graphics
MASS Support Functions and Datasets for Venables and
Ripley's MASS
Matrix Sparse and Dense Matrix Classes and Methods
methods Formal Methods and Classes
mgcv Mixed GAM Computation Vehicle with GCV/AIC/REML
smoothness estimation
nlme Linear and Nonlinear Mixed Effects Models
nnet Feed-forward Neural Networks and Multinomial
Log-Linear Models
parallel Support for Parallel computation in R
rpart Recursive Partitioning
spatial Functions for Kriging and Point Pattern
Analysis
splines Regression Spline Functions and Classes
stats The R Stats Package
stats4 Statistical Functions using S4 Classes
survival Survival Analysis
tcltk Tcl/Tk Interface
tools Tools for Package Development
translations The R Translations Package
utils The R Utils Package
Finally, some sample script:
> install.packages(
"Zelig",
repos = "http://r.iq.harvard.edu",
type = "source", lib="C:/Users/Jenny/Documents/R/win-library/3.0"
)
trying URL 'http://r.iq.harvard.edu/src/contrib/Zelig_4.2-2.tar.gz'
Content type 'application/x-gzip' length 3269527 bytes (3.1 Mb)
opened URL
downloaded 3.1 Mb
* installing *source* package 'Zelig' ...
** R
** data
** demo
** inst
** preparing package for lazy loading
Warning: package 'sandwich' was built under R version 3.0.3
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Warning: package 'sandwich' was built under R version 3.0.3
* DONE (Zelig)
The downloaded source packages are in
‘C:\Users\Jenny\AppData\Local\Temp\Rtmp8opSG8\downloaded_packages’
> library(Zelig)
##
## Zelig (Version 4.2-2, built: 2013-10-22)
## 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.
##
Error : .onAttach failed in attachNamespace() for 'Zelig', details:
call: NULL
error: '.readRDS' is defunct.
Use 'readRDS' instead.
See help("Defunct")
Error: package or namespace load failed for ‘Zelig’
> library()
> help.zelig(ei.RxC)
Error: could not find function "help.zelig"
> ?help.zelig()
Error in .helpForCall(topicExpr, parent.frame()) :
no methods for ‘help.zelig’ and no documentation for it as a function
> ??help.zelig()
> demo(package="Zelig")
> library(Zelig)
##
## Zelig (Version 4.2-2, built: 2013-10-22)
## 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.
##
Error : .onAttach failed in attachNamespace() for 'Zelig', details:
call: NULL
error: '.readRDS' is defunct.
Use 'readRDS' instead.
See help("Defunct")
Error: package or namespace load failed for ‘Zelig’
> install.packages(
+ "ZeligMisc",
+ repos = "http://r.iq.harvard.edu",
+ type = "source", lib="C:/Users/Jenny/Documents/R/win-library/3.0"
+ )
trying URL 'http://r.iq.harvard.edu/src/contrib/ZeligMisc_0.1-2.tar.gz'
Content type 'application/x-gzip' length 10028 bytes
opened URL
downloaded 10028 bytes
* installing *source* package 'ZeligMisc' ...
** R
** inst
** preparing package for lazy loading
Warning: package 'sandwich' was built under R version 3.0.3
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Warning: package 'sandwich' was built under R version 3.0.3
* DONE (ZeligMisc)
The downloaded source packages are in
‘C:\Users\Jenny\AppData\Local\Temp\Rtmp8opSG8\downloaded_packages’
> search()
[1] ".GlobalEnv" "package:sandwich" "package:boot"
[4] "package:MASS" "package:gdata" "package:foreign"
[7] "package:stats" "package:graphics" "package:grDevices"
[10] "package:utils" "package:datasets" "package:methods"
[13] "Autoloads" "package:base"
> library()
> STATA <- read.dta("C:/R/disaggvote2.dta", convert.factors = FALSE)
> View(STATA)
> z.out <- zelig(cbind(ndc04, npp04, thirdparty04, reject04, novote04) ~
agona + ahafo + ahanta + akuapem + akwamu + akyem + aowin + asante + asen +
boron + chokosi + denkyira + evalue + fante + kwahu + nzema + sefwi + wasa
+ bawle + otherakan + allga + allewe + allguan + allgurma + allmole +
allgrusi + allmande + allothers + allmissing, COVAR = NULL, model =
"ei.RxC", data = STATA)
Error: could not find function "zelig"
> library(ZeligMisc)
Loading required package: Zelig
##
## Zelig (Version 4.2-2, built: 2013-10-22)
## 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.
##
Error : .onAttach failed in attachNamespace() for 'Zelig', details:
call: NULL
error: '.readRDS' is defunct.
Use 'readRDS' instead.
See help("Defunct")
Error: package ‘Zelig’ could not be loaded
> library()
> help.zelig()
Error: could not find function "help.zelig"
--
PhD Candidate
Department of Political Science
University of Florida
PO Box 117325
Gainesville, FL 32611-7325
Hello,
I cannot seem to load the Zelig package. I get the following error message
when trying to load it:
library(Zelig)
Loading required package: boot
Loading required package: MASS
Loading required package: sandwich
Error : .onAttach failed in attachNamespace() for 'Zelig', details:
call: packageDescription(package.name, lib.loc = mylib)$Version
error: $ operator is invalid for atomic vectors
In addition: Warning message:
In packageDescription(package.name, lib.loc = mylib) :
no package 'Zelig' was found
Error: package or namespace load failed for ‘Zelig’
Any idea how I can get it to work? I am using R version 3.1.1.
Thanks,
Elinor
Dear Zelig List:
Can anybody comment on the status of Zelig 5? The Zelig website indicates a "Spring - Summer 2014" release, though it looks like it hasn't been updated in a while (Documentation page says Zelig Documentation will be updated summer 2013). I found the Zelig 5 github repository, and it looks like there has been a lot of work done. Is the dev version considered stable and safe or is it still alpha/early beta?
For reasons I don't perfectly recall, I had to downgrade from Zelig 4.2.1 to 3.5.4. On a recent rebuild of my R library I thought it was time to look back into this issue.
Thanks,
Ryan
--
Ryan J. Turner, M.S. <rjturner(a)cmu.edu>
Ph.D. Candidate, Dept. of Engineering and Public Policy
Carnegie Mellon University & Instituto Superior Técnico
+1-412-304-5014 (C) | +1-484-483-3244 (GV)
Hello, I think I figured it out…
thanks.
##############################
# match.data <- matchit(...)
# model.1 <- zelig(...match.data...)
treat.r <- c(0, 1)
model.treat <- setx(model.1, treat = treat.r)
model.treat.s <- sim(model.1, x = Model.treat)
model.treat.e <- data.frame(simulation.matrix(model.treat.s, "Expected Values: Y|X"))
X1 <- model.treat.e$X1
X2 <- model.treat.e$X2
density.plot <- ggplot() + geom_density(aes(x=X1), data= model.treat.e, fill="grey", alpha = .5)
+ geom_density(aes(x=X2), data=model.treat.e, fill="dark grey", alpha = .5)
##############################
On 18Jul, 2014, at 12:00 PM, zelig-request(a)lists.gking.harvard.edu wrote:
Send Zelig mailing list submissions to
zelig(a)lists.gking.harvard.edu
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.gking.harvard.edu/mailman/listinfo/zelig
or, via email, send a message with subject or body 'help' to
zelig-request(a)lists.gking.harvard.edu
You can reach the person managing the list at
zelig-owner(a)lists.gking.harvard.edu
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Zelig digest..."
Today's Topics:
1. Question regarding "plot(z.out)" (Hector Bahamonde)
----------------------------------------------------------------------
Message: 1
Date: Tue, 8 Jul 2014 10:17:52 -0400
From: Hector Bahamonde <hib6(a)scarletmail.rutgers.edu>
To: zelig(a)lists.gking.harvard.edu
Subject: [zelig] Question regarding "plot(z.out)"
Message-ID:
<CAOXA_80sDPRCr31j+FNBno_QBqXnP0E33t0gw7v3Oq+PGW_QBA(a)mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Dear all,
I am very new to R and I am trying to plot the simulations Zelig performs.
I know about the "plot(z.out)" syntax, but I am only interested in plotting
the ?Comparison of E(Y|X) and E(Y|X1)? plot. Is that possible? My final
goal is to plot it using the ggplot2 library.
Thanks,
Hector
--
*H?ctor Bahamonde N.*
PhD Student
Political Science Department - Rutgers University
Hickman Hall, 89 George street, room 602.
Dear all,
I am very new to R and I am trying to plot the simulations Zelig performs.
I know about the "plot(z.out)" syntax, but I am only interested in plotting
the “Comparison of E(Y|X) and E(Y|X1)” plot. Is that possible? My final
goal is to plot it using the ggplot2 library.
Thanks,
Hector
--
*Héctor Bahamonde N.*
PhD Student
Political Science Department - Rutgers University
Hickman Hall, 89 George street, room 602.
Dear all,
I am currently trying to conduct quantile regression in Zelig and it does not work out.
In the net I can find two vignettes:
Rq: Quantile Regression for Continuous Dependent Variables
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.205.1968
quantile: Quantile Regression for Continuous Dependent Variables
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.205.3837
Independent of which specification I use (model="rq"; model="quantile"), I get the following message:
** The model "rq" is not available with the currently loaded packages,
** and is not an official Zelig package.
** The model's name may be a typo.
I greatly appreciate any help
Best regards,
Philipp
Philipp Korom
____________________________________
Senior Researcher
Max Planck Institute for the Study of Societies
Institut Max Planck pour l'étude des sociétés
Paulstr. 3 | 50676 Cologne | Germany
kr(a)mpifg.de | www.mpifg.de
Phone +49 221 2767-274 | Fax +49 221 2767-555
Greetings,
I am attempting to run a gamma.mixed model on five imputed datasets from Amelia II. I used mi() to combine the datasets in the zelig run. As with some others, when I call the summary () , I receive the error
*Error in object[[1]]$result$call :
$ operator not defined for this S4 class*
I can get the summaries for each individual dataset,but I cannot retrieve the summary of the combined datasets. I can combine the datasets using Rubin's rules, but given this analysis will use several different models and plots,
having the combined results would be far simpler.
Thanks,
David
David Hill
Associate Professor of Political Science
Stetson University
DeLand, FL 32723
(386) 822-7579
> LU2010 -> zelig(Result~ Wetland + Developed+ Grasses+Crops,
model="logit.gee", id="Location",corstr="exchangeable", data=y2010)
> LU2010$residuals
NULL
I am running Zelig 4.2-1 and using the "logit.gee" model link to fit a
model. I am trying to get a print out of the model residuals to use to test
for spatial autocorrelation; however, when I try to get the print out it
says null.
My model is. I do not get any errors when I run the model and I get
coefficients and cun run Wald test.
Any help or ideas would be greatly appreciated.
Hi All,
I think I'm having an issue either with setx() or sim()--not sure which
one. The zelig() command runs fine and summary(z.out) output has the
correct results--the same I get from lm(). Setx() and Sim() also both run
without a problem, but summary(s.out) prints without any actual results and
when I try to plot(s.out) I get an error saying there are no y values. The
output and my code are below. I feel like I'm missing something pretty
obvious here, but am about out of ideas. Thanks in advance for any help!
Cheers,
Laura
>
masculinityscorewhole<-zelig(qual~masculinityscore+female+age+education+black+latino+republican+working+homemaker+partnered+kids+homemaker*kids+partnered*kids+polinterest+vote12b,
weights=cces3$postweight, model="normal", data=cces3)
> x.high<- setx(masculinityscorewhole, female=1)
> x.low <- setx(masculinityscorewhole, female=0)
> exp.out2<- sim(masculinityscorewhole, x = x.low, x1 = x.high)
> summary(exp.out2)
Model: normal
Number of simulations: 1000
Values of X
(Intercept) masculinityscore female age education black latino
republican working homemaker partnered kids polinterest
vote12b homemaker:kids partnered:kids
attr(,"assign")
[1] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Values of X1
(Intercept) masculinityscore female age education black latino
republican working homemaker partnered kids polinterest
vote12b homemaker:kids partnered:kids
attr(,"assign")
[1] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15