repl {Zelig} | R Documentation |
The generic function repl
command takes
zelig
or
sim
output objects and replicates (literally, re-runs)
the entire analysis. The results should be an output
object
identical to the original input object in the case of
zelig
output. In the case of sim
output, the replicated analyses may differ slightly due to
stochastic randomness in the simulation procedure.
repl(object, data, ...) ## Default S3 method: repl(object, data = NULL, ...) ## S3 method for class 'zelig': repl(object, data = NULL, prev = NULL, x = NULL, x1 = NULL, bootfn = NULL, ...)
object |
Stored output from either zelig or
sim . |
data |
You may manually input the data frame name rather
than allowing repl to draw the data frame name from the object
to be replicated. |
prev |
When replicating sim output, you may
optionally use the previously simulated parameters to calculate the
quantities of interest rather than simulating a new set of
parameters. For all models, this should produce identical
quantities of interest. In addition, for if the parameters were
bootstrapped in the original analysis, this will save a considerable
amount of time. |
x |
When replicating sim output, you may
optionally use an alternative setx value for the x
input. |
x1 |
When replicating sim output, you may
optionally use an alternative setx object for the x1
input to replicating the sim object. |
bootfn |
When replicating sim output with
bootstrapped parameters, you should manually specify the
bootfn if a non-default option was used. |
... |
Additional arguments passed to either zelig or
sim . |
For zelig
output, repl
will create output that is in
every way identical to the original input. You may check to see
whether they are identical by using the identical
command.
For sim
output, repl
output will be will be
identical to the original object if you choose not to simulate new
parameters, and instead choose to calculate quantities of interest
using the previously simulated parameters (using the prev
option. If you choose to simulate new parameters, the summary
statistics for each quantity of interest should be identical, up to a
random approximation error. As the number of simulations increases,
this error decreases.
Kosuke Imai <kimai@princeton.edu>; Gary King <king@harvard.edu>; Olivia Lau <olau@fas.harvard.edu>
zelig
, setx
, and
sim
. In addition, the full Zelig manual may be
accessed online at http://gking.harvard.edu/zelig.
data(turnout) z.out <- zelig(vote ~ race + educate, model = "logit", data = turnout[1:1000,]) x.out <- setx(z.out) s.out <- sim(z.out, x = x.out) z.rep <- repl(z.out) identical(z.out$coef, z.rep$coef) z.alt <- repl(z.out, data = turnout[1001:2000,]) s.rep <- repl(s.out, prev = s.out$par) identical(s.out$ev, s.rep$ev)