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