[r-cran-zelig] 86/102: Import Upstream version 4.2-1
Andreas Tille
tille at debian.org
Sun Jan 8 17:00:18 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository r-cran-zelig.
commit 895c6481fe969f47b0106af327abc996fae1acee
Author: Andreas Tille <tille at debian.org>
Date: Sun Jan 8 09:40:31 2017 +0100
Import Upstream version 4.2-1
---
ANNOUNCEMENT.txt | 58 ---
DESCRIPTION | 37 +-
LICENSE | 27 --
MD5 | 97 ++---
NAMESPACE | 1 +
RELEASE_NOTES => NEWS | 60 +++
R/bootfn.default.R | 18 +-
R/negbinom.R | 6 +-
R/plots.R | 268 +++++++++----
R/print.R | 37 +-
R/sim.MI.R | 4 +-
R/sim.default.R | 520 +++++++++++++------------
R/simulations.plot.R | 2 +-
R/zelig.skeleton.R | 3 +-
R/zeligBuildWeights.R | 175 +++++++++
R/zzz.R | 62 +--
build/vignette.rds | Bin 0 -> 290 bytes
data/friendship.RData | Bin 2781 -> 2781 bytes
data/sna.ex.RData | Bin 23681 -> 23681 bytes
demo/00Index | 3 +-
demo/vertci.R | 41 ++
inst/doc/gamma.pdf | Bin 193871 -> 193871 bytes
inst/doc/logit.pdf | Bin 205148 -> 205148 bytes
inst/doc/ls.pdf | Bin 192727 -> 192727 bytes
inst/doc/manual-bayes.R | 439 +++++++++++++++++++++
inst/doc/manual-bayes.pdf | Bin 289737 -> 291461 bytes
inst/doc/manual-gee.R | 327 ++++++++++++++++
inst/doc/manual-gee.pdf | Bin 358169 -> 360015 bytes
inst/doc/manual.R | 377 ++++++++++++++++++
inst/doc/manual.pdf | Bin 420060 -> 419156 bytes
inst/doc/normal.pdf | Bin 191988 -> 191988 bytes
inst/doc/twosls.R | 56 +++
inst/doc/twosls.pdf | Bin 235468 -> 217599 bytes
inst/po/en/LC_MESSAGES/R-Zelig.mo | 0
man/friendship.Rd | 4 +-
man/plot.MI.sim.Rd | 3 +-
man/plot.ci.Rd | 17 +-
man/plot.pooled.sim.Rd | 7 +-
man/zelig2-bayes.Rd | 3 +-
man/zeligBuildWeights.Rd | 47 +++
messages/templates/en/describe.canned | 21 -
messages/templates/en/describe.credit | 7 -
messages/templates/en/describe.how.to | 11 -
messages/templates/en/print.summary.sim.canned | 37 --
messages/templates/en/print.summary.sim.credit | 7 -
messages/templates/en/print.summary.sim.how.to | 9 -
messages/templates/en/qi.canned | 36 --
messages/templates/en/qi.credit | 6 -
messages/templates/en/qi.how.to | 29 --
messages/templates/en/setx.canned | 18 -
messages/templates/en/setx.credit | 7 -
messages/templates/en/setx.how.to | 22 --
messages/templates/en/sim.canned | 32 --
messages/templates/en/sim.credit | 8 -
messages/templates/en/sim.how.to | 16 -
messages/templates/en/sim.setx.canned | 8 -
messages/templates/en/sim.setx.credit | 8 -
messages/templates/en/sim.setx.how.to | 28 --
messages/templates/en/summary.sim.canned | 18 -
messages/templates/en/summary.sim.credit | 7 -
messages/templates/en/summary.sim.how.to | 24 --
messages/templates/en/zelig2.canned | 17 -
messages/templates/en/zelig2.credit | 7 -
messages/templates/en/zelig2.how.to | 25 --
messages/templates/en/zelig3.canned | 11 -
messages/templates/en/zelig3.credit | 8 -
messages/templates/en/zelig3.how.to | 16 -
tests/plot-ci.R | 11 +-
vignettes/Sweave.sty | 33 --
69 files changed, 2151 insertions(+), 1035 deletions(-)
diff --git a/ANNOUNCEMENT.txt b/ANNOUNCEMENT.txt
deleted file mode 100644
index d7cde0c..0000000
--- a/ANNOUNCEMENT.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-The Zelig core team is pleased to announce the alpha release of Zelig 4.
-
-Designated as the "Developer Update", Zelig 4 offers a wide-range of improvements to ease the process of adding new statistical models to the already extensive Zelig software suite. Significantly, this release is packaged with a brand-new API, geared towards reducing the complexity and length of Zelig's development functions - the zelig2, param and qi methods. In addition to this, Zelig now brandishes a package-creator (zelig.skeleton) that operates in the same vein as R's core function [...]
-
-In addition to changes in the development toolkit, Zelig has now been split across 13 distinct packages. This change has been made to refine the scope of Zelig and its add-ons. In particular, this restructuring of Zelig into a full software suite allows developers to contribute, develop and repair add-on packages without tinkering with the Zelig API and core functionality.
-
-While this release's prime focus has been improving the developer toolkit and restructuring the software suite, Zelig 4 offers an end-user experience completely identical to previous versions. That is, zelig's basic functions - zelig, setx and sim - ostensibly remain unchanged in functionality for available statistical models.
-
-For full details concerning changes between Zelig 3.5 and Zelig 4, please refer to:
- http://zeligdev.github.com/
-
-
-New Features
-------------
-
-Some of the new available features are:
-
-A revised developer API. The primary developer methods - zelig2, param and sim - have been reimplemented to use a sleeker, simpler API. For information, please read the Zelig developer's manual found here:
- http://zeligdev.github.com/files/booklet.pdf
-
-The core package has been restructured and minimized. In particular, Zelig core now contains only code essential to its operation, while all non-essential tasks have been made into specific R-packages. For a complete list of official Zelig packages, please refer to:
- https://github.com/zeligdev
-
-Development tools for contributors have been added to the core package. In particular, the "zelig.skeleton" function is packaged within Zelig-core in order to facilitate the rapid development of new Zelig packages.
-
-The Zelig software suite has grown to include a total of 7 R-packages. This change offers a simple and easy method for ensuring that development and bug-fixing within any particular Zelig add-on will leave the remainder of the Zelig software suite unchanged.
-
-A hook API has been integrated into the core package, in order to reduce the necessity to directly alter the zelig, setx and sim methods.
-
-Roxygen-compliant documentation has become standard in all Zelig packages. This offers an easy way to manage Rd documentation, dependencies and exports from within the R code itself. That is, documentation is more tightly paired with the actual R code. For more information about Roxygen, please refer to:
- http://roxygen.org/
-
-
-GitHub
-------
-
-Zelig is now on GitHub! Fork an add-on package or contribute bug-finds today!
-
-For a full listing of official packages and their repositories, please see:
- https://github.com/zeligdev
-
-
-Links
------
-
-The following comprises a list of relevant information for Zelig 4:
- * Website: http://zeligdev.github.com/
- * Package Repositories: https://github.com/zeligdev/
- * Installation Guide: http://zeligdev.github.com/files/zelig.pdf
- * Zelig Manual: http://zeligdev.github.com/#install
- * Available and Missing Add-on Packages: http://zeligdev.github.com/#models
-
-
-Questions
----------
-
-For any particular questions on developing new Zelig models, please send all mail to:
- zelig at lists.gking.harvard.edu
diff --git a/DESCRIPTION b/DESCRIPTION
index d92f3e1..8c1f1aa 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,30 +1,29 @@
Package: Zelig
-Maintainer: Matt Owen <mowen at iq.harvard.edu>
+Maintainer: James Honaker <zelig-zee at iq.harvard.edu>
License: GPL (>= 2)
Title: Everyone's Statistical Software
Author: Matt Owen <mowen at iq.harvard.edu>, Kosuke Imai
- <kimai at Princeton.Edu>, Gary King <king at harvard.edu>, Olivia Lau
- <olau at fas.harvard.edu>
+ <kimai at Princeton.Edu>, Gary King <king at harvard.edu>, Olivia Lau
+ <olau at fas.harvard.edu>
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.
-Version: 4.1-3
+ 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.
+Version: 4.2-1
URL: http://gking.harvard.edu/zelig
-Date: 2013-01-30
+Date: 2013-09-12
Depends: R (>= 2.14), boot, MASS, methods, sandwich
Suggests: Amelia, mvtnorm, Formula, gee, survey, survival, systemfit,
MatchIt, MCMCpack, coda
-Packaged: 2013-02-19 15:27:31 UTC; matt
+Packaged: 2013-09-20 23:15:59 UTC; jhonaker
NeedsCompilation: no
Repository: CRAN
-Date/Publication: 2013-02-19 17:45:30
+Date/Publication: 2013-09-21 08:14:26
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 0851d70..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Zelig: Everyone's Statistical Software (Zelig)
-Copyright (C) 2004. Kosuke Imai, Gary King and Olivia Lau.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-Please contact:
-
-Kosuke Imai
-Corwin Hall 041
-Department of Politics
-Princeton University
-Princeton, NJ 08544
-Email: kimai at princeton.edu
-
-With any problems or questions.
diff --git a/MD5 b/MD5
index 58ff8fe..ca28a44 100644
--- a/MD5
+++ b/MD5
@@ -1,9 +1,8 @@
-c88f9b6c55ad2dc2952f1c49580f213a *ANNOUNCEMENT.txt
577c21becf5e9c56c5fe0e528be7424d *CHANGES
263b03fca1747f78c6f7dc74e8d028b3 *COPYING
-3a44baa19c8a2dbc509fdb05a2aba818 *DESCRIPTION
-9e0405e31c184eac9aaea3ba6a398cac *LICENSE
-d96a9940470102df83f6a88746758730 *NAMESPACE
+edc38b6ac6225e48a65c07509990e71a *DESCRIPTION
+1ac2c7f3615bd20410c3c28653a88a97 *NAMESPACE
+bd30b95abbc5202460180cb71124ac1b *NEWS
b087530253b66e2f221a18045b8b2797 *R/GetObject.R
04b1a37fe9c0ea566ee393326e1b1e1d *R/GetSlot.R
fec78b51d14f64c8fd150423b150ea6c *R/GetSlot.zelig.R
@@ -18,7 +17,7 @@ af7d00382f5752ed4d43da5987251fd3 *R/as.qi.R
a069447d1fef9f59f5c5baa13868d4cc *R/as.summarized.R
fce511662ec23766b6c8008f9487ea9b *R/as.summarized.list.R
281ca3ae7ed98ff52d143c443d967cf9 *R/attach.env.R
-e7185eb25d4973cead42e1c8e2d078b5 *R/bootfn.default.R
+a8d5150931b2b16fe54ec095103384f9 *R/bootfn.default.R
57a7b009cdd02bac27d8de7eec9b7579 *R/bootstrap.R
f3baaa4332c8a63ee08391380c8610b6 *R/bootstrap.gamma.R
b15d34bc142939e4187892e1f87aaa67 *R/bootstrap.negbinom.R
@@ -62,7 +61,7 @@ e3e1629fa2bdd28a9a4606501723437e *R/model.warnings.R
e8eeed1cda2ed6af7b4513f171ee99cd *R/multi.dataset.R
a2338a7f2a569d976a7431c516a55ce4 *R/multipleUtil.R
d41d8cd98f00b204e9800998ecf8427e *R/names.relogit.R
-d6be216b0cbda6ee2addc69a1a5ef1a0 *R/negbinom.R
+1dc7173a8065deed986ce0d102afc4d2 *R/negbinom.R
bde1114a0a7f7dd4686d69fd6a66fc6f *R/normal.R
c9ea43bfb803fdf16569fa19bb23bd9e *R/normal.bayes.R
be1a168ba1761809c8e7c3e2fa45a662 *R/normal.gee.R
@@ -72,12 +71,12 @@ b419598efacb4f6db0a75c41387cb3bc *R/oprobit.bayes.R
246f95bbf2338c3d83b3f573e3d74613 *R/parameters.R
4256c2a803299e053aef257d076cae8a *R/parse.formula.R
80ca8d82671353a2c58694af079fd50a *R/parseFormula.R
-cde7d94aeb8f6828a62c33ef0479ddc1 *R/plots.R
+dd2d201c03933dcd464fc7eb0ca33b50 *R/plots.R
995511490db5fd0770d8bf1f797e337a *R/poisson.R
06f7988988376b2fcbe80d550b41546b *R/poisson.bayes.R
d365262df07215b227411820d0a7b6c6 *R/poisson.gee.R
490a754a436a5aea141d57b6028e84e1 *R/poisson.survey.R
-dcd083536fd798f90d12ab1bbdae8656 *R/print.R
+88cad5ed1eeb242eeea3ad46118a4e43 *R/print.R
91e476019d62c0d863dbf20f0d25774a *R/probit.R
0810aa237d64f6108655e2ce6cc96dbe *R/probit.bayes.R
b99bcb6128cee77d276e7842835f6cce *R/probit.gee.R
@@ -89,11 +88,11 @@ b99bcb6128cee77d276e7842835f6cce *R/probit.gee.R
8c9d7d6f667dbd1685020090536e8472 *R/robust.glm.hook.R
b5aa8503dcb438182d3c4abe2116cf66 *R/robust.hook.R
90a390fe2a8e84fb283a73648a6c5faf *R/setx.R
-d416988e52e2280773bf198011e22fd6 *R/sim.MI.R
+1d0ec64c99e67ef82349ad39ed1bb5f6 *R/sim.MI.R
07784710c5dc5b989f320184ddfa70fc *R/sim.R
-d647a3af95e422c6aa48a30d7f79120f *R/sim.default.R
+c271f5826afc0d1905363a718becfe83 *R/sim.default.R
273efcd0bd95588cb76835a799f913c8 *R/simulation.matrix.R
-56b3aedc50e3d42f9a37506c06077162 *R/simulations.plot.R
+530a23c14badb456da3f26cd18574810 *R/simulations.plot.R
13d14dc0c552b55857c56d10ba43cb3a *R/summarize.R
9545402c696aa3c3c8328bc539e90f37 *R/summary.R
5f82bb886519200bfb8ef9c6b7e2c3b2 *R/t.setx.R
@@ -105,11 +104,12 @@ ad6237fff8d120414edbb13e090eb5b2 *R/user.prompt.R
b1547c95d94d113b0b2b759c0aa52222 *R/vcov.R
6b22678c08fed5bb69c63a89018c8e49 *R/z.R
7f404f13a7309f2edabeb2c5f6ab2cbf *R/zelig.R
-b35cd3e934f074488d96ba7cc8f49535 *R/zelig.skeleton.R
+a6e8f15dbebb2be11fe21a697e7fe79d *R/zelig.skeleton.R
0b2980cf9cc2abfd8d935a4847d4c2f3 *R/zelig2.R
-e315be1ee65f7a5477ebe9d1d16668cb *R/zzz.R
+778221f28a111f964ae64f328edb59e8 *R/zeligBuildWeights.R
+bb500fd793bba24dd5794f4da6401132 *R/zzz.R
5dde81c7d95c4d5ee7c2d6112a56ed45 *README
-a05f058ca6b0ddd1afa188a2bb8f127a *RELEASE_NOTES
+3cc5f0b138fc2b0b28111f49c37e09ac *build/vignette.rds
d8568ae5389248b670f8c744a6393bc5 *data/MatchIt.url.tab.gz
42bfcc353eae9f5f6903d5018fd21f17 *data/PErisk.txt.bz2
118d8ee31df10e8303e70d33299afde0 *data/SupremeCourt.txt.gz
@@ -122,7 +122,7 @@ b7e99eba34328eb8666a65215d295aec *data/Weimar.txt.gz
809c9dc00afa3a9a2fac98c6a5beb07a *data/eidat.txt.gz
9d604cbab664c61aecb2029b22e1ff09 *data/free1.tab.bz2
9d604cbab664c61aecb2029b22e1ff09 *data/free2.tab.bz2
-0eeb37557be8d7c6f5dce71515bfded6 *data/friendship.RData
+e6d3d10b9f34dc691c29b473ce907117 *data/friendship.RData
66063f43a7ab713fe9902234fff20336 *data/grunfeld.txt.gz
350bdb7fcd6af5111de558dc4d95dbdc *data/hoff.tab.gz
21e5c0751ad485d6f448f45b327f8296 *data/homerun.txt.xz
@@ -139,12 +139,12 @@ d4d8ae34bc9283fb37eed1e4823b7530 *data/mexico.tab.bz2
f0f226b3b844530f36498e42c75b1703 *data/mid.tab.bz2
c10afea1fb3a11e9aa8b6c5717bc6e2f *data/newpainters.txt.bz2
839ca4b77a23441da065a7db969b8882 *data/sanction.tab.bz2
-46599e63d6b42df79b65cfc3ac6c69c3 *data/sna.ex.RData
+a263796f7d1d4dacd9104088e923cb29 *data/sna.ex.RData
bc8dca44e8c9f5b07da91bc0a10cb26a *data/swiss.txt.bz2
6ac34a147ed09bb7cbc393d35382cd85 *data/tobin.txt.gz
b7ffde3c50f11549db21d920a600605d *data/turnout.tab.bz2
6346b190eb5375586fbbb87cc8926124 *data/voteincome.txt.bz2
-537e28750ec399d8224790b94a000ca7 *demo/00Index
+b3278389e0d96f8465a1aa1ee5cdb070 *demo/00Index
3b0efd341facce5bf27391cfb0e10d79 *demo/Zelig.HelloWorld.R
6c5015399f7e0b91ac107fcbd790ce33 *demo/exp.R
dbc45d1cfb23ef9e0741e13a985aae74 *demo/factor.bayes.R
@@ -175,19 +175,23 @@ c87c01971457e57842e3052a22ad607b *demo/probit.R
1b1c5bd37ec746d04910dafd9e9d67e8 *demo/probit.survey.R
7e02b50c97835c7f3a20fc51b10a5fbf *demo/relogit.R
fb3e86404eb48271f47eb48c0dfe0db5 *demo/twosls.R
-5820f9f84b9e8e0394dcb295d069d3bd *inst/doc/gamma.pdf
-ed7aa0c5990772ff01ce921f04fae9dd *inst/doc/logit.pdf
-5f5e87631da75b783d443a38c8c287ca *inst/doc/ls.pdf
-259741ae49d1e7e83d5721e85f4973e4 *inst/doc/manual-bayes.pdf
-f269ba201f2537636445ed3d86b6e6de *inst/doc/manual-gee.pdf
-41d545c82736ade872175bd3ebc4db20 *inst/doc/manual.pdf
+aaf49ebca2bd4abd8b90a152da0f9b0e *demo/vertci.R
+0d0d1c14fbef07ec707ccbeaa1806efc *inst/doc/gamma.pdf
+167daeb0529d31f16b9f352c12736e5b *inst/doc/logit.pdf
+91030650a8d82f3f59d01187c630aef7 *inst/doc/ls.pdf
+ea1a15763d2d9cb490f624942e823784 *inst/doc/manual-bayes.R
+f654c2c81608dea5d6d611522454682e *inst/doc/manual-bayes.pdf
+d6e77d18e7c793cddb4305ac51cca002 *inst/doc/manual-gee.R
+768766facf9002600b590c5c2cbfa145 *inst/doc/manual-gee.pdf
+d1227d16d2cbd838ef3bac6641568c1b *inst/doc/manual.R
+b7d5c2e9d4861d5a31b564235eecc857 *inst/doc/manual.pdf
b110ff07eda2be42ed1430efcb0c0051 *inst/doc/negbinom.pdf
-285a6c7e33ab81edb9c7721bd233364e *inst/doc/normal.pdf
+995acc30b4cf84e3555c850a6d2f677a *inst/doc/normal.pdf
33df7df4e1113c852bffda80a0529056 *inst/doc/parse.formula.pdf
a235b51b2668e7905bb97fca42a0d879 *inst/doc/poisson.pdf
d8439c38a20251d17224b157326b7d8a *inst/doc/probit.pdf
-55fea654c712696b18b603540d4e781e *inst/doc/twosls.pdf
-d41d8cd98f00b204e9800998ecf8427e *inst/po/en/LC_MESSAGES/R-Zelig.mo
+024a6c851932cfcf47054a89696cf5fd *inst/doc/twosls.R
+604b2e6ff000dc5b0d697181b59c3a21 *inst/doc/twosls.pdf
bbc5b26d487010691036f3a2626e03c5 *inst/templates/DESCRIPTION
1f675b08283031c5ed15607ae39eb3b8 *inst/templates/PACKAGE.R
d41d8cd98f00b204e9800998ecf8427e *inst/templates/ZELIG.README
@@ -271,7 +275,7 @@ a3d647c361183857fdab12c3465b2b2e *man/describe.negbinom.Rd
73a2f7194321c4edeb5d69c878c37167 *man/find.match.Rd
d8e4df6b181afc5e10fee0d774850c90 *man/free1.Rd
788c8364b3a5ff56275ed6f1de9b7790 *man/free2.Rd
-f573c879f54e045383611015e7d5495c *man/friendship.Rd
+9308b489e0e1fa78db5aa3a0267058c1 *man/friendship.Rd
3c0993ec2cccedfa85723963fd153611 *man/get.package.Rd
2d06d33e4f904368f053bb261437a862 *man/getPredictorTerms.Rd
465423b551f5a638a20bd99550f3c157 *man/getResponseTerms.Formula-not-formula.Rd
@@ -331,9 +335,9 @@ c2ca077a4c40ab85f6f3a248d1a0acf7 *man/parameters.Rd
4b0740eaeb69d90ba468ef6575bf3563 *man/parseFormula.Rd
7d20becde042ea0facb79e610cb71122 *man/parseFormula.formula.Rd
821d71ca6ae7206b242590dedaa6864a *man/parseFormula.list.Rd
-c3210f27d600cbb6ca83d62774f0db22 *man/plot.MI.sim.Rd
-26f1eab54546cb1060dd2c89a82b90af *man/plot.ci.Rd
-4a1d6609b4d85d998b3dbe7f0e204b55 *man/plot.pooled.sim.Rd
+f2eb66e75eaab06acbc38b201dd7d965 *man/plot.MI.sim.Rd
+892eb691848679fffe6e366ebc9ce4b5 *man/plot.ci.Rd
+b8aef126fd49de819fff3453cc20d359 *man/plot.pooled.sim.Rd
34507a7ed081d653c8e5509d0c959a58 *man/plot.sim.Rd
d0c103e40b38d54a4108a9c6013104aa *man/plot.simulations.Rd
ac17ad9be163a17d0a5d7b30350d4b76 *man/print.qi.Rd
@@ -404,38 +408,12 @@ f7b42178326db13f916c540e911d3864 *man/turnout.Rd
d5a57f78acdf7e3665275691b7d51d0d *man/zelig.Rd
db5d3d911b778db51d0ed336355060d4 *man/zelig.call.Rd
bf3bf749ecafeb03ebaf312ce24e8751 *man/zelig.skeleton.Rd
-be529b1f9b10b5c3d68cb979d45bdd39 *man/zelig2-bayes.Rd
+73478e1acb2a5ab5a2ddce166461fe85 *man/zelig2-bayes.Rd
982fbf939e18d3a501c1a4edd9660e71 *man/zelig2-core.Rd
142acdbd460032c48b2fa9ab46ae9ae2 *man/zelig2-gee.Rd
92798192843543bd475f7a1127abebcd *man/zelig2-survey.Rd
0582491d8b2073639b1202c677d839ce *man/zelig2.Rd
-36994842c5d7884aba86e3d95fbc43e1 *messages/templates/en/describe.canned
-a0a76b93dfe9e586f0b688bc659261ef *messages/templates/en/describe.credit
-4c8b1a164cb8da4c0ea293372cade421 *messages/templates/en/describe.how.to
-8db4827ad74792f26bbe060cd14820ff *messages/templates/en/print.summary.sim.canned
-f4052924e1f3288279bd4659c02f97a4 *messages/templates/en/print.summary.sim.credit
-623bf05a3c4f85aa2379356d4ed7081d *messages/templates/en/print.summary.sim.how.to
-d68992839f91eae7dce929c5ae781e8a *messages/templates/en/qi.canned
-5a980a6bafeabeb5fe863583359ecca4 *messages/templates/en/qi.credit
-0ada437f5601cc33a880eb62a23fa583 *messages/templates/en/qi.how.to
-f199ffb1cf8bc7ea6a8074534f434394 *messages/templates/en/setx.canned
-5c27f3897543b513c4091afa64eeee12 *messages/templates/en/setx.credit
-b430d08a9319c1b43541e1f37cb1f275 *messages/templates/en/setx.how.to
-d954c9ee1c99878e0a379efff180b220 *messages/templates/en/sim.canned
-0b40e165c3945b5e697f2d0a89601f4b *messages/templates/en/sim.credit
-3b0c2a1e26e1a38f3215293f4fbda7af *messages/templates/en/sim.how.to
-831acd1b1ca307efab6d0f831acc9d05 *messages/templates/en/sim.setx.canned
-fcd8fac6c542aa0a8cedcc47bab55b34 *messages/templates/en/sim.setx.credit
-203a243137f35276b3fc288b482aa5ee *messages/templates/en/sim.setx.how.to
-b2782dc79b45fd6eda9db50f70cdb29e *messages/templates/en/summary.sim.canned
-8e6cd4b40a9979cb804dc15699e393be *messages/templates/en/summary.sim.credit
-e4525acde6c3329d73d02475f692ebe0 *messages/templates/en/summary.sim.how.to
-28263ff0964a540f7f874bc7093935c9 *messages/templates/en/zelig2.canned
-83cecaa2f5045a8b024ef67feb0e723a *messages/templates/en/zelig2.credit
-56431b0570f88212688cac62ffa94b99 *messages/templates/en/zelig2.how.to
-9d20e1354ec8f17a50ed9d3cda0124df *messages/templates/en/zelig3.canned
-d5f01072ed9a039255d95ae4bcaeb329 *messages/templates/en/zelig3.credit
-99abfaa353de1f242ecf2af83e8cf6af *messages/templates/en/zelig3.how.to
+585a585b5c00f26b8d87ea34234e8b58 *man/zeligBuildWeights.Rd
438bb2e5447a9d566fbcae4657974c34 *po/R-en.po
247f0490337165f500224fd5eab1de8b *tests/MatchIt.R
7104b3beb85e184be2193da209497f77 *tests/amelia.R
@@ -447,12 +425,11 @@ c0458e644bb50ace45e4b89f3adc235a *tests/mix.R
4712575f3142cbe8894db95db0393f87 *tests/models-core.R
b64512358b907c88cab39c8808ddd62f *tests/models-gee.R
7f82704b0c25112224ac2cdd89ebfaf9 *tests/models-survey.R
-ca8d9096a7a0622f6ef3af428653d90f *tests/plot-ci.R
+312e3a847f2874327c4338f9bcd10820 *tests/plot-ci.R
cff6618ed3f2a58687d22c115ab745af *tests/pooled.R
32522f6db5aa52a087c7fed252054cd5 *tests/relogit.R
4f5bf07089b9425a121ab6cdae418c6a *tests/summary.MI.R
bbb4157a80472a791a3fa21a06eaf2a2 *tests/twosls.R
-de1aeda81e8c8ab6ded25df5ae2dbfab *vignettes/Sweave.sty
55c2ecd46b3b0d9576b9aa82d0545124 *vignettes/Zelig.bib
fa7f97b865034c25ca528ebfe02e0d0f *vignettes/Zelig.sty
c9a0058c2df7ec58641689e43e66e9fc *vignettes/gk.bib
diff --git a/NAMESPACE b/NAMESPACE
index 52b82ec..79b17e4 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -110,6 +110,7 @@ export(zelig2twosls)
export(ZeligDescribeModel)
export(ZeligListModels)
export(ZeligListTitles)
+export(zeligBuildWeights)
S3method("[[",qi)
S3method("[[",zelig)
S3method(as.data.frame,setx)
diff --git a/RELEASE_NOTES b/NEWS
similarity index 54%
rename from RELEASE_NOTES
rename to NEWS
index 0e7d2d7..2784aa5 100644
--- a/RELEASE_NOTES
+++ b/NEWS
@@ -1,3 +1,63 @@
+The Zelig core team is pleased to announce the alpha release of Zelig 4.
+
+Designated as the "Developer Update", Zelig 4 offers a wide-range of improvements to ease the process of adding new statistical models to the already extensive Zelig software suite. Significantly, this release is packaged with a brand-new API, geared towards reducing the complexity and length of Zelig's development functions - the zelig2, param and qi methods. In addition to this, Zelig now brandishes a package-creator (zelig.skeleton) that operates in the same vein as R's core function [...]
+
+In addition to changes in the development toolkit, Zelig has now been split across 13 distinct packages. This change has been made to refine the scope of Zelig and its add-ons. In particular, this restructuring of Zelig into a full software suite allows developers to contribute, develop and repair add-on packages without tinkering with the Zelig API and core functionality.
+
+While this release's prime focus has been improving the developer toolkit and restructuring the software suite, Zelig 4 offers an end-user experience completely identical to previous versions. That is, zelig's basic functions - zelig, setx and sim - ostensibly remain unchanged in functionality for available statistical models.
+
+For full details concerning changes between Zelig 3.5 and Zelig 4, please refer to:
+ http://zeligdev.github.com/
+
+
+New Features
+------------
+
+Some of the new available features are:
+
+A revised developer API. The primary developer methods - zelig2, param and sim - have been reimplemented to use a sleeker, simpler API. For information, please read the Zelig developer's manual found here:
+ http://zeligdev.github.com/files/booklet.pdf
+
+The core package has been restructured and minimized. In particular, Zelig core now contains only code essential to its operation, while all non-essential tasks have been made into specific R-packages. For a complete list of official Zelig packages, please refer to:
+ https://github.com/zeligdev
+
+Development tools for contributors have been added to the core package. In particular, the "zelig.skeleton" function is packaged within Zelig-core in order to facilitate the rapid development of new Zelig packages.
+
+The Zelig software suite has grown to include a total of 7 R-packages. This change offers a simple and easy method for ensuring that development and bug-fixing within any particular Zelig add-on will leave the remainder of the Zelig software suite unchanged.
+
+A hook API has been integrated into the core package, in order to reduce the necessity to directly alter the zelig, setx and sim methods.
+
+Roxygen-compliant documentation has become standard in all Zelig packages. This offers an easy way to manage Rd documentation, dependencies and exports from within the R code itself. That is, documentation is more tightly paired with the actual R code. For more information about Roxygen, please refer to:
+ http://roxygen.org/
+
+
+GitHub
+------
+
+Zelig is now on GitHub! Fork an add-on package or contribute bug-finds today!
+
+For a full listing of official packages and their repositories, please see:
+ https://github.com/zeligdev
+
+
+Links
+-----
+
+The following comprises a list of relevant information for Zelig 4:
+ * Website: http://zeligdev.github.com/
+ * Package Repositories: https://github.com/zeligdev/
+ * Installation Guide: http://zeligdev.github.com/files/zelig.pdf
+ * Zelig Manual: http://zeligdev.github.com/#install
+ * Available and Missing Add-on Packages: http://zeligdev.github.com/#models
+
+
+Questions
+---------
+
+For any particular questions on developing new Zelig models, please send all mail to:
+ zelig at lists.gking.harvard.edu
+
+
Zelig v4.0-4 Release Notes (May 16, 2011)
diff --git a/R/bootfn.default.R b/R/bootfn.default.R
index b71a005..4cd25e6 100644
--- a/R/bootfn.default.R
+++ b/R/bootfn.default.R
@@ -47,8 +47,22 @@ bootfn.default <- function(data, i, object, bootstrapfn=NULL, num, ...) {
bootstrapfn <- getS3method("bootstrap", .model, TRUE)
# If bootstrap search came up sour, get default
- if (is.null(bootstrapfn))
- bootstrapfn <- Zelig:::bootstrap.default
+
+## CRAN is opposed to ::: within same package,
+## but I'm opposed to S4 environment artifacts
+## if (is.null(bootstrapfn))
+## bootstrapfn <- Zelig:::bootstrap.default
+## So this obviously makes my code better:
+
+ if (is.null(bootstrapfn)){
+ localbootstrap.default <- function (obj, ...)
+ list(
+ alpha = NULL,
+ beta = coef(obj)
+ )
+ bootstrapfn <- localbootstrap.default
+ }
+
# Attach the ".num" private variable
bootstrapfn <- attach.env(bootstrapfn, NULL, .num = num, .fitted = object)
diff --git a/R/negbinom.R b/R/negbinom.R
index 9a875b1..3edac11 100644
--- a/R/negbinom.R
+++ b/R/negbinom.R
@@ -10,7 +10,7 @@
zelig2negbinom <- function(formula, weights=NULL, ..., data)
z(
.function = "glm.nb",
- .hook = "robust.glm.hook",
+ .hook = robust.glm.hook,
weights = weights,
formula = formula,
@@ -67,13 +67,13 @@ qi.negbinom <- function(obj, x=NULL, x1=NULL, y=NULL, num=1000, param=NULL) {
#
for (i in 1:ncol(ev))
- pr[,i] <- rnegbin(nrow(ev), mu = ev[i,], theta = alpha[i])
+ pr[,i] <- as.character(rnegbin(nrow(ev), mu = ev[i,], theta = alpha[i]))
if (!is.null(x1)) {
# quantities of interest
- results <- qi(obj, x1, num=num)
+ results <- qi(obj=obj, x=x1, num=num, param=param)
# pass values over
ev1 <- results[["Expected Values: E(Y|X)"]]
diff --git a/R/plots.R b/R/plots.R
index 94d2a2b..34446d3 100644
--- a/R/plots.R
+++ b/R/plots.R
@@ -117,17 +117,39 @@ plot.sim.probit.gee <- plot.sim.logit.gee
}
#' Plot graphs of simulated multiply-imputed data
#'
-#' This function is currently unimplemented, and reserved for future use.
+#' This function combines results across multiply imputed results
+#' and then calls the appropriate plot for that class.
#'
#' @usage \method{plot}{MI.sim}(...)
#' @S3method plot MI.sim
#' @param ... ignored parameters
-#' @return NULL (invisibly)
-#' @author Matt Owen \email{mowen@@iq.harvard.edu}
-plot.MI.sim <- function(...) {
- warning("Zelig currently does not support plots of mutiply imputed data")
- invisible(NULL)
+#'
+#' @return the return of the appropriate plot method
+#' @author James Honaker \email{jhonaker@@iq.harvard.edu}
+plot.MI.sim <- function(x, ...) {
+
+ m<-length(x) # The number of imputed datasets
+ reformed<-x[[1]] # Simplified object of the original class
+ all.qi<-attributes(x[[1]]$qi)$names # Convoluted given the current structure of objects
+
+ ## Currently, we're appending all the qi's together into one object
+ ## Note - everything that is not a qi, will just come from the first imputed dataset
+
+ if(m>1){
+ for(i in 2:m){
+ for(j in all.qi){ # Could do this by position number as "in 1:length(all.qi)"
+ ## The $qi's are themselves lists, so this is difficult:
+ reformed$qi[j][[1]]<-rbind(reformed$qi[j][[1]],x[[i]]$qi[j][[1]])
+ }
+ }
+ }
+
+ output<-plot(reformed)
+ ## Return any plot returns invisibly
+ invisible(output)
}
+
+
#' Method for plotting pooled simulations by confidence intervals
#'
#' Plot confidence intervals of pooled simulated values.
@@ -156,7 +178,15 @@ plot.MI.sim <- function(...) {
#' @author James Honaker, adapted by Matt Owen \email{mowen@@iq.harvard.edu}
#' @export plot.ci
#' @usage \method{plot}{ci}(x, qi="ev", var=NULL, ..., legcol="gray20", col=NULL, leg=1, legpos=NULL)
-plot.ci <- function(x, qi="ev", var=NULL, ..., main = NULL, sub = NULL, xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, legcol="gray20", col=NULL, leg=1, legpos=NULL) {
+plot.ci <- function(x, qi="ev", var=NULL, ..., main = NULL, sub = NULL, xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, legcol="gray20", col=NULL, leg=1, legpos=NULL, ci=c(80,95,99.9)) {
+
+ if(length(ci)<3){
+ ci<-rep(ci,3)
+ }
+ if(length(ci)>3){
+ ci<-ci[1:3]
+ }
+ ci<-sort(ci)
if (! "pooled.sim" %in% class(x)) {
something <- list(x=x)
@@ -176,43 +206,61 @@ plot.ci <- function(x, qi="ev", var=NULL, ..., main = NULL, sub = NULL, xlab = N
return(invisible(FALSE))
}
+ if(is.character(var)){
+ if( !(var %in% names(x[[1]]$x$data) ) ){
+ warning("Specified variable for confidence interval plot is not in estimated model. Plotting nothing.")
+ return(invisible(FALSE))
+ }
+ }
+
+
if (is.null(var)) {
each.var <- apply(xmatrix,2,sd)
flag <- each.var>0
min.var<-min(each.var[flag])
var.seq<-1:ncol(xmatrix)
- position<-var.seq[each.var==min.var]
- position<-min(position)
- xseq<-xmatrix[,position]
- return()
- xname<-names(x[[1]]$x$data[position])
+ position<-var.seq[each.var==min.var]
} else {
-
- if(is.numeric(var)){
+ if(is.numeric(var)){
position<-var
}else if(is.character(var)){
position<-grep(var,names(x[[1]]$x$data))
}
- xseq<-xmatrix[,position]
- xname<-names(x[[1]]$x$data[position])
}
+ position<-min(position)
+ xseq<-xmatrix[,position]
+ xname<-names(x[[1]]$x$data[position])
+ # Use "qi" argument to select quantities of interest and set labels
+ ev1<-NULL
if(qi=="pv"){
- ev<-simulation.matrix(x, "Predicted Values: Y|X")
- }else{
- ev<-simulation.matrix(x, "Expected Values: E(Y|X)")
+ request<-"Predicted Values: Y|X"
+ if(!is.null(x[[1]]$x1)){
+ ev1<-simulation.matrix(x, "Predicted Values: Y|X1")
+ }
+ } else if(qi=="fd") {
+ request<-"First Differences: E(Y|X1) - E(Y|X)"
+ } else {
+ request<-"Expected Values: E(Y|X)"
+ if(!is.null(x[[1]]$x1)){
+ ev1<-simulation.matrix(x, "Expected Values: E(Y|X1)")
+ }
+ }
+ ev<-simulation.matrix(x, request)
+ if (is.null(ylab)){
+ ylab <- request
}
# Define functions to compute confidence intervals
ci.upper <- function (x, alpha) {
- pos <- max(round((1-alpha)*length(x)), 1)
+ pos <- max(round((1-(alpha/100))*length(x)), 1)
return(sort(x)[pos])
}
ci.lower <- function (x, alpha) {
- pos<-max(round(alpha*length(x)), 1)
+ pos<-max(round((alpha/100)*length(x)), 1)
return(sort(x)[pos])
}
@@ -225,82 +273,110 @@ plot.ci <- function(x, qi="ev", var=NULL, ..., main = NULL, sub = NULL, xlab = N
myblue1<-rgb( 100, 149, 237, alpha=50, maxColorValue=255)
myblue2<-rgb( 152, 245, 255, alpha=50, maxColorValue=255)
myblue3<-rgb( 191, 239, 255, alpha=70, maxColorValue=255)
- col<-c(myblue1,myblue2,myblue3)
- }
- history<-matrix(NA, nrow=k,ncol=8)
- for (i in 1:k) {
- v <- c(
- xseq[i],
- median(ev[,i]),
-
- ci.upper(ev[,i],0.8),
- ci.lower(ev[,i],0.8),
-
- ci.upper(ev[,i],0.95),
- ci.lower(ev[,i],0.95),
+ myred1 <-rgb( 237, 149, 100, alpha=50, maxColorValue=255)
+ myred2 <-rgb( 255, 245, 152, alpha=50, maxColorValue=255)
+ myred3 <-rgb( 255, 239, 191, alpha=70, maxColorValue=255)
- ci.upper(ev[,i],0.999),
- ci.lower(ev[,i],0.999)
- )
-
- history[i, ] <- v
+ col<-c(myblue1,myblue2,myblue3,myred1,myred2,myred3)
+ }else{
+ if(length(col)<6){
+ col<-rep(col,6)[1:6]
+ }
}
- if (k == 1) {
- left <- c(
- xseq[1]-.5,
- median(ev[,1]),
- ci.upper(ev[,1],0.8),
- ci.lower(ev[,1],0.8),
- ci.upper(ev[,1],0.95),
- ci.lower(ev[,1],0.95),
-
- ci.upper(ev[,1],0.999),
- ci.lower(ev[,1],0.999)
- )
- right <- c(
- xseq[1]+.5,
- median(ev[,1]),
+ form.history <- function (k,xseq,results,ci=c(80,95,99.9)){
+
+ history<-matrix(NA, nrow=k,ncol=8)
+ for (i in 1:k) {
+ v <- c(
+ xseq[i],
+ median(results[,i]),
+
+ ci.upper(results[,i],ci[1]),
+ ci.lower(results[,i],ci[1]),
- ci.upper(ev[,1],0.8),
- ci.lower(ev[,1],0.8),
+ ci.upper(results[,i],ci[2]),
+ ci.lower(results[,i],ci[2]),
- ci.upper(ev[,1],0.95),
- ci.lower(ev[,1],0.95),
+ ci.upper(results[,i],ci[3]),
+ ci.lower(results[,i],ci[3])
+ )
- ci.upper(ev[,1],0.999),
- ci.lower(ev[,1],0.999)
- )
- v <- c(
- xseq[1],
- median(ev[,1]),
+ history[i, ] <- v
+ }
+ if (k == 1) {
+ left <- c(
+ xseq[1]-.5,
+ median(results[,1]),
+
+ ci.upper(results[,1],ci[1]),
+ ci.lower(results[,1],ci[1]),
+
+ ci.upper(results[,1],ci[2]),
+ ci.lower(results[,1],ci[2]),
+
+ ci.upper(results[,1],ci[3]),
+ ci.lower(results[,1],ci[3])
+ )
+ right <- c(
+ xseq[1]+.5,
+ median(results[,1]),
+
+ ci.upper(results[,1],ci[1]),
+ ci.lower(results[,1],ci[1]),
+
+ ci.upper(results[,1],ci[2]),
+ ci.lower(results[,1],ci[2]),
+
+ ci.upper(results[,1],ci[3]),
+ ci.lower(results[,1],ci[3])
+ )
+ v <- c(
+ xseq[1],
+ median(results[,1]),
+
+ ci.upper(results[,1],ci[1]),
+ ci.lower(results[,1],ci[1]),
+
+ ci.upper(results[,1],ci[2]),
+ ci.lower(results[,1],ci[2]),
+
+ ci.upper(results[,1],ci[3]),
+ ci.lower(results[,1],ci[3])
+ )
+ history <- rbind(left, v, right)
+ }
- ci.upper(ev[,1],0.8),
- ci.lower(ev[,1],0.8),
+ return(history)
+ }
- ci.upper(ev[,1],0.95),
- ci.lower(ev[,1],0.95),
+ history<- form.history(k,xseq,ev,ci)
+ if(!is.null(ev1)){
+ history1<- form.history(k,xseq,ev1,ci)
+ }else{
+ history1<-NULL
+ }
- ci.upper(ev[,1],0.999),
- ci.lower(ev[,1],0.999)
- )
- k <- 3
- history <- rbind(left, v, right)
+ # This is for small sets that have been duplicated so as to have observable volume
+ if(k==1){
+ k<-3
}
# Specify x-axis length
all.xlim <- if (is.null(xlim))
- c(min(history[, 1]),max(history[, 1]))
+ c(min(c(history[, 1],history1[, 1])),max(c(history[, 1],history1[, 1])))
else
xlim
+
# Specify y-axis length
all.ylim <-if (is.null(ylim))
- c(min(history[, -1]), max(history[, -1]))
+ c(min(c(history[, -1],history1[, -1])),max(c(history[, -1],history1[, -1])))
else
ylim
+
# Define xlabel
if (is.null(xlab))
xlab <- paste("Range of",xname)
@@ -314,9 +390,21 @@ plot.ci <- function(x, qi="ev", var=NULL, ..., main = NULL, sub = NULL, xlab = N
plot(x=history[, 1], y=history[, 2], type="l", xlim=all.xlim, ylim=all.ylim, main = main, sub = sub, xlab=xlab, ylab=ylab)
+ polygon(c(history[,1],history[k:1,1]),c(history[,7],history[k:1,8]),col=col[3],border="white")
polygon(c(history[,1],history[k:1,1]),c(history[,5],history[k:1,6]),col=col[2],border="gray90")
polygon(c(history[,1],history[k:1,1]),c(history[,3],history[k:1,4]),col=col[1],border="gray60")
- polygon(c(history[,1],history[k:1,1]),c(history[,7],history[k:1,8]),col=col[3],border="white")
+ polygon(c(history[,1],history[k:1,1]),c(history[,7],history[k:1,8]),col=NA,border="white")
+
+ if(!is.null(ev1)){
+ lines(x=history1[, 1], y=history1[, 2], type="l")
+
+ polygon(c(history1[,1],history1[k:1,1]),c(history1[,7],history1[k:1,8]),col=col[6],border="white")
+ polygon(c(history1[,1],history1[k:1,1]),c(history1[,5],history1[k:1,6]),col=col[5],border="gray90")
+ polygon(c(history1[,1],history1[k:1,1]),c(history1[,3],history1[k:1,4]),col=col[4],border="gray60")
+ polygon(c(history1[,1],history1[k:1,1]),c(history1[,7],history1[k:1,8]),col=NA,border="white")
+
+ }
+
## This is the legend
@@ -348,14 +436,15 @@ plot.ci <- function(x, qi="ev", var=NULL, ..., main = NULL, sub = NULL, xlab = N
lines(c(lx-5*deltax,lx),c(my,my),col=legcol)
lines(c(lx,hx),c(my,my))
+ polygon(c(lx,lx,hx,hx),c(my-3*dy,my+3*dy,my+3*dy,my-3*dy),col=col[3],border="white")
polygon(c(lx,lx,hx,hx),c(my-2*dy,my+2*dy,my+2*dy,my-2*dy),col=col[2],border="gray90")
polygon(c(lx,lx,hx,hx),c(my-1*dy,my+1*dy,my+1*dy,my-1*dy),col=col[1],border="gray60")
- polygon(c(lx,lx,hx,hx),c(my-3*dy,my+3*dy,my+3*dy,my-3*dy),col=col[3],border="white")
+ polygon(c(lx,lx,hx,hx),c(my-3*dy,my+3*dy,my+3*dy,my-3*dy),col=NA,border="white")
text(lx,my,labels="median",pos=2,cex=0.5,col=legcol)
- text(lx,my+2*dy,labels="ci95",pos=2,cex=0.5,col=legcol)
- text(hx,my+1*dy,labels="ci80",pos=4,cex=0.5,col=legcol)
- text(hx,my+3*dy,labels="ci99.9",pos=4,cex=0.5,col=legcol)
+ text(lx,my+2*dy,labels=paste("ci",ci[2],sep=""),pos=2,cex=0.5,col=legcol)
+ text(hx,my+1*dy,labels=paste("ci",ci[1],sep=""),pos=4,cex=0.5,col=legcol)
+ text(hx,my+3*dy,labels=paste("ci",ci[3],sep=""),pos=4,cex=0.5,col=legcol)
}
#' Method for plotting pooled simulations by confidence intervals
@@ -420,10 +509,23 @@ plot.sim <- function (x, ...) {
old.par <- par(no.readonly = T)
# Some numbers we use to make things
- total.qis <- length(names(x$qi))
+ count<- 0
+ for(i in 1:length(names(x$qi))){
+ if (!all( is.na(x$qi[[i]]) ) & !is.null(x$qi[[i]]) )
+ count<-count+1
+
+ }
+ total.qis<-max(count,1)
+ #total.qis <- length(names(x$qi))
+
+
palette <- rainbow(total.qis)
total.cols <- 2
total.rows <- ceiling(total.qis/total.cols)
+ if(total.rows==1){
+ total.rows<-2
+ total.cols<-1
+ }
vals <- ifelse(total.qis %% 2, c(1:total.qis, total.qis), 1:total.qis)
@@ -527,7 +629,7 @@ plot.sim.cloglog.net <- function (x, ...) {
plot.simulations <- function (x, ...) {
# Save old state
old.par <- par(no.readonly=T)
-
+
# Quantities of Interest
qi <- x$qi
@@ -629,6 +731,8 @@ plot.simulations <- function (x, ...) {
# Return old parameter invisibly
invisible(old.par)
}
+
+
plot.zelig.relogit <- function(x, xlab ="", user.par = FALSE, alt.col = "red",
ylab = NULL, samples = 100, ...){
k <- length(x$qi)
diff --git a/R/print.R b/R/print.R
index 18e2609..f7fa3c6 100644
--- a/R/print.R
+++ b/R/print.R
@@ -181,9 +181,44 @@ print.summary.relogit <- function(
x,
digits = max(3, getOption("digits") - 3),
...
+
) {
# Straight-forwardly print the model using glm's method
- print.glm(x, digits = digits, ...)
+ ## Was:
+ ##stats:::print.glm(x, digits = digits, ...)
+
+ ## ":::" not allowed by CRAN
+ ## Copied from Stats Internals
+ ## Temporary Patch / Need to write print method now
+
+ print.relogitglm<-function (x, digits = max(3L, getOption("digits") - 3L), ...)
+ {
+ cat("\nCall: ", paste(deparse(x$call), sep = "\n", collapse = "\n"),
+ "\n\n", sep = "")
+ if (length(coef(x))) {
+ cat("Coefficients")
+ if (is.character(co <- x$contrasts))
+ cat(" [contrasts: ", apply(cbind(names(co), co),
+ 1L, paste, collapse = "="), "]")
+ cat(":\n")
+ print.default(format(x$coefficients, digits = digits),
+ print.gap = 2, quote = FALSE)
+ }
+ else cat("No coefficients\n\n")
+ cat("\nDegrees of Freedom:", x$df.null, "Total (i.e. Null); ",
+ x$df.residual, "Residual\n")
+ if (nzchar(mess <- naprint(x$na.action)))
+ cat(" (", mess, ")\n", sep = "")
+ cat("Null Deviance:\t ", format(signif(x$null.deviance,
+ digits)), "\nResidual Deviance:", format(signif(x$deviance,
+ digits)), "\tAIC:", format(signif(x$aic, digits)))
+ cat("\n")
+ invisible(x)
+}
+
+ print.relogitglm(x, digits = digits, ...)
+
+
# Additional slots
diff --git a/R/sim.MI.R b/R/sim.MI.R
index d7b0dd6..f8fc1c6 100644
--- a/R/sim.MI.R
+++ b/R/sim.MI.R
@@ -17,6 +17,8 @@
sim.MI <- function(obj, x=NULL, x1=NULL, y=NULL, num=1000, ...) {
sim.results <- list()
+ m<-length(obj)
+ mi.num<-ceiling(num/m)
for (key in names(obj)) {
object <- obj[[key]]
@@ -24,7 +26,7 @@ sim.MI <- function(obj, x=NULL, x1=NULL, y=NULL, num=1000, ...) {
new.x1 <- x1[[key]]
new.y <- y[[key]]
- sim.results[[key]] <- sim(object, x=new.x, x1=new.x1, y=new.y, num=num)
+ sim.results[[key]] <- sim(object, x=new.x, x1=new.x1, y=new.y, num=mi.num)
}
model <- get('model', attr(obj, 'state'))
diff --git a/R/sim.default.R b/R/sim.default.R
index 1b7c5ad..28b722f 100644
--- a/R/sim.default.R
+++ b/R/sim.default.R
@@ -1,252 +1,268 @@
-#' Method for Simulating Quantities of Interest wrom 'zelig' Objects
-#'
-#' Simulate quantities of interest
-#' @usage \method{sim}{default}(obj,
-#' x=NULL, x1=NULL, y=NULL,
-#' num=1000, bootstrap = FALSE,
-#' bootfn=NULL,
-#' cond.data = NULL,
-#' ...)
-#' @S3method sim default
-#' @param obj a 'zelig' object
-#' @param x a 'setx' object
-#' @param x1 a secondary 'setx' object used to perform particular computations
-#' of quantities of interest
-#' @param y a parameter reserved for the computation of particular quantities of
-#' interest (average treatment effects). Few models currently support this
-#' parameter
-#' @param num an integer specifying the number of simulations to compute
-#' @param bootstrap ignored
-#' @param bootfn ignored
-#' @param cond.data ignored
-#' @param ... parameters to be passed to the boot function, if one is supplied
-#' @return a 'sim' object storing the replicated quantities of interest
-#' @author Matt Owen \email{mowen@@iq.harvard.edu}
-sim.default <- function(
- obj,
- x = NULL,
- x1 = NULL,
- y = NULL,
- num = 1000,
- bootstrap = FALSE,
- bootfn = NULL,
- cond.data = NULL,
- ...
- ) {
- # Create environment of local variables
- model.env <- new.env()
-
- # Add local variables
- assign(".object", obj$result, model.env)
- assign(".fitted", obj$result, model.env)
- assign(".model", "model-name", model.env)
-
- # Get S3 methods
- paramfunction <- getS3method("param", obj$name, FALSE)
- qifunction <- getS3method("qi", obj$name, FALSE)
- bootfunction <- getS3method("bootstrap", obj$name, TRUE)
-
- parent.env(model.env) <- environment(paramfunction)
-
- environment(paramfunction) <- model.env
- environment(qifunction) <- model.env
-
- # Begin function
-
- if (length(attr(x, "pooled")) > 0 && attr(x, "pooled")) {
-
- xes <- list()
- titles <- NULL
-
- for (key in names(x)) {
- xes[[key]] <- sim(obj, x[[key]], x1[[key]], y, num, bootstrap, bootfn, cond.data, ...)
- attr(xes[[key]], "pooled") <- FALSE
- titles <- append(titles, xes[[key]]$titles)
- }
-
- attr(xes, "pooled") <- TRUE
- attr(xes, "pooled.setx") <- x
- attr(xes, "titles") <- unique(titles)
-
- class(xes) <- c("pooled.sim")
-
- return(xes)
- }
-
- # Stop on unimplemented features
- if (!is.null(cond.data))
- warning("conditions are not yet supported")
-
- # Simulate Parameters
- # param <- param(obj, num=num)
- param <- paramfunction(obj, num=num)
-
- # Cast list into a "parameters" object
- param <- as.parameters(param, num)
-
- # Define the pre-sim hook name
- post.hook <- obj$zc$.post
-
- # apply the hook if it exists
- if (!is.null(post.hook)) {
- zelig2 <- get(paste("zelig2", obj$name, sep=""))
- envir <- environment(zelig2)
-
- # Produce a warning if the post-hook defined cannot be found
- if (!exists(post.hook, mode="function", envir=envir))
- warning("the hook '", post.hook, "' cannot be found")
-
- # Otherwise, business as usual. Extract the hook and apply it to the zelig
- # object. Note that a post-hook always has the arguments:
- # obj, x, x1, bootstrap, bootfn, param
- else {
- # Retrieve the hook, since it exists
- hook <- get(post.hook, envir=envir)
-
- # Assign the param object. In the case of bootstrapping, the param object
- # might not have any meaning.
- param <- if (bootstrap)
- param
-
- # Otherwise apply the hook and return it as the parameters
- else
- hook(obj, x, x1, bootstrap, bootfn, param=param)
- }
- }
-
- # Get default boot-strapping function if boot is enabled and no boot-function
- # is specified
- if (bootstrap && missing(bootfn))
- bootfn <- bootfn.default
-
- # Boot-strapping!!
- if (!missing(bootfn) && !is.null(bootfn)) {
-
- # Get the appropriate
- d <- obj$data
- d <- d[complete.cases(d), ]
-
- # Add several private variables to bootfn:
- # .fitted : a fitted model object
- # .data : the data-set used to fit the original model
- # .call : the call used to fit the original model
- # .env : the environment in which the .call variable should/can be
- # evaluated
- boot.env <- obj$method.env
- bootfn <- attach.env(bootfn, obj$method.env)
-
- # Bootstrapfn
- bootstrapfn <- getS3method("bootstrap", obj$name, TRUE)
- environment(bootstrapfn) <- model.env
-
- # If is.null then we just get the default bootstrap fn, which is merely to
- # simulate the systematic paramaters
- if (is.null(bootstrapfn))
- bootstrapfn <- Zelig:::bootstrap.default
-
- # Attach the appropriate environment to the function
- bootstrapfn <- attach.env(bootstrapfn, model.env)
-
- # Get a sample, so we know how to re-size the result.
- # Note: This "example" object will be used at the end of this if-clause to
- # build an object similar in structure to that of "bootstrapfn(obj)"
- example <- bootstrapfn(obj)
- example <- as.bootvector(example)
-
- # Bootstrap using a function with parameters: data, i, object
- # Where data is a data.frame, i is an vector of integers used to sample the
- # data.frame, and object is a fitted model object.
- res <- boot(d, bootfn, num,
- object = obj$result,
- bootstrapfn = bootstrapfn,
- num = num
- )
-
- # Copy the param object that was made earlier via ``param'' method
- res.param <- param
-
- # Reverse-construct a bootlist object from this
- bl <- as.bootlist(res$t, example$lengths, example$names)
-
- # Replace slots corresponding to "alpha" and "beta" on the "param" object
- param$coefficients <- bl$beta
- param$alpha <- bl$alpha
- }
-
- # Compute quantities of interest
- res.qi <- qifunction(obj, x=x, x1=x1, y=y, param=param, num=num)
-
- # Cast as a "qi" object if it is not one
- res.qi <- as.qi(res.qi)
-
- # Assign class
- class(res.qi) <- c(obj$name, class(res.qi))
-
- # This is kludge (for now)
- # This can be removed as of 4-27-2011
- if (inherits(obj, "MI"))
- class(res.qi) <- c("MI", class(res.qi))
-
- # build object
- s <- list(
- model = obj$name,
- x = x,
- x1 = x1,
- stats = summarize(res.qi),
- qi = res.qi,
- titles = names(res.qi),
- bootfn = bootfn,
- cond.data= cond.data,
- zelig = obj,
- call = match.call(),
- zcall = obj$call,
- result = obj$result,
- num = num,
- special.parameters = list(...),
- package.name = obj$package.name
- )
-
- # cast class
- sim.class <- if (inherits(obj, "MI"))
- sim.class <- "MI.sim"
-
- attr(s, "titles") <- unique(names(res.qi))
-
- class(s) <- c(sim.class,
- paste("sim", obj$name, sep="."),
- obj$name,
- "sim"
- )
-
- # return
- s
-}
-
-create.pooled.sim <- function(
- obj,
- x = NULL,
- x1 = NULL,
- y = NULL,
- num = 1000,
- bootstrap = FALSE,
- bootfn = NULL,
- cond.data = NULL,
- ...
- ) {
- xes <- list()
- titles <- NULL
-
- for (key in names(x)) {
- xes[[key]] <- sim(obj, x[[key]], x1[[key]], y, num, bootstrap, bootfn, cond.data, ...)
- attr(xes[[key]], "pooled") <- FALSE
- titles <- append(titles, xes[[key]]$titles)
- }
-
- attr(xes, "pooled") <- TRUE
- attr(xes, "pooled.setx") <- x
- attr(xes, "titles") <- unique(titles)
-
- class(xes) <- c("pooled.sim")
-
- return(xes)
-}
+#' Method for Simulating Quantities of Interest wrom 'zelig' Objects
+#'
+#' Simulate quantities of interest
+#' @usage \method{sim}{default}(obj,
+#' x=NULL, x1=NULL, y=NULL,
+#' num=1000, bootstrap = FALSE,
+#' bootfn=NULL,
+#' cond.data = NULL,
+#' ...)
+#' @S3method sim default
+#' @param obj a 'zelig' object
+#' @param x a 'setx' object
+#' @param x1 a secondary 'setx' object used to perform particular computations
+#' of quantities of interest
+#' @param y a parameter reserved for the computation of particular quantities of
+#' interest (average treatment effects). Few models currently support this
+#' parameter
+#' @param num an integer specifying the number of simulations to compute
+#' @param bootstrap ignored
+#' @param bootfn ignored
+#' @param cond.data ignored
+#' @param ... parameters to be passed to the boot function, if one is supplied
+#' @return a 'sim' object storing the replicated quantities of interest
+#' @author Matt Owen \email{mowen@@iq.harvard.edu}
+sim.default <- function(
+ obj,
+ x = NULL,
+ x1 = NULL,
+ y = NULL,
+ num = 1000,
+ bootstrap = FALSE,
+ bootfn = NULL,
+ cond.data = NULL,
+ ...
+ ) {
+ # Create environment of local variables
+ model.env <- new.env()
+
+ # Add local variables
+ assign(".object", obj$result, model.env)
+ assign(".fitted", obj$result, model.env)
+ assign(".model", "model-name", model.env)
+
+ # Get S3 methods
+ paramfunction <- getS3method("param", obj$name, FALSE)
+ qifunction <- getS3method("qi", obj$name, FALSE)
+ bootfunction <- getS3method("bootstrap", obj$name, TRUE)
+
+ parent.env(model.env) <- environment(paramfunction)
+
+ environment(paramfunction) <- model.env
+ environment(qifunction) <- model.env
+
+ # Begin function
+
+ if (length(attr(x, "pooled")) > 0 && attr(x, "pooled")) {
+
+ xes <- list()
+ titles <- NULL
+
+ # for (key in names(x)) {
+ for (k in 1:length(x)) {
+ key <- names(x)[[k]]
+ xes[[key]] <- sim(obj, x[[k]], x1[[k]], y, num, bootstrap, bootfn, cond.data, ...)
+ attr(xes[[key]], "pooled") <- FALSE
+ titles <- append(titles, xes[[key]]$titles)
+ }
+
+ attr(xes, "pooled") <- TRUE
+ attr(xes, "pooled.setx") <- x
+ attr(xes, "titles") <- unique(titles)
+
+ class(xes) <- c("pooled.sim")
+
+ return(xes)
+ }
+
+ # Stop on unimplemented features
+ if (!is.null(cond.data))
+ warning("conditions are not yet supported")
+
+ # Simulate Parameters
+ # param <- param(obj, num=num)
+ param <- paramfunction(obj, num=num)
+
+ # Cast list into a "parameters" object
+ param <- as.parameters(param, num)
+
+ # Define the pre-sim hook name
+ post.hook <- obj$zc$.post
+
+ # apply the hook if it exists
+ if (!is.null(post.hook)) {
+ zelig2 <- get(paste("zelig2", obj$name, sep=""))
+ envir <- environment(zelig2)
+
+ # Produce a warning if the post-hook defined cannot be found
+ if (!exists(post.hook, mode="function", envir=envir))
+ warning("the hook '", post.hook, "' cannot be found")
+
+ # Otherwise, business as usual. Extract the hook and apply it to the zelig
+ # object. Note that a post-hook always has the arguments:
+ # obj, x, x1, bootstrap, bootfn, param
+ else {
+ # Retrieve the hook, since it exists
+ hook <- get(post.hook, envir=envir)
+
+ # Assign the param object. In the case of bootstrapping, the param object
+ # might not have any meaning.
+ param <- if (bootstrap)
+ param
+
+ # Otherwise apply the hook and return it as the parameters
+ else
+ hook(obj, x, x1, bootstrap, bootfn, param=param)
+ }
+ }
+
+ # Get default boot-strapping function if boot is enabled and no boot-function
+ # is specified
+ if (bootstrap && missing(bootfn))
+ bootfn <- bootfn.default
+
+ # Boot-strapping!!
+ if (!missing(bootfn) && !is.null(bootfn)) {
+
+ # Get the appropriate
+ d <- obj$data
+ d <- d[complete.cases(d), ]
+
+ # Add several private variables to bootfn:
+ # .fitted : a fitted model object
+ # .data : the data-set used to fit the original model
+ # .call : the call used to fit the original model
+ # .env : the environment in which the .call variable should/can be
+ # evaluated
+ boot.env <- obj$method.env
+ bootfn <- attach.env(bootfn, obj$method.env)
+
+ # Bootstrapfn
+ bootstrapfn <- getS3method("bootstrap", obj$name, TRUE)
+ environment(bootstrapfn) <- model.env
+
+ # If is.null then we just get the default bootstrap fn, which is merely to
+ # simulate the systematic paramaters
+
+## CRAN is opposed to ::: within same package,
+## but I'm opposed to S4 environment artifacts
+## if (is.null(bootstrapfn))
+## bootstrapfn <- Zelig:::bootstrap.default
+## So this obviously makes my code better:
+
+ if (is.null(bootstrapfn)){
+ localbootstrap.default <- function (obj, ...)
+ list(
+ alpha = NULL,
+ beta = coef(obj)
+ )
+ bootstrapfn <- localbootstrap.default
+ }
+
+
+ # Attach the appropriate environment to the function
+ bootstrapfn <- attach.env(bootstrapfn, model.env)
+
+ # Get a sample, so we know how to re-size the result.
+ # Note: This "example" object will be used at the end of this if-clause to
+ # build an object similar in structure to that of "bootstrapfn(obj)"
+ example <- bootstrapfn(obj)
+ example <- as.bootvector(example)
+
+ # Bootstrap using a function with parameters: data, i, object
+ # Where data is a data.frame, i is an vector of integers used to sample the
+ # data.frame, and object is a fitted model object.
+ res <- boot(d, bootfn, num,
+ object = obj$result,
+ bootstrapfn = bootstrapfn,
+ num = num
+ )
+
+ # Copy the param object that was made earlier via ``param'' method
+ res.param <- param
+
+ # Reverse-construct a bootlist object from this
+ bl <- as.bootlist(res$t, example$lengths, example$names)
+
+ # Replace slots corresponding to "alpha" and "beta" on the "param" object
+ param$coefficients <- bl$beta
+ param$alpha <- bl$alpha
+ }
+
+ # Compute quantities of interest
+ res.qi <- qifunction(obj, x=x, x1=x1, y=y, param=param, num=num)
+
+ # Cast as a "qi" object if it is not one
+ res.qi <- as.qi(res.qi)
+
+ # Assign class
+ class(res.qi) <- c(obj$name, class(res.qi))
+
+ # This is kludge (for now)
+ # This can be removed as of 4-27-2011
+ if (inherits(obj, "MI"))
+ class(res.qi) <- c("MI", class(res.qi))
+
+ # build object
+ s <- list(
+ model = obj$name,
+ x = x,
+ x1 = x1,
+ stats = summarize(res.qi),
+ qi = res.qi,
+ titles = names(res.qi),
+ bootfn = bootfn,
+ cond.data= cond.data,
+ zelig = obj,
+ call = match.call(),
+ zcall = obj$call,
+ result = obj$result,
+ num = num,
+ special.parameters = list(...),
+ package.name = obj$package.name
+ )
+
+ # cast class
+ sim.class <- if (inherits(obj, "MI"))
+ sim.class <- "MI.sim"
+
+ attr(s, "titles") <- unique(names(res.qi))
+
+ class(s) <- c(sim.class,
+ paste("sim", obj$name, sep="."),
+ obj$name,
+ "sim"
+ )
+
+ # return
+ s
+}
+
+create.pooled.sim <- function(
+ obj,
+ x = NULL,
+ x1 = NULL,
+ y = NULL,
+ num = 1000,
+ bootstrap = FALSE,
+ bootfn = NULL,
+ cond.data = NULL,
+ ...
+ ) {
+ xes <- list()
+ titles <- NULL
+
+ for (key in names(x)) {
+ xes[[key]] <- sim(obj, x[[key]], x1[[key]], y, num, bootstrap, bootfn, cond.data, ...)
+ attr(xes[[key]], "pooled") <- FALSE
+ titles <- append(titles, xes[[key]]$titles)
+ }
+
+ attr(xes, "pooled") <- TRUE
+ attr(xes, "pooled.setx") <- x
+ attr(xes, "titles") <- unique(titles)
+
+ class(xes) <- c("pooled.sim")
+
+ return(xes)
+}
diff --git a/R/simulations.plot.R b/R/simulations.plot.R
index 888c380..b76b9b1 100644
--- a/R/simulations.plot.R
+++ b/R/simulations.plot.R
@@ -138,7 +138,7 @@ simulations.plot <-function(
for(m in 1:n.y){
for(n in 1:n.y){
- text(x=locations.x[m],y=locations.y[n],labels=paste(round(100*comp[m,n])/100),col=lab.colors[(comp[m,n]> ((max(comp)-min(comp))/2) )+1])
+ text(x=locations.x[m],y=locations.y[n],labels=paste(round(100*comp[m,n])), col=lab.colors[(comp[m,n]> ((max(comp)-min(comp))/2) )+1])
}
}
diff --git a/R/zelig.skeleton.R b/R/zelig.skeleton.R
index 1fd2962..6265690 100644
--- a/R/zelig.skeleton.R
+++ b/R/zelig.skeleton.R
@@ -94,8 +94,7 @@ zelig.skeleton <- function (
name = pkg,
environment = e,
path = path,
- force = force,
- namespace = TRUE
+ force = force
)
# Copy files over - as of 3/11 these files are blank
diff --git a/R/zeligBuildWeights.R b/R/zeligBuildWeights.R
new file mode 100644
index 0000000..3a94e78
--- /dev/null
+++ b/R/zeligBuildWeights.R
@@ -0,0 +1,175 @@
+#' Utility to build a vector (or sometimes matrix) of weights for analysis model.
+#'
+#' This takes standardized Zelig user input about weights, and tailors it
+#' via developer defined settings, to correspond with the format of
+#' weights acceptable by the model Zelig bridges to. It also runs a
+#' set of checks to uncover any potential errors in the specified weights.
+#' @param weights A set of non-negative value weights. Overrides repweights
+#' if defined.
+#' @param repweights A set of whole number (non-negative integer) weights.
+#' useful if weights are just for making copies or deleting certain
+#' or frequency weights.
+#' @param zeros An option on how to deal with zero valued user supplied weights.
+#' Default of "zero" allows zero weights, "epsilon" changes zeroes to 1e-08,
+#' "remove" removes those observations from the dataset.
+#' @param rebuild An option to allow specified repweights to reconfigure the
+#' rows of the dataset to rebuild a corresponding dataset where every row is
+#' of weight 1. Useful if analysis model does not accept weights.
+#' @param allowweights Defines if weights are allowed in model.
+#' @param allowrepweights Defines if repweights are allowed in model. Overridden if
+#' \code{useweights=TRUE}.
+#' @param data Dataset, required if weights are defined by variable name, or if
+#' dataset is to be reconfigured (by \code{rebuild} or \code{zeros} options)
+#' @return weights A vector of weights of the structure defined by the
+#' developer and required by the analysis model. Or NULL if certain checks
+#' are failed.
+#' @return data A reconfigured dataset, if modified.
+#' @author James Honaker \email{zelig-zee@@iq.harvard.edu}
+#' @export
+
+zeligBuildWeights <- function (weights=NULL, repweights=NULL, zeros="zeros", rebuild=FALSE, allowweights=TRUE, allowrepweights=TRUE, data=NULL) {
+
+
+ ## Developer can turn off certain types of weights
+ ## NOTE: Can't currently turn off "repweights", if "weights" allowable.
+ if(!allowweights & !allowrepweights & !is.null(weights)){
+ warning("You have specified weights, but weighting is not available for this model. Ignoring weights. ")
+ return(list(weights=NULL, data=data))
+ }
+
+ if(!allowweights & !allowrepweights & !is.null(repweights)){
+ warning("You have specified repweights, but weighting is not available for this model. Ignoring weights. ")
+ return(list(weights=NULL, data=data))
+ }
+
+ if(!allowweights & !is.null(weights)){
+ warning("You have specified weights, but weights are not an option in this model. Ignoring weights. repweights may be an available option.")
+ weights=NULL
+ }
+
+
+ ## Override repweights with weights when in conflict.
+ if(!is.null(weights) & !is.null(repweights)){
+ warning("You have specified both weights and repweights. The repweights will be ignored.")
+ repweights<-NULL
+ }
+
+
+ ## Turn weights as variable name into vector, with checking.
+ if(is.character(weights)){
+ if(is.null(data)){
+ warning("ZELIG DEVELOPER WARNING: You have named a weight variable in the dataset, but not supplied dataset to zeligBuildWeights. Weights will be ignored in your model until amended.")
+ return(list(weights=NULL, data=data))
+ }else if (!(weights %in% names(data))){
+ warning("The variable name supplied for the weights is not present in the dataset. Ignoring weights.")
+ return(list(weights=NULL, data=data))
+ }else if ( !is.numeric(data[,weights])){
+ warning("The variable supplied for the weights is not numeric. Ignoring weights.")
+ return(list(weights=NULL, data=data))
+ }else{
+ weights<-data[,weights]
+ }
+ }
+
+ ## Turn repweights as variable name into vector, with checking.
+ if(is.character(repweights)){
+ if(is.null(data)){
+ warning("ZELIG DEVELOPER WARNING: You have named a repweight variable in the dataset, but not supplied dataset to zeligBuildWeights. repweights will be ignored in your model until amended.")
+ return(list(weights=NULL, data=data))
+ }else if (!(repweights %in% names(data))){
+ warning("The variable name supplied for the repweights is not present in the dataset. Ignoring weights.")
+ return(list(weights=NULL, data=data))
+ }else if ( !is.numeric(data[,repweights])){
+ warning("The variable supplied for the repweights is not numeric. Ignoring weights.")
+ return(list(weights=NULL, data=data))
+ }else{
+ repweights<-data[,repweights]
+ }
+ }
+
+ ## Some checking/transforming on repweights
+ if(!is.null(repweights)){
+ if(!all(floor(repweights)==repweights)){
+ warning("Defined repweights are not integer, so will be rounded.")
+ repweights=round(repweights) # Maybe allow floor/ceiling as other options?
+ }
+ if(sum(is.na(repweights))>0){ # any(is.na()) sometimes has issues
+ warning("Some defined repweights are missing values, so will be treated as zeros")
+ flag<-is.na(repweights)
+ repweights[flag]<-0;
+ }
+ if(min(repweights)<0){
+ warning("Some defined repweights are negative, so will be treated as zeros")
+ flag<-repweights<0
+ repweights[flag]<-0;
+ }
+ if(sum(repweights)==0){
+ warning("Defined repweights give no weight to any observation. Ignoring weights.")
+ return(list(weights=NULL, data=data))
+ }
+ }
+
+
+ ## Some checking/transforming on weights
+ if(!is.null(weights)){
+ if(sum(is.na(weights))>0){ # any(is.na()) sometimes has issues
+ warning("Some defined weights are missing values, so will be treated as zeros")
+ flag<-is.na(weights)
+ weights[flag]<-0;
+ }
+ if(min(weights)<0){
+ warning("Some defined weights are negative, so will be treated as zeros")
+ flag<-weights<0
+ weights[flag]<-0;
+ }
+ if(sum(weights)==0){
+ warning("Defined weights give no weight to any observation. Ignoring weights.")
+ return(list(weights=NULL, data=data))
+ }
+ }
+
+
+ ## If repweights not available to function, reconstruct a dataset
+ ## NOTE: "rebuild" overrides any setting of "zeros"
+ if( is.null(weights) & !is.null(repweights) & rebuild){
+ if(is.null(data)){
+ warning("ZELIG DEVELOPER WARNING: You have set zeligBuildWeights to rebuild dataset, but not supplied dataset to zeligBuildWeights function. Weights will be ignored in your model until amended.")
+ return(list(weights=NULL, data=data))
+ }else{
+ ## Rebuild dataset according to replication weights
+ newobs<-rep(1:nrow(data), repweights) # Index of rows to use
+ data<-data[newobs,] # Copy relevant rows
+ }
+ weights<-NULL # Or, could be weights<-rep(1,nrow(data))
+ ## when repweights are correct, but need to be transfered to final output
+ }else if (is.null(weights) & !is.null(repweights) ){
+ weights<-repweights
+ }
+
+ ## From this point, only "weights" exists in a meaningful way.
+
+ if(!is.null(weights)){
+ ## Implement zeros option.
+ if(zeros=="epsilon"){
+ flag<-weights==0
+ weights[flag]<- .00000001
+ }else if (zeros=="remove"){
+ flag<-weights==0
+ weights<-weights[!flag]
+ data<-data[!flag,]
+ }
+ }
+
+
+
+ ## NOTE: Ideally, we could just pass back a vector of indexes to reformat the
+ ## data, rather than passing back and forwards the data.
+ ## But simpler for developer this way.
+
+ built <- list(weights=weights, data=data)
+
+ # Return
+ return(built)
+}
+
+
diff --git a/R/zzz.R b/R/zzz.R
index 243b3d1..3caab16 100644
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -1246,35 +1246,37 @@ splitUp <- function(args) {
-
-# @topic: character-string representing help-topic
-# @package: package containing help-topic
-# return: character-string of processed Rd file
-.get.help.file <- function(topic, package) {
- # get package help-file if no topic is set
- if (missing(topic))
- topic <- package
-
- # error-checking:
- # ensure file and package are strings
- if (!is.character(topic) && length(topic) > 1L)
- stop()
-
- if (!is.character(package) && length(package) > 1L)
- stop()
-
- #
- directory <- system.file(package=package)
-
- #
- path <- utils:::index.search(
- topic=topic,
- paths=directory
- )
-
- # search package-help-dataabase, get Rd file as string
- utils:::.getHelpFile(file=path)
-}
+## Honaker: I had to remove this utility function because
+## CRAN has recently weighed against use of ":::"
+
+## @topic: character-string representing help-topic
+## @package: package containing help-topic
+## return: character-string of processed Rd file
+#.get.help.file <- function(topic, package) {
+# # get package help-file if no topic is set
+# if (missing(topic))
+# topic <- package
+#
+ ## error-checking:
+ ## ensure file and package are strings
+# if (!is.character(topic) && length(topic) > 1L)
+# stop()
+#
+# if (!is.character(package) && length(package) > 1L)
+# stop()
+#
+ ##
+# directory <- system.file(package=package)
+#
+ ##
+# path <- utils:::index.search(
+# topic=topic,
+# paths=directory
+# )
+#
+ ## search package-help-dataabase, get Rd file as string
+# utils:::.getHelpFile(file=path)
+#}
@@ -1357,7 +1359,7 @@ replace.call <- function(zobj, call1, call2) {
#' @param package a character-string naming a package
#' @return whether this package depends on Zelig
is.zelig.package <- function(package="") {
- "Zelig" %in% tools:::pkgDepends(package)$Depends
+ "Zelig" %in% tools::pkgDepends(package)$Depends
}
#' Whether a R-Package Contains a 'Yes' in its DESCRIPTION File's 'Zelig' Field
diff --git a/build/vignette.rds b/build/vignette.rds
new file mode 100644
index 0000000..972b136
Binary files /dev/null and b/build/vignette.rds differ
diff --git a/data/friendship.RData b/data/friendship.RData
index 5def678..3a59225 100644
Binary files a/data/friendship.RData and b/data/friendship.RData differ
diff --git a/data/sna.ex.RData b/data/sna.ex.RData
index 6ee4208..69328ae 100644
Binary files a/data/sna.ex.RData and b/data/sna.ex.RData differ
diff --git a/demo/00Index b/demo/00Index
index 6be303b..b2a555b 100644
--- a/demo/00Index
+++ b/demo/00Index
@@ -26,5 +26,6 @@ normal.survey Survey-Weighted Normal Regression for Continuous Dependent Vari
logit.survey Survey-Weighted Logistic Regression for Dichotomous Dependent Variables
probit.survey Survey-Weighted Probit Regression for Dichotomous Dependent Variables
poisson.survey Survey-Weighted Poisson Regression for Event-count Dependent Variables
-gamma.survey Survey-Weighted Poisson Regression for Positive Continuous Dependent Variables
+gamma.survey Survey-Weighted Poisson Regression for Positive Continuous Dependent Variables
+vertci Confidence intervals across the range of a continuous covariate
Zelig.HelloWorld Step-by-step demo on creating Zelig packages
diff --git a/demo/vertci.R b/demo/vertci.R
new file mode 100644
index 0000000..3a1b2ed
--- /dev/null
+++ b/demo/vertci.R
@@ -0,0 +1,41 @@
+
+## Attaching the sample turnout dataset:
+data(turnout)
+
+## Estimate the model:
+user.prompt()
+z.out <- zelig(vote ~ race + educate + age + I(age^2) + income,
+ model = "logit", data = turnout)
+user.prompt()
+summary(z.out)
+
+## Creating setx structures with education set to high school and
+## post-college levels, for the whole range of the age variable.
+user.prompt()
+x.low <- setx(z.out, educate = 12, age = 18:95)
+x.high <- setx(z.out, educate = 16, age = 18:95)
+
+## Using sim to generate the simulated predicted probabilites:
+user.prompt()
+s.out <- sim(z.out, x = x.low, x1 = x.high)
+user.prompt()
+plot.ci(s.out, xlab = "Age in Years",
+ ylab = "Predicted Probability of Voting",
+ main = "Effect of Education and Age on Voting Behavior")
+
+text(x=50,y=.95,labels="College Education (16 years)",cex=0.6)
+text(x=60,y=.8,labels="High School Education (12 years)",cex=0.6)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/inst/doc/gamma.pdf b/inst/doc/gamma.pdf
index fb369d7..67b0e05 100644
Binary files a/inst/doc/gamma.pdf and b/inst/doc/gamma.pdf differ
diff --git a/inst/doc/logit.pdf b/inst/doc/logit.pdf
index 2fba868..62bc9bc 100644
Binary files a/inst/doc/logit.pdf and b/inst/doc/logit.pdf differ
diff --git a/inst/doc/ls.pdf b/inst/doc/ls.pdf
index 306dae0..7c97903 100644
Binary files a/inst/doc/ls.pdf and b/inst/doc/ls.pdf differ
diff --git a/inst/doc/manual-bayes.R b/inst/doc/manual-bayes.R
new file mode 100644
index 0000000..d0cd940
--- /dev/null
+++ b/inst/doc/manual-bayes.R
@@ -0,0 +1,439 @@
+### R code from vignette source 'manual-bayes.Rnw'
+
+###################################################
+### code chunk number 1: loadLibrary
+###################################################
+library(Zelig)
+library(MCMCpack)
+
+
+###################################################
+### code chunk number 2: BasicExample.data
+###################################################
+ data(turnout)
+
+
+###################################################
+### code chunk number 3: BasicExample.zelig
+###################################################
+ z.out <- zelig(vote ~ race + educate, model = "logit.bayes",
+ data = turnout, verbose = FALSE)
+
+
+###################################################
+### code chunk number 4: BasicExample.geweke
+###################################################
+ geweke.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 5: BasicExample.heidel
+###################################################
+ heidel.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 6: BasicExample.raftery
+###################################################
+ raftery.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 7: BasicExample.summary.zout
+###################################################
+summary(z.out)
+
+
+###################################################
+### code chunk number 8: BasicExample.setx
+###################################################
+ x.out <- setx(z.out)
+
+
+###################################################
+### code chunk number 9: BasicExample.sim
+###################################################
+ s.out1 <- sim(z.out, x = x.out)
+
+
+###################################################
+### code chunk number 10: BasicExample.summary.sim
+###################################################
+summary(s.out1)
+
+
+###################################################
+### code chunk number 11: FirstDifferences.setx.high
+###################################################
+ x.high <- setx(z.out, educate = quantile(turnout$educate, prob = 0.75))
+
+
+###################################################
+### code chunk number 12: FirstDifferences.setx.low
+###################################################
+x.low <- setx(z.out, educate = quantile(turnout$educate, prob = 0.25))
+
+
+###################################################
+### code chunk number 13: FirstDifferences.sim
+###################################################
+s.out2 <- sim(z.out, x = x.high, x1 = x.low)
+
+
+###################################################
+### code chunk number 14: FirstDifferences.summary
+###################################################
+summary(s.out2)
+
+
+###################################################
+### code chunk number 15: BasicExample.data
+###################################################
+ data(mexico)
+
+
+###################################################
+### code chunk number 16: BasicExample.zelig
+###################################################
+ z.out <- zelig(vote88 ~ pristr + othcok + othsocok, model = "mlogit.bayes",
+ data = mexico)
+
+
+###################################################
+### code chunk number 17: BasicExample.heidel
+###################################################
+ heidel.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 18: BasicExample.raftery
+###################################################
+raftery.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 19: BasicExample.summary
+###################################################
+summary(z.out)
+
+
+###################################################
+### code chunk number 20: BasicExample.setx
+###################################################
+ x.out <- setx(z.out)
+
+
+###################################################
+### code chunk number 21: BasicExample.sim
+###################################################
+ s.out1 <- sim(z.out, x = x.out)
+
+
+###################################################
+### code chunk number 22: BasicExample.summary.sim
+###################################################
+summary(s.out1)
+
+
+###################################################
+### code chunk number 23: FirstDifferences.setx
+###################################################
+ x.weak <- setx(z.out, pristr = 1)
+ x.strong <- setx(z.out, pristr = 3)
+
+
+###################################################
+### code chunk number 24: FirstDifferences.sim
+###################################################
+s.out2 <- sim(z.out, x = x.strong, x1 = x.weak)
+
+
+###################################################
+### code chunk number 25: FirstDifferences.summary
+###################################################
+summary(s.out2)
+
+
+###################################################
+### code chunk number 26: BasicExample.data
+###################################################
+ data(macro)
+
+
+###################################################
+### code chunk number 27: BasicExample.zelig
+###################################################
+z.out <- zelig(unem ~ gdp + capmob + trade, model = "normal.bayes",
+ data = macro, verbose = FALSE)
+
+
+###################################################
+### code chunk number 28: BasicExample.geweke
+###################################################
+ geweke.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 29: BasicExample.heidel
+###################################################
+heidel.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 30: BasicExample.raftery
+###################################################
+raftery.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 31: BasicExample.summary
+###################################################
+summary(z.out)
+
+
+###################################################
+### code chunk number 32: BasicExample.setx
+###################################################
+ x.out <- setx(z.out)
+
+
+###################################################
+### code chunk number 33: BasicExample.sim
+###################################################
+ s.out1 <- sim(z.out, x = x.out)
+
+
+###################################################
+### code chunk number 34: BasicExample.summary.sim
+###################################################
+summary(s.out1)
+
+
+###################################################
+### code chunk number 35: FirstDifferences.setx
+###################################################
+ x.high <- setx(z.out, trade = quantile(macro$trade, prob = 0.8))
+ x.low <- setx(z.out, trade = quantile(macro$trade, prob = 0.2))
+
+
+###################################################
+### code chunk number 36: FirstDifferences.sim
+###################################################
+ s.out2 <- sim(z.out, x = x.high, x1 = x.low)
+
+
+###################################################
+### code chunk number 37: FirstDifferences.summary.sim
+###################################################
+ summary(s.out2)
+
+
+###################################################
+### code chunk number 38: BasicExample.data
+###################################################
+ data(sanction)
+
+
+###################################################
+### code chunk number 39: BasicExample.zelig
+###################################################
+ z.out <- zelig(ncost ~ mil + coop, model = "oprobit.bayes",
+ data = sanction, verbose = FALSE)
+
+
+###################################################
+### code chunk number 40: BasicExample.factor
+###################################################
+sanction$ncost <- factor(sanction$ncost, ordered = TRUE,
+ levels = c("net gain", "little effect",
+ "modest loss", "major loss"))
+
+
+###################################################
+### code chunk number 41: BasicExample.heidel
+###################################################
+heidel.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 42: BasicExample.raftery
+###################################################
+raftery.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 43: BasicExample.summary
+###################################################
+summary(z.out)
+
+
+###################################################
+### code chunk number 44: BasicExample.setx
+###################################################
+ x.out <- setx(z.out)
+
+
+###################################################
+### code chunk number 45: BasicExample.sim
+###################################################
+ s.out1 <- sim(z.out, x = x.out)
+ summary(s.out1)
+
+
+###################################################
+### code chunk number 46: FirstDifferences.setx
+###################################################
+ x.high <- setx(z.out, mil=0)
+ x.low <- setx(z.out, mil=1)
+
+
+###################################################
+### code chunk number 47: FirstDifferences.sim
+###################################################
+s.out2 <- sim(z.out, x = x.high, x1 = x.low)
+ summary(s.out2)
+
+
+###################################################
+### code chunk number 48: BasicExample.data
+###################################################
+ data(sanction)
+
+
+###################################################
+### code chunk number 49: BasicExample.zelig
+###################################################
+ z.out <- zelig(num ~ target + coop, model = "poisson.bayes",
+ data = sanction, verbose = FALSE)
+
+
+###################################################
+### code chunk number 50: BasicExample.geweke
+###################################################
+ geweke.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 51: BasicExample.heidel
+###################################################
+heidel.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 52: BasicExample.raftery
+###################################################
+raftery.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 53: BasicExample.summary
+###################################################
+summary(z.out)
+
+
+###################################################
+### code chunk number 54: BasicExample.setx
+###################################################
+ x.out <- setx(z.out)
+
+
+###################################################
+### code chunk number 55: BasicExample.sim
+###################################################
+ s.out1 <- sim(z.out, x = x.out)
+
+
+###################################################
+### code chunk number 56: BasicExample.summary.sim
+###################################################
+summary(s.out1)
+
+
+###################################################
+### code chunk number 57: FirstDifferences.setx
+###################################################
+ x.max <- setx(z.out, target = max(sanction$target))
+ x.min <- setx(z.out, target = min(sanction$target))
+
+
+###################################################
+### code chunk number 58: FirstDifferences.sim
+###################################################
+ s.out2 <- sim(z.out, x = x.max, x1 = x.min)
+ summary(s.out2)
+
+
+###################################################
+### code chunk number 59: BasicExample.data
+###################################################
+ data(turnout)
+
+
+###################################################
+### code chunk number 60: BasicExample.zelig
+###################################################
+ z.out <- zelig(vote ~ race + educate, model = "probit.bayes",
+ data = turnout, verbose = FALSE)
+
+
+###################################################
+### code chunk number 61: BasicExample.geweke
+###################################################
+ geweke.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 62: BasicExample.heidel
+###################################################
+ heidel.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 63: BasicExample.raftery
+###################################################
+raftery.diag(z.out$result$coefficients)
+
+
+###################################################
+### code chunk number 64: BasicExample.summary
+###################################################
+summary(z.out)
+
+
+###################################################
+### code chunk number 65: BasicExample.setx
+###################################################
+ x.out <- setx(z.out)
+
+
+###################################################
+### code chunk number 66: BasicExample.sim
+###################################################
+ s.out1 <- sim(z.out, x = x.out)
+
+
+###################################################
+### code chunk number 67: BasicExample.summary.sim
+###################################################
+summary(s.out1)
+
+
+###################################################
+### code chunk number 68: FirstDifferences.setx
+###################################################
+ x.high <- setx(z.out, educate = quantile(turnout$educate, prob = 0.75))
+ x.low <- setx(z.out, educate = quantile(turnout$educate, prob = 0.25))
+
+
+###################################################
+### code chunk number 69: FirstDifferences.sim
+###################################################
+ s.out2 <- sim(z.out, x = x.high, x1 = x.low)
+
+
+###################################################
+### code chunk number 70: FirstDifferences.summary
+###################################################
+summary(s.out2)
+
+
diff --git a/inst/doc/manual-bayes.pdf b/inst/doc/manual-bayes.pdf
index d686b22..91b8f14 100644
Binary files a/inst/doc/manual-bayes.pdf and b/inst/doc/manual-bayes.pdf differ
diff --git a/inst/doc/manual-gee.R b/inst/doc/manual-gee.R
new file mode 100644
index 0000000..91727b5
--- /dev/null
+++ b/inst/doc/manual-gee.R
@@ -0,0 +1,327 @@
+### R code from vignette source 'manual-gee.Rnw'
+
+###################################################
+### code chunk number 1: loadLibrary
+###################################################
+library(Zelig)
+library(MCMCpack)
+
+
+###################################################
+### code chunk number 2: Example.data
+###################################################
+data(coalition)
+
+
+###################################################
+### code chunk number 3: Example.cluster
+###################################################
+coalition$cluster <- c(rep(c(1:62),5),rep(c(63),4))
+sorted.coalition <- coalition[order(coalition$cluster),]
+
+
+###################################################
+### code chunk number 4: Example.zelig
+###################################################
+z.out <- zelig(duration ~ fract + numst2, model = "gamma.gee", id = "cluster", data = sorted.coalition, robust=TRUE, corstr="exchangeable")
+summary(z.out)
+
+
+###################################################
+### code chunk number 5: Example.setx
+###################################################
+x.low <- setx(z.out, numst2 = 0)
+x.high <- setx(z.out, numst2 = 1)
+
+
+###################################################
+### code chunk number 6: Example.sim
+###################################################
+s.out <- sim(z.out, x = x.low, x1 = x.high)
+summary(s.out)
+
+
+###################################################
+### code chunk number 7: ExamplePlot
+###################################################
+plot(s.out)
+
+
+###################################################
+### code chunk number 8: Example.data
+###################################################
+data(turnout)
+
+
+###################################################
+### code chunk number 9: Example.cluster
+###################################################
+turnout$cluster <- rep(c(1:200),10)
+
+
+###################################################
+### code chunk number 10: Example.sort
+###################################################
+sorted.turnout <- turnout[order(turnout$cluster),]
+
+
+###################################################
+### code chunk number 11: Example.zelig
+###################################################
+z.out1 <- zelig(vote ~ race + educate, model = "logit.gee", id = "cluster", data = sorted.turnout, robust = TRUE, corstr = "stat_M_dep", Mv=3)
+
+
+###################################################
+### code chunk number 12: Example.setx
+###################################################
+x.out1 <- setx(z.out1)
+
+
+###################################################
+### code chunk number 13: Example.sim
+###################################################
+s.out1 <- sim(z.out1, x = x.out1)
+
+
+###################################################
+### code chunk number 14: Example.summary.sim
+###################################################
+summary(s.out1)
+
+
+###################################################
+### code chunk number 15: ExamplePlot
+###################################################
+plot(s.out1)
+
+
+###################################################
+### code chunk number 16: FirstDifference.setx
+###################################################
+x.high <- setx(z.out1, educate = quantile(turnout$educate, prob = 0.75))
+x.low <- setx(z.out1, educate = quantile(turnout$educate, prob = 0.25))
+
+
+###################################################
+### code chunk number 17: FirstDifference.sim
+###################################################
+s.out2 <- sim(z.out1, x = x.high, x1 = x.low)
+
+
+###################################################
+### code chunk number 18: FirstDifference.summary.sim
+###################################################
+summary(s.out2)
+
+
+###################################################
+### code chunk number 19: FirstDifferencePlot
+###################################################
+plot(s.out2)
+
+
+###################################################
+### code chunk number 20: Example2.corr
+###################################################
+corr.mat <- matrix(rep(0.5,100), nrow=10, ncol=10)
+diag(corr.mat) <- 1
+
+
+###################################################
+### code chunk number 21: Example2.zelig
+###################################################
+z.out2 <- zelig(vote ~ race + educate, model = "logit.gee", id = "cluster", data = sorted.turnout, robust = TRUE, corstr = "fixed", R=corr.mat)
+
+
+###################################################
+### code chunk number 22: Example2.summary
+###################################################
+summary(z.out2)
+
+
+###################################################
+### code chunk number 23: Example.data
+###################################################
+data(macro)
+
+
+###################################################
+### code chunk number 24: Example.zelig
+###################################################
+z.out <- zelig(unem ~ gdp + capmob + trade, model = "normal.gee", id = "country", data = macro, robust=TRUE, corstr="AR-M", Mv=1)
+summary(z.out)
+
+
+###################################################
+### code chunk number 25: Example.setx
+###################################################
+x.high <- setx(z.out, trade = quantile(macro$trade, 0.8))
+x.low <- setx(z.out, trade = quantile(macro$trade, 0.2))
+
+
+###################################################
+### code chunk number 26: Example.sim
+###################################################
+s.out <- sim(z.out, x = x.high, x1 = x.low)
+
+
+###################################################
+### code chunk number 27: Example.summary.sim
+###################################################
+summary(s.out)
+
+
+###################################################
+### code chunk number 28: ExamplePlot
+###################################################
+plot(s.out)
+
+
+###################################################
+### code chunk number 29: Example.data
+###################################################
+data(sanction)
+
+
+###################################################
+### code chunk number 30: Example.cluster
+###################################################
+sanction$cluster <- c(rep(c(1:15),5),rep(c(16),3))
+
+
+###################################################
+### code chunk number 31: Example.sort
+###################################################
+sorted.sanction <- sanction[order(sanction$cluster),]
+
+
+###################################################
+### code chunk number 32: Example.zelig
+###################################################
+z.out <- zelig(num ~ target + coop, model = "poisson.gee", id = "cluster", data = sorted.sanction, robust=TRUE, corstr="exchangeable")
+summary(z.out)
+
+
+###################################################
+### code chunk number 33: Example.setx
+###################################################
+x.out <- setx(z.out)
+
+
+###################################################
+### code chunk number 34: Example.sim
+###################################################
+s.out <- sim(z.out, x = x.out)
+summary(s.out)
+
+
+###################################################
+### code chunk number 35: ExamplePlot
+###################################################
+plot(s.out)
+
+
+###################################################
+### code chunk number 36: Example.data
+###################################################
+data(turnout)
+
+
+###################################################
+### code chunk number 37: Example.cluster
+###################################################
+turnout$cluster <- rep(c(1:200),10)
+
+
+###################################################
+### code chunk number 38: Example.sort
+###################################################
+sorted.turnout <- turnout[order(turnout$cluster),]
+
+
+###################################################
+### code chunk number 39: Example.zelig
+###################################################
+z.out1 <- zelig(vote ~ race + educate, model = "probit.gee", id = "cluster", data = sorted.turnout, robust = TRUE, corstr = "stat_M_dep", Mv=3)
+
+
+###################################################
+### code chunk number 40: Example.setx
+###################################################
+x.out1 <- setx(z.out1)
+
+
+###################################################
+### code chunk number 41: Example.sim
+###################################################
+s.out1 <- sim(z.out1, x = x.out1)
+
+
+###################################################
+### code chunk number 42: Example.summary.sim
+###################################################
+summary(s.out1)
+
+
+###################################################
+### code chunk number 43: ExamplePlot
+###################################################
+plot(s.out1)
+
+
+###################################################
+### code chunk number 44: manual-gee.Rnw:1346-1347
+###################################################
+options(width=80)
+
+
+###################################################
+### code chunk number 45: FirstDifference.setx
+###################################################
+x.high <- setx(z.out1, educate = quantile(turnout$educate, prob = 0.75))
+x.low <- setx(z.out1, educate = quantile(turnout$educate, prob = 0.25))
+
+
+###################################################
+### code chunk number 46: FirstDifference.sim
+###################################################
+s.out2 <- sim(z.out1, x = x.high, x1 = x.low)
+
+
+###################################################
+### code chunk number 47: FirstDifference.summary.sim
+###################################################
+summary(s.out2)
+
+
+###################################################
+### code chunk number 48: FirstDifferencePlot
+###################################################
+plot(s.out2)
+
+
+###################################################
+### code chunk number 49: manual-gee.Rnw:1373-1374
+###################################################
+options(width=75)
+
+
+###################################################
+### code chunk number 50: Example2.corr
+###################################################
+corr.mat <- matrix(rep(0.5,100), nrow=10, ncol=10)
+diag(corr.mat) <- 1
+
+
+###################################################
+### code chunk number 51: Example2.zelig
+###################################################
+z.out2 <- zelig(vote ~ race + educate, model = "probit.gee", id = "cluster", data = sorted.turnout, robust = TRUE, corstr = "fixed", R=corr.mat)
+
+
+###################################################
+### code chunk number 52: Example2.summary
+###################################################
+summary(z.out2)
+
+
diff --git a/inst/doc/manual-gee.pdf b/inst/doc/manual-gee.pdf
index 5901f8d..c50e2e2 100644
Binary files a/inst/doc/manual-gee.pdf and b/inst/doc/manual-gee.pdf differ
diff --git a/inst/doc/manual.R b/inst/doc/manual.R
new file mode 100644
index 0000000..d6174cd
--- /dev/null
+++ b/inst/doc/manual.R
@@ -0,0 +1,377 @@
+### R code from vignette source 'manual.Rnw'
+
+###################################################
+### code chunk number 1: loadLibrary
+###################################################
+library(Zelig)
+
+
+###################################################
+### code chunk number 2: Example.data
+###################################################
+ data(coalition)
+
+
+###################################################
+### code chunk number 3: Example.zelig
+###################################################
+ z.out <- zelig(duration ~ fract + numst2, model = "gamma", data = coalition)
+
+
+###################################################
+### code chunk number 4: Example.summary
+###################################################
+ summary(z.out)
+
+
+###################################################
+### code chunk number 5: Example.setx
+###################################################
+ x.low <- setx(z.out, numst2 = 0)
+ x.high <- setx(z.out, numst2 = 1)
+
+
+###################################################
+### code chunk number 6: Example.sim
+###################################################
+ s.out <- sim(z.out, x = x.low, x1 = x.high)
+
+
+###################################################
+### code chunk number 7: Example.summary
+###################################################
+summary(s.out)
+
+
+###################################################
+### code chunk number 8: gamma-ExamplePlot
+###################################################
+ plot(s.out)
+
+
+###################################################
+### code chunk number 9: Example.data
+###################################################
+ data(turnout)
+
+
+###################################################
+### code chunk number 10: Example.zelig
+###################################################
+
+ z.out1 <- zelig(vote ~ age + race, model = "logit", data = turnout)
+
+
+
+###################################################
+### code chunk number 11: Example.setx
+###################################################
+ x.out1 <- setx(z.out1, age = 36, race = "white")
+
+
+###################################################
+### code chunk number 12: Example.sim
+###################################################
+ s.out1 <- sim(z.out1, x = x.out1)
+
+
+###################################################
+### code chunk number 13: Example.summary
+###################################################
+ summary(s.out1)
+
+
+###################################################
+### code chunk number 14: logit-ExamplePlot
+###################################################
+ plot(s.out1)
+
+
+###################################################
+### code chunk number 15: FirstDifferences.setx
+###################################################
+ z.out2 <- zelig(vote ~ race + educate, model = "logit", data = turnout)
+ x.high <- setx(z.out2, educate = quantile(turnout$educate, prob = 0.75))
+ x.low <- setx(z.out2, educate = quantile(turnout$educate, prob = 0.25))
+
+
+###################################################
+### code chunk number 16: FirstDifferences.sim
+###################################################
+ s.out2 <- sim(z.out2, x = x.high, x1 = x.low)
+
+
+###################################################
+### code chunk number 17: FirstDifferences.summary
+###################################################
+ summary(s.out2)
+
+
+###################################################
+### code chunk number 18: logit-FirstDifferencesPlot
+###################################################
+ plot(s.out2)
+
+
+###################################################
+### code chunk number 19: ROC.zelig
+###################################################
+ z.out1 <- zelig(vote ~ race + educate + age, model = "logit",
+ data = turnout)
+ z.out2 <- zelig(vote ~ race + educate, model = "logit", data = turnout)
+
+
+###################################################
+### code chunk number 20: logit-ROCPlot
+###################################################
+
+rocplot(z.out1$y, z.out2$y, fitted(z.out1), fitted(z.out2))
+
+
+###################################################
+### code chunk number 21: Examples.data
+###################################################
+ data(macro)
+
+
+###################################################
+### code chunk number 22: Examples.zelig
+###################################################
+ z.out1 <- zelig(unem ~ gdp + capmob + trade, model = "ls", data = macro)
+
+
+###################################################
+### code chunk number 23: Examples.summary
+###################################################
+ summary(z.out1)
+
+
+###################################################
+### code chunk number 24: Examples.setx
+###################################################
+ x.high <- setx(z.out1, trade = quantile(macro$trade, 0.8))
+ x.low <- setx(z.out1, trade = quantile(macro$trade, 0.2))
+
+
+###################################################
+### code chunk number 25: Examples.sim
+###################################################
+ s.out1 <- sim(z.out1, x = x.high, x1 = x.low)
+
+
+###################################################
+### code chunk number 26: Examples.summary.sim
+###################################################
+summary(s.out1)
+
+
+###################################################
+### code chunk number 27: Dummy.zelig
+###################################################
+ z.out2 <- zelig(unem ~ gdp + trade + capmob + as.factor(country),
+ model = "ls", data = macro)
+
+
+###################################################
+### code chunk number 28: Dummy.setx
+###################################################
+ x.US <- setx(z.out2, country = "United States")
+ x.Japan <- setx(z.out2, country = "Japan")
+
+
+###################################################
+### code chunk number 29: Dummy.sim
+###################################################
+ s.out2 <- sim(z.out2, x = x.US, x1 = x.Japan)
+
+
+###################################################
+### code chunk number 30: Example.data
+###################################################
+ data(sanction)
+
+
+###################################################
+### code chunk number 31: Example.zelig
+###################################################
+ z.out <- zelig(num ~ target + coop, model = "negbinom", data = sanction)
+
+
+###################################################
+### code chunk number 32: Example.summary
+###################################################
+summary(z.out)
+
+
+###################################################
+### code chunk number 33: Example.setx
+###################################################
+ x.out <- setx(z.out)
+
+
+###################################################
+### code chunk number 34: Example.sim
+###################################################
+ s.out <- sim(z.out, x = x.out)
+
+
+###################################################
+### code chunk number 35: Example.summary.sim
+###################################################
+summary(s.out)
+
+
+###################################################
+### code chunk number 36: negbinom-Example1Plot
+###################################################
+ plot(s.out)
+
+
+###################################################
+### code chunk number 37: Examples.data
+###################################################
+ data(macro)
+
+
+###################################################
+### code chunk number 38: Examples.zelig
+###################################################
+ z.out1 <- zelig(unem ~ gdp + capmob + trade, model = "normal",
+ data = macro)
+
+
+###################################################
+### code chunk number 39: Examples.summary
+###################################################
+ summary(z.out1)
+
+
+###################################################
+### code chunk number 40: Examples.setx
+###################################################
+ x.high <- setx(z.out1, trade = quantile(macro$trade, 0.8))
+ x.low <- setx(z.out1, trade = quantile(macro$trade, 0.2))
+
+
+###################################################
+### code chunk number 41: Examples.sim
+###################################################
+ s.out1 <- sim(z.out1, x = x.high, x1 = x.low)
+
+
+###################################################
+### code chunk number 42: Examples.summary.sim
+###################################################
+ summary(s.out1)
+
+
+###################################################
+### code chunk number 43: normal-ExamplesPlot
+###################################################
+ plot(s.out1)
+
+
+###################################################
+### code chunk number 44: Dummy.zelig
+###################################################
+ z.out2 <- zelig(unem ~ gdp + trade + capmob + as.factor(year)
+ + as.factor(country), model = "normal", data = macro)
+
+
+###################################################
+### code chunk number 45: Dummy.setx
+###################################################
+### x.US <- try(setx(z.out2, country = "United States"),silent=T)
+### x.Japan <- try(setx(z.out2, country = "Japan"),silent=T)
+
+
+###################################################
+### code chunk number 46: Dummy.sim
+###################################################
+### s.out2 <- try(sim(z.out2, x = x.US, x1 = x.Japan), silent=T)
+
+
+###################################################
+### code chunk number 47: Dummy.summary
+###################################################
+###try(summary(s.out2))
+
+
+###################################################
+### code chunk number 48: Example.data
+###################################################
+ data(sanction)
+
+
+###################################################
+### code chunk number 49: Example.zelig
+###################################################
+ z.out <- zelig(num ~ target + coop, model = "poisson", data = sanction)
+
+
+###################################################
+### code chunk number 50: Example.summary
+###################################################
+summary(z.out)
+
+
+###################################################
+### code chunk number 51: Example.setx
+###################################################
+ x.out <- setx(z.out)
+
+
+###################################################
+### code chunk number 52: Example.sim
+###################################################
+ s.out <- sim(z.out, x = x.out)
+
+
+###################################################
+### code chunk number 53: Example.summary.sim
+###################################################
+summary(s.out)
+
+
+###################################################
+### code chunk number 54: poisson-ExamplePlot
+###################################################
+ plot(s.out)
+
+
+###################################################
+### code chunk number 55: Examples.data
+###################################################
+ data(turnout)
+
+
+###################################################
+### code chunk number 56: Examples.zelig
+###################################################
+ z.out <- zelig(vote ~ race + educate, model = "probit", data = turnout)
+
+
+###################################################
+### code chunk number 57: Examples.summary
+###################################################
+ summary(z.out)
+
+
+###################################################
+### code chunk number 58: Examples.setx
+###################################################
+ x.out <- setx(z.out)
+
+
+###################################################
+### code chunk number 59: Examples.sim
+###################################################
+s.out <- sim(z.out, x = x.out)
+
+
+###################################################
+### code chunk number 60: Examples.summary.sim
+###################################################
+summary(s.out)
+
+
diff --git a/inst/doc/manual.pdf b/inst/doc/manual.pdf
index f509b03..0d9cf40 100644
Binary files a/inst/doc/manual.pdf and b/inst/doc/manual.pdf differ
diff --git a/inst/doc/normal.pdf b/inst/doc/normal.pdf
index d56377f..c793c06 100644
Binary files a/inst/doc/normal.pdf and b/inst/doc/normal.pdf differ
diff --git a/inst/doc/twosls.R b/inst/doc/twosls.R
new file mode 100644
index 0000000..8421f39
--- /dev/null
+++ b/inst/doc/twosls.R
@@ -0,0 +1,56 @@
+### R code from vignette source 'twosls.Rnw'
+
+###################################################
+### code chunk number 1: loadLibrary
+###################################################
+library(Zelig)
+
+
+###################################################
+### code chunk number 2: Inputs.list
+###################################################
+ fml <- list ("mu" = Y ~ X + Z,
+ "inst" = Z ~ W + X)
+
+
+###################################################
+### code chunk number 3: Examples.data
+###################################################
+ data(klein)
+
+
+###################################################
+### code chunk number 4: Examples.list
+###################################################
+ formula <- list(mu1=C~Wtot + P + P1,
+ mu2=I~P + P1 + K1,
+ mu3=Wp~ X + X1 + Tm,
+ inst= ~ P1 + K1 + X1 + Tm + Wg + G)
+
+
+###################################################
+### code chunk number 5: Examples.zelig
+###################################################
+ z.out<-zelig(formula=formula, model="twosls",data=klein)
+ summary(z.out)
+
+
+###################################################
+### code chunk number 6: Examples.setx
+###################################################
+ x.out <- setx(z.out)
+
+
+###################################################
+### code chunk number 7: Examples.sim
+###################################################
+s.out <-sim(z.out,x=x.out)
+ summary(s.out)
+
+
+###################################################
+### code chunk number 8: Examplestwosls
+###################################################
+plot(s.out)
+
+
diff --git a/inst/doc/twosls.pdf b/inst/doc/twosls.pdf
index 69ae436..8856177 100644
Binary files a/inst/doc/twosls.pdf and b/inst/doc/twosls.pdf differ
diff --git a/inst/po/en/LC_MESSAGES/R-Zelig.mo b/inst/po/en/LC_MESSAGES/R-Zelig.mo
deleted file mode 100644
index e69de29..0000000
diff --git a/man/friendship.Rd b/man/friendship.Rd
index cf92655..7ec56eb 100644
--- a/man/friendship.Rd
+++ b/man/friendship.Rd
@@ -20,8 +20,8 @@ The sociomatrices were combined into the friendship dataset using the format.net
\examples{
\dontrun{
- friendship <- format.network.data(friends, advice, prestige, authority, perpower, per)
- }}
+friendship <- format.network.data(friends, advice, prestige, authority, perpower, per)
+}}
\keyword{datasets}
diff --git a/man/plot.MI.sim.Rd b/man/plot.MI.sim.Rd
index 460cdde..c4aff50 100644
--- a/man/plot.MI.sim.Rd
+++ b/man/plot.MI.sim.Rd
@@ -2,9 +2,10 @@
\alias{plot.MI.sim}
\title{Plot graphs of simulated multiply-imputed data}
\usage{
- \method{plot}{MI.sim}(...)
+ \method{plot}{MI.sim}(x, ...)
}
\arguments{
+ \item{x}{A zelig `sim' object, with multiply imputed data}
\item{...}{ignored parameters}
}
\value{
diff --git a/man/plot.ci.Rd b/man/plot.ci.Rd
index 2ca904f..4328d2a 100644
--- a/man/plot.ci.Rd
+++ b/man/plot.ci.Rd
@@ -2,17 +2,17 @@
\alias{plot.ci}
\title{Method for plotting pooled simulations by confidence intervals}
\usage{
- \method{plot}{ci}(x, qi="ev", var=NULL, ..., main = NULL, sub = NULL, xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, legcol="gray20", col=NULL, leg=1, legpos=NULL)
+ \method{plot}{ci}(x, qi="ev", var=NULL, ..., main = NULL, sub = NULL, xlab = NULL,
+ ylab = NULL, xlim = NULL, ylim = NULL, legcol="gray20", col=NULL, leg=1, legpos=NULL,
+ ci=c(80,95,99.9))
}
\arguments{
\item{x}{A `sim' object}
\item{qi}{a character-string specifying the quantity of
- interest to plot}
-
- \item{var}{The variable to be used on the x-axis. Default
- is the variable across all the chosen values with
- smallest nonzero variance}
+ interest to plot: "ev" expected values, "pv" predicted values, "fd" first differences}
+
+ \item{var}{The variable to be used on the x-axis}
\item{...}{Parameters to be passed to the `truehist'
function which is implicitly called for numeric
@@ -42,13 +42,16 @@
\item{legpos}{``legend type'', exact coordinates and
sizes for legend. Overrides argment ``leg.type''}
+
+ \item{ci}{A vector of length up to 3, specifying the three confidence interval levels to
+ plot on the graph (where confidence is expressed on the scale 0-100).}
}
\value{
the current graphical parameters. This is subject to
change in future implementations of Zelig
}
\description{
- Plot confidence intervals of pooled simulated values.
+ Plot confidence intervals of simulated quantities of interest, across a range of a variable.
}
\author{
James Honaker, adapted by Matt Owen
diff --git a/man/plot.pooled.sim.Rd b/man/plot.pooled.sim.Rd
index 9ff2852..2761fed 100644
--- a/man/plot.pooled.sim.Rd
+++ b/man/plot.pooled.sim.Rd
@@ -2,7 +2,9 @@
\alias{plot.pooled.sim}
\title{Method for plotting pooled simulations by confidence intervals}
\usage{
- \method{plot}{pooled.sim}(x, qi="ev", var=NULL, ..., main = NULL, sub = NULL, xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, legcol="gray20", col=NULL, leg=1, legpos=NULL)
+ \method{plot}{pooled.sim}(x, qi="ev", var=NULL, ..., main = NULL, sub = NULL,
+ xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, legcol="gray20", col=NULL, leg=1,
+ legpos=NULL, ci=c(80,95,99.9))
}
\arguments{
\item{x}{A `sim' object}
@@ -42,6 +44,9 @@
\item{legpos}{``legend type'', exact coordinates and
sizes for legend. Overrides argment ``leg.type''}
+
+ \item{ci}{A numeric triple, specifying the three levels
+ to plot confidence intervals for, scaled 0 to 100}
}
\value{
the current graphical parameters. This is subject to
diff --git a/man/zelig2-bayes.Rd b/man/zelig2-bayes.Rd
index 28e3092..dff7038 100644
--- a/man/zelig2-bayes.Rd
+++ b/man/zelig2-bayes.Rd
@@ -11,7 +11,8 @@
\title{Zelig Bridge Functions to Bayesian Models}
\usage{
- zelig2factor.bayes(formula, factors = 2, burnin = 1000, mcmc = 20000, verbose = 0, ..., data)
+ zelig2factor.bayes(formula, factors = 2, burnin = 1000, mcmc = 20000, verbose = 0, ...,
+ data)
zelig2logit.bayes(formula, burnin = 1000, mcmc = 10000, verbose = 0, ..., data)
zelig2mlogit.bayes(formula, burnin = 1000, mcmc = 10000, verbose = 0, ..., data)
zelig2normal.bayes(formula, burnin = 1000, mcmc = 10000, verbose = 0, ..., data)
diff --git a/man/zeligBuildWeights.Rd b/man/zeligBuildWeights.Rd
new file mode 100644
index 0000000..c45ee28
--- /dev/null
+++ b/man/zeligBuildWeights.Rd
@@ -0,0 +1,47 @@
+\name{zeligBuildWeights}
+\alias{zeligBuildWeights}
+\title{Developer Utility Function for Dealing with Observation Weighting}
+\usage{
+ zeligBuildWeights(weights=NULL, repweights=NULL, zeros="zeros", rebuild=FALSE,
+ allowweights=TRUE, allowrepweights=TRUE, data=NULL)
+}
+\arguments{
+\item{weights}{A set of non-negative value weights. Overrides repweights if defined.}
+\item{repweights}{A set of whole number (non-negative integer) weights. Useful if
+ weights are just for making copies of or deleting certain observations or for
+ frequency weights.}
+\item{zeros}{An option on how to deal with zero valued user supplied weights.
+ Default of "zero" allows zero weights, "epsilon" changes zeroes to 1e-08,
+ "remove" removes those observations from the dataset.}
+\item{rebuild}{An option to allow specified repweights to reconfigure the
+ rows of the dataset to rebuild a corresponding dataset where every row is
+ of weight 1. Useful if analysis model does not accept weights.}
+\item{allowweights}{Defines if weights are allowed in model.}
+\item{allowrepweights}{Defines if repweights are allowed in model. Overridden if
+ \code{useweights=TRUE}.}
+\item{data}{Dataset, required if weights are defined by variable name, or if
+ dataset is to be reconfigured (by \code{rebuild} or \code{zeros} options)}
+}
+\value{
+\item{weights}{A vector of weights of the structure defined by the developer and
+ required by the analysis model. Or NULL if certain checks are failed.}
+\item{data}{A reconfigured dataset, if modified.}
+}
+\description{
+ The \code{zeligBuildWeights} utility allows developers
+ building models or modules for Zelig, to easily define
+ what types of weights can be set by the user and passed
+ to estimation function. In some cases it can reconfigure
+ the dataset by duplication to functionally invoke discrete
+ weighting by replication of observations, when the estimator
+ itself can not utilize weights.
+}
+\author{
+ James Honaker \email{jhonaker at iq.harvard.edu}
+}
+\seealso{
+ The full Zelig developer manual may be accessed online at
+ \url{http://gking.harvard.edu/zelig}
+}
+\keyword{weights}
+
diff --git a/messages/templates/en/describe.canned b/messages/templates/en/describe.canned
deleted file mode 100644
index d0aed58..0000000
--- a/messages/templates/en/describe.canned
+++ /dev/null
@@ -1,21 +0,0 @@
-"describe canned"
-describe.<<model name>> <- function () {
-package <- list(name="stats",
-version=".9"
-)
-
-# edit the below line to add a description
-# to this zelig model
-description <- "a zelig model"
-
-# edit the below with information about
-# the model that this zelig module is based on
-# the citation year may differ than the auto-generated one
-list(category = "",
-authors = "<<author>>",
-year = <<year>>,
-description = description,
-package = package,
-parameters=list(list())
-)
-}
diff --git a/messages/templates/en/describe.credit b/messages/templates/en/describe.credit
deleted file mode 100644
index e9c4fea..0000000
--- a/messages/templates/en/describe.credit
+++ /dev/null
@@ -1,7 +0,0 @@
-"describe credit"
-# @author: <<author>>
-# @date: <<date>>
-# .<<model>>.R
-# auto-generated by zkeleton, written by Matt Owen
-# info: describe.<<model>> generates citation information
-# for the zelig model <<model>>
diff --git a/messages/templates/en/describe.how.to b/messages/templates/en/describe.how.to
deleted file mode 100644
index 67af97c..0000000
--- a/messages/templates/en/describe.how.to
+++ /dev/null
@@ -1,11 +0,0 @@
-"describe how-to"
-# HOW-TO WRITE A DESCRIBE FUNCTION
-# ================================
-# 1. Fill in the "description" variable with a *short*
-# description of the model. e.g. "multinomial probit model"
-# 2. Fill in the return-value for "category"
-# 3. Fill in the return-value for "authors" with either:
-# i. <<author name>>, or
-# ii. c(<<author 1>>, <author 2>>, <<author 3>>, ...)
-# 4. Fill in the return-value for "year"
-# 5. <optional> Fill in the package variable
diff --git a/messages/templates/en/print.summary.sim.canned b/messages/templates/en/print.summary.sim.canned
deleted file mode 100644
index a0d710e..0000000
--- a/messages/templates/en/print.summary.sim.canned
+++ /dev/null
@@ -1,37 +0,0 @@
-"print.summary.sim canned"
-print.summary.sim.<<model name>> <- function (obj, digits=F, print.x=F, ...) {
- # prints typically have qi, and qi.names defined as part of the summary object
- if (is.null(obj$qi.stat) || is.null(obj$qi.name)) {
- stop("Error: ")
- }
-
- # warn if name lists do not match
- if (any(sort(names(obj$qi.stat)) != sort(names(obj$qi.name)))) {
- warning("warning: quantities of interest do not match its name list")
- }
-
- print(obj$original)
-
- for (key in names(obj$qi.stat)) {
- # value
- val <- obj$qi.stat[[key]]
-
- # pass-by conditions
- if (is.na(val) || (is.list(val) && !length(val)) || is.null(val))
- next
-
- # print the title of the qi
- s <- gsub("\\s+$", "", obj$qi.name[[key]])
- message(s)
- message(rep("=", min(nchar(s), 30)))
-
- # print the qi (should be a simple data-type, such as matrix or float)
- print(val)
-
- # line-feed
- message()
- }
-
- # return invisibly
- invisible(obj)
-}
diff --git a/messages/templates/en/print.summary.sim.credit b/messages/templates/en/print.summary.sim.credit
deleted file mode 100644
index 69d71bd..0000000
--- a/messages/templates/en/print.summary.sim.credit
+++ /dev/null
@@ -1,7 +0,0 @@
-"print.summary.sim credit"
-# @author: <<author>>
-# @date: <<date>>
-# .<<model>>.R
-# auto-generated by zkeleton, written by Matt Owen
-# info: print.summary.sim.<<model>>.R outputs summary
-# information from the zelig model <<model>>
diff --git a/messages/templates/en/print.summary.sim.how.to b/messages/templates/en/print.summary.sim.how.to
deleted file mode 100644
index 39832e0..0000000
--- a/messages/templates/en/print.summary.sim.how.to
+++ /dev/null
@@ -1,9 +0,0 @@
-"print.summary.sim how-to"
-# HOW TO WRITE A PRINT.SUMMARY.SIM FUNCTION
-# =========================================
-# 0. print.summary functions typically display the result
-# from a summary object (a list) in an organized fashion
-# with various text-formatting.
-# 1. for most purpose the default print function (below) should
-# work, however, various formatting, etc. can be added typically
-# without any impact on the operation of the program
diff --git a/messages/templates/en/qi.canned b/messages/templates/en/qi.canned
deleted file mode 100644
index d650343..0000000
--- a/messages/templates/en/qi.canned
+++ /dev/null
@@ -1,36 +0,0 @@
-"qi canned"
-# @obj: zelig object
-# @simpar: parameters passed to the qi
-# return: qi list (qi.stat) and qi.names list (qi.name)
-
-# NOTE THIS FILE MUST ALWAYS BE EDITED!!!!
-# IT IS THE MOST IMPORTANT COMPONENT TO
-# ANY ZELIG MODULE
-qi.<<model name>> <- function(obj, simpar=NULL, x, x1=NULL, y=NULL) {
- # initialize values that necessarily must be
- # returned.
- qi.stat <- list()
- qi.name <- list()
-
-
- # add entries to qi.stat and qi.name
- # in the end, names(qi.stat) should == names(qi.name)
- # so that printing can be handled by the auto-generated
- # function
-
- # ...
-
-
- # qi computation must be written by the developer,
- # as it is impossible to tell automatically what is
- # the statistic of interest (or how to compute it)
-
- # ...
-
-
- # compute the quantities of interest
- # of this model
- list(qi.stat=qi.stat,
- qi.name=qi.name
- )
-}
diff --git a/messages/templates/en/qi.credit b/messages/templates/en/qi.credit
deleted file mode 100644
index 56de075..0000000
--- a/messages/templates/en/qi.credit
+++ /dev/null
@@ -1,6 +0,0 @@
-"qi credit"
-# @author: <<author>>
-# @date: <<date>>
-# qi.<<model name>>, auto-generated by zkeleton, written by Matt Owen
-# ===========================
-# info: produced quantities of interest for zelig model <<model>>
diff --git a/messages/templates/en/qi.how.to b/messages/templates/en/qi.how.to
deleted file mode 100644
index 14af23c..0000000
--- a/messages/templates/en/qi.how.to
+++ /dev/null
@@ -1,29 +0,0 @@
-"qi how-to"
-# HOW-TO WRITE A QI FILE
-# ======================
-# qi functions are the heart of any zelig module.
-# The qi function is passed information from the setx
-# function (via x, x1), parameters (simpar), and the
-# original zelig model (obj or object)
-# The developer (you) then writes the software that he/she
-# believes produces a significant quantity of interest.
-# The result should always be returned in the fashion
-# list(qi.stat=qi.stat
-# qi.name=qi.name
-# )
-# where qi.stat is a list of qi.stat and qi.name have the form
-# qi.stat <- list(qi.1 = <<qi.1>>,
-# qi.2 = <<qi.2>>,
-# qi.3 = <<qi.3>>,
-# ...
-# )
-#
-# qi.name <- list(qi.1 = <<qi.1 name>>,
-# qi.2 = <<qi.2 name>>,
-# qi.3 = <<qi.3 name>>,
-# ...
-# )
-#
-# qi.1, qi.2, etc. should be named in an easy to comprehend manner
-# the indices of qi.stat and qi.name (qi.1, qi.2, etc.) should match,
-# otherwise a warning will be displayed during the print stage
diff --git a/messages/templates/en/setx.canned b/messages/templates/en/setx.canned
deleted file mode 100644
index 39baf60..0000000
--- a/messages/templates/en/setx.canned
+++ /dev/null
@@ -1,18 +0,0 @@
-"setx canned"
-setx.<<model name>> <- function(obj, data=NULL, ...) {
-# send to default
-res <- setx.default(obj, ...)
-
-# cast as appropriate data-type, then return
-class(res) <- "setx.<<model name>>"
-
-# attach data frame here, if the model
-# requires sophisticated number-crunching
-# after setx is called
-# if not, remove the below line
-if (!is.null(data)) {
-res$data <- data
-}
-
-res
-}
diff --git a/messages/templates/en/setx.credit b/messages/templates/en/setx.credit
deleted file mode 100644
index e640503..0000000
--- a/messages/templates/en/setx.credit
+++ /dev/null
@@ -1,7 +0,0 @@
-"setx credit"
-# @author: <<author>>
-# @date: <<date>>
-# setx.<<model name>>
-# auto-generated by zkeleton, written by Matt Owen
-# info: produces data based on the explanatory variables
-# in the model (set by user, not developer)
diff --git a/messages/templates/en/setx.how.to b/messages/templates/en/setx.how.to
deleted file mode 100644
index 8129c39..0000000
--- a/messages/templates/en/setx.how.to
+++ /dev/null
@@ -1,22 +0,0 @@
-"setx how-to"
-# HOW-TO WRITE A SETX FUNCTION
-# ============================
-# 0. For most purposes setx.default will compute
-# correctly values of interest, which are needed
-# to compute the quantities of interest. However,
-# some models will not provide data in the correct
-# fashion, etc. (e.g. computing a covariance matrix
-# of the explanatory variables may not make sense
-# or be relevant for certain models)
-# 1. parameters are passed in as a zelig model and potentially
-# a new data-set. The new data-set is used in place of the
-# original one that was passed into zelig. This
-# 2. the result of the setx function should be of class
-# "setx.<<model name>>"
-# this is important, because it ensures that the correct
-# qi function and sim function are called
-# 3. <optional> the data frame used to compute this setx may
-# be attached with the line
-# res$data <- data
-# if the sim function needs to make further computations
-# if this is not the case, please omit that line
diff --git a/messages/templates/en/sim.canned b/messages/templates/en/sim.canned
deleted file mode 100644
index e16427b..0000000
--- a/messages/templates/en/sim.canned
+++ /dev/null
@@ -1,32 +0,0 @@
-"sim canned"
-sim.<<model name>> <- function(obj,
-x=NULL,
-x1=NULL,
-num=c(1000, 100),
-prev = NULL,
-cond.data = NULL, ...
-) {
-# error-catching
-if (is.null(x))
-stop("Error: x cannot be NULL")
-
-# simulate qi's for x
-# invoke qi.<model name>
-res <- qi.<<model name>>(obj, x=x, x1=x1)
-
-# change call name
-obj$call[[1]] <- as.name("sim")
-
-
-# append
-res$call <- match.call(expand.dots=T)
-res$zelig.call <- obj$call
-res$par <- NA
-res$obj <- obj
-
-# change class so correct summary/print function
-# can be called
-class(res) <- "sim.<<model name>>"
-
-res
-}
diff --git a/messages/templates/en/sim.credit b/messages/templates/en/sim.credit
deleted file mode 100644
index b5b5f01..0000000
--- a/messages/templates/en/sim.credit
+++ /dev/null
@@ -1,8 +0,0 @@
-"sim credit"
-# @author: <<author>>
-# @date: <<date>>
-# sim.<<model>>.R
-# auto-generated by zkeleton, written by Matt Owen
-# info: simulates quantities of interest, then arranges
-# the data in an easily interprettable manner.
-# invokes qi.<<model>>.R
diff --git a/messages/templates/en/sim.how.to b/messages/templates/en/sim.how.to
deleted file mode 100644
index 26f9a4c..0000000
--- a/messages/templates/en/sim.how.to
+++ /dev/null
@@ -1,16 +0,0 @@
-"sim how-to"
-# HOW-TO WRITE A SIM FUNCTION
-# ===========================
-# 0. The sim function invokes the qi function.
-# Then, returns the quantities of interests
-# alongside a host of other relevant data, that
-# is presented along with summary and print
-# 1. importantly, sim should always have the line:
-# res <- qi(obj, x=x, x1=x1)
-# this enesure that the qi's are computed with the
-# exact parameters that enter the sim function itself
-# 2. the call to sim and the call should be returned along
-# with the quantities of interest (qi.stat) and their
-# titles (qi.name)
-# 3. the returned object should have class type:
-# "sim.<<model name>>:
diff --git a/messages/templates/en/sim.setx.canned b/messages/templates/en/sim.setx.canned
deleted file mode 100644
index bcaaca0..0000000
--- a/messages/templates/en/sim.setx.canned
+++ /dev/null
@@ -1,8 +0,0 @@
-"sim.setx canned"
-sim.setx.<<model name>> <- function (obj, x, ...) {
-# this function exists so that if
-# sim(obj) and sim(obj, x) should have radically
-# different behavior, we will be able to place them
-# in seperate files easily
-sim.<<model name>>(obj, x, ...)
-}
diff --git a/messages/templates/en/sim.setx.credit b/messages/templates/en/sim.setx.credit
deleted file mode 100644
index 6dfa9bd..0000000
--- a/messages/templates/en/sim.setx.credit
+++ /dev/null
@@ -1,8 +0,0 @@
-"sim.setx credit"
-# @author: <<author>>
-# @date: <<date>>
-# sim.setx.<<model>>.R
-# auto-generated by zkeleton, written by Matt Owen
-# info: simulates qi's when additional explanatory
-# information is provided. usually simply
-# invokes the method specified in sim.<<model>>.R
diff --git a/messages/templates/en/sim.setx.how.to b/messages/templates/en/sim.setx.how.to
deleted file mode 100644
index 7cb2233..0000000
--- a/messages/templates/en/sim.setx.how.to
+++ /dev/null
@@ -1,28 +0,0 @@
-"sim.setx how-to"
-# HOW-TO WRITE A SIM.SETX FILE
-# ============================
-# 0. sim.setx functions offer alternative ways
-# to simulate quantities of interest. That is,
-# sim functions are called in this fashion
-# sim(zelig.out)
-#
-# while sim.setx functs are called as:
-# sim(zelig.out, x)
-# or
-# sim(zelig.out, x, x1)
-#
-# this allows the developer to separate
-# the different types of simulation algorithms
-# that may exist for his or her model
-#
-# if the model simulates quantities of interest
-# identically to that of the standard sim function
-# it should then only contain the line:
-# sim.<<model name>>(obj, x, ...)
-#
-# 1. invoke qi with
-# qi(obj, x=x, x=x1)
-#
-# do relevant computation on the return quantities
-# of interest, and attach relevant data that needs
-# to be passed to print and summary functions
diff --git a/messages/templates/en/summary.sim.canned b/messages/templates/en/summary.sim.canned
deleted file mode 100644
index c1f74ae..0000000
--- a/messages/templates/en/summary.sim.canned
+++ /dev/null
@@ -1,18 +0,0 @@
-"summary.sim canned"
-summary.sim.<<model name>> <- function(obj, ...) {
-# set important summary objects
-# zelig models always have qi.stat, and qi.name
-# elements
-res <- list(model="mprobit",
-qi.stat = obj$qi.stat,
-qi.name = obj$qi.name,
-original = obj$obj,
-call = obj$call,
-zelig.call = obj$zelig.call
-)
-
-# cast as class
-class(res) <- "summary.sim.<<model name>>"
-
-res
-}
diff --git a/messages/templates/en/summary.sim.credit b/messages/templates/en/summary.sim.credit
deleted file mode 100644
index 2a61755..0000000
--- a/messages/templates/en/summary.sim.credit
+++ /dev/null
@@ -1,7 +0,0 @@
-"summary.sim credit"
-# @author: <<author>>
-# @date: <<date>>
-# summary.sim.<<model>>.R
-# auto-generated by zkeleton, written by Matt Owen
-# info: returns a list of data summarizing the sim object
-# should always include qi.stat, qi.name entry
diff --git a/messages/templates/en/summary.sim.how.to b/messages/templates/en/summary.sim.how.to
deleted file mode 100644
index 9f5b9ad..0000000
--- a/messages/templates/en/summary.sim.how.to
+++ /dev/null
@@ -1,24 +0,0 @@
-"summary.sim how-to"
-# HOW TO WRITE A SUMMARY.SIM FUNCTION
-# ===================================
-# 0. summary.sim functions exclusively return
-# a list of important data, *summarizing*
-# important features of the result of the sim
-# function
-# 1. like summaries of most objects, the result should
-# contain a reference to the call that created it,
-# information on the class-type, etc.:
-# list(call = obj$call,
-# zelig.call = obj$zelig.call,
-# ...)
-# 2. importantly, summary.sim must return a qi.stat
-# and a qi.name data object. the indices of these
-# objects must have the same values for consistency
-# that is, names(qi.stat) == names(qi.name)
-# the return should resemble:
-# list(
-# qi.stat = obj$qi.stat,
-# qi.name = obj$qi.name,
-# call = obj$call,
-# zelig.call = obj$zelig.call
-# ...)
diff --git a/messages/templates/en/zelig2.canned b/messages/templates/en/zelig2.canned
deleted file mode 100644
index bce3b0b..0000000
--- a/messages/templates/en/zelig2.canned
+++ /dev/null
@@ -1,17 +0,0 @@
-"zelig2 canned"
-zelig2<<model name>> <- function (formula, model, data, M, ...) {
-# this file acts as an interface to the original model
-# the return ("mf") is a function call that zelig will later invoke
-# in order to process the specified data set
-#
-# any parameters unnecessary to the model
-# should be set to NULL (e.g. mf$M, mf$robust, etc...)
-
-mf <- match.call(expand.dots=T)
-mf$M <- mf$robust <- NULL
-mf[[1]] <- <<model function>>
-mf$model <- NULL
-mf$data <- data
-mf$formula <- formula
-as.call(mf)
-}
diff --git a/messages/templates/en/zelig2.credit b/messages/templates/en/zelig2.credit
deleted file mode 100644
index 3363a00..0000000
--- a/messages/templates/en/zelig2.credit
+++ /dev/null
@@ -1,7 +0,0 @@
-"zelig2 credit"
-# @author: <<author>>
-# @date: <<date>>
-# zelig2<<model>>.R
-# auto-generated by zkeleton, written by Matt Owen
-# info: re-interprets parameters passed into zelig as
-# legal parameters to pass into <<model function>>
diff --git a/messages/templates/en/zelig2.how.to b/messages/templates/en/zelig2.how.to
deleted file mode 100644
index c716544..0000000
--- a/messages/templates/en/zelig2.how.to
+++ /dev/null
@@ -1,25 +0,0 @@
-"zelig2 how-to"
-# 0. the zelig2 function acts as an interface between
-# the existing model and the zelig module that is
-# being created.
-# 1. construct a call object containing all the parameters
-# passed into "zelig2<<model name>>"
-# 2. remove all parameters that will not make sense within
-# the original model (in the demo code, e.g. robust, M, etc.)
-# 3. re-assign the call object's first entry to the name of the
-# model that must be called.
-# This step is crucial, as it is how your model invokes the
-# pre-existing model's name
-# 4. attach the data frame (mf$data <- data)
-# 5. return the call (as a call)
-#
-# NOTE: the returned value is going to be evaluated, and -
-# as a result - call the pre-existing model. Any
-# parameters passed to the original zelig function
-# will be forwarded to the model unless set to NULL
-#
-#
-# NOTE: THIS FUNCTION IS INVOKED BY THE ZELIG FUNCTION
-# (NOT THE USER)
-#
-# call order: zelig -> zelig2<<model name>>"
diff --git a/messages/templates/en/zelig3.canned b/messages/templates/en/zelig3.canned
deleted file mode 100644
index 0ef1cf8..0000000
--- a/messages/templates/en/zelig3.canned
+++ /dev/null
@@ -1,11 +0,0 @@
-"zelig3 canned"
-zelig3<<model name>> <- function (res, ...) {
-class(res) <- c("<<model name>>", class(res))
-
-# give it a terms object
-if (is.null(res$terms))
-res$terms <- terms(res$call$formula)
-
-# return
-res
-}
diff --git a/messages/templates/en/zelig3.credit b/messages/templates/en/zelig3.credit
deleted file mode 100644
index 92d9bc6..0000000
--- a/messages/templates/en/zelig3.credit
+++ /dev/null
@@ -1,8 +0,0 @@
-"zelig3 credit"
-# @author: <<author>>
-# @date: <<date>>
-# zelig3<<model>>.R
-# auto-generated by zkeleton, written by Matt Owen
-# info: not always necessary, but is useful to cast data
-# the result of a zelig2* call into whatever data-type
-# we want our setx function to work with
diff --git a/messages/templates/en/zelig3.how.to b/messages/templates/en/zelig3.how.to
deleted file mode 100644
index 44a87a7..0000000
--- a/messages/templates/en/zelig3.how.to
+++ /dev/null
@@ -1,16 +0,0 @@
-"zelig3 how-to"
-# HOW-TO WRITE A ZELIG3 FUNCTION
-# ==============================
-# 0. zelig3 functions act as in-betweens between
-# the zelig2 function and the zelig and sim function.
-# That is, after the model runs its initial computations,
-# it is often important to cast the result as an object of
-# the class which it is named after. This is crucial to
-# ensure that setx invokes the correct method
-# 1. set the class of the res passed into with the line:
-# class(res) <- class("<<model name>>", class(res))
-# 2. return the obj (with class newly extended)
-#
-# NOTE: if the class "<<model name>>" is not added, the function
-# setx.default will be used, which may have unexpected
-# results
diff --git a/tests/plot-ci.R b/tests/plot-ci.R
index 6b6013d..f0b7133 100644
--- a/tests/plot-ci.R
+++ b/tests/plot-ci.R
@@ -5,14 +5,9 @@ data(turnout)
par(mfrow=c(2, 2))
z <- zelig(vote ~ income + educate, model="relogit", data=turnout)
-x <- setx(z, educate=-5:8)
-s <- sim(z, x)
-
-plot(s, var = "educate")
-
-z <- zelig(vote ~ income + educate, model="logit", data=turnout)
-x <- setx(z, educate=0:5)
-s <- sim(z, x)
+x <- setx(z, educate=2:8)
+x1 <- setx(z, educate=2:8, income = 10)
+s <- sim(z, x, x1)
plot.ci(s, var="educate")
diff --git a/vignettes/Sweave.sty b/vignettes/Sweave.sty
deleted file mode 100644
index a76e1bd..0000000
--- a/vignettes/Sweave.sty
+++ /dev/null
@@ -1,33 +0,0 @@
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{Sweave}{}
-
-\RequirePackage{ifthen}
-\newboolean{Sweave at gin}
-\setboolean{Sweave at gin}{true}
-\newboolean{Sweave at ae}
-\setboolean{Sweave at ae}{true}
-
-\DeclareOption{nogin}{\setboolean{Sweave at gin}{false}}
-\DeclareOption{noae}{\setboolean{Sweave at ae}{false}}
-\ProcessOptions
-
-\RequirePackage{graphicx,fancyvrb}
-\IfFileExists{upquote.sty}{\RequirePackage{upquote}}{}
-
-\ifthenelse{\boolean{Sweave at gin}}{\setkeys{Gin}{width=0.8\textwidth}}{}%
-\ifthenelse{\boolean{Sweave at ae}}{%
- \RequirePackage[T1]{fontenc}
- \RequirePackage{ae}
-}{}%
-
-\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl}
-\DefineVerbatimEnvironment{Soutput}{Verbatim}{}
-\DefineVerbatimEnvironment{Scode}{Verbatim}{fontshape=sl}
-
-\newenvironment{Schunk}{}{}
-
-\newcommand{\Sconcordance}[1]{%
- \ifx\pdfoutput\undefined%
- \csname newcount\endcsname\pdfoutput\fi%
- \ifcase\pdfoutput\special{#1}%
- \else\immediate\pdfobj{#1}\fi}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/r-cran-zelig.git
More information about the debian-science-commits
mailing list