\HeaderA{repl}{Replicating Analyses}{repl}
\methaliasA{repl.default}{repl}{repl.default}
\methaliasA{repl.zelig}{repl}{repl.zelig}
\keyword{file}{repl}
\begin{Description}\relax
The generic function \code{repl} command takes 
\code{\LinkA{zelig}{zelig}} or
\code{\LinkA{sim}{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
\code{\LinkA{zelig}{zelig}} output.  In the case of \code{\LinkA{sim}{sim}}
output, the replicated analyses may differ slightly due to
stochastic randomness in the simulation procedure.
\end{Description}
\begin{Usage}
\begin{verbatim}
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, ...) 
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] Stored output from either \code{\LinkA{zelig}{zelig}} or
\code{\LinkA{sim}{sim}}.
\item[\code{data}] You may manually input the data frame name rather
than allowing \code{repl} to draw the data frame name from the object
to be replicated.
\item[\code{prev}] When replicating \code{\LinkA{sim}{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. 
\item[\code{x}] When replicating \code{\LinkA{sim}{sim}} output, you may
optionally use an alternative \code{\LinkA{setx}{setx}} value for the \code{x}
input. 
\item[\code{x1}] When replicating \code{\LinkA{sim}{sim}} output, you may
optionally use an alternative \code{\LinkA{setx}{setx}} object for the \code{x1}
input to replicating the \code{\LinkA{sim}{sim}} object. 
\item[\code{bootfn}] When replicating \code{\LinkA{sim}{sim}} output with
bootstrapped parameters, you should manually specify the
\code{bootfn} if a non-default option was used.  
\item[\code{...}] Additional arguments passed to either \code{\LinkA{zelig}{zelig}} or 
\code{\LinkA{sim}{sim}}.  
\end{ldescription}
\end{Arguments}
\begin{Value}
For \code{\LinkA{zelig}{zelig}} output, \code{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 \code{identical} command.  

For \code{\LinkA{sim}{sim}} output, \code{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 \code{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.
\end{Value}
\begin{Author}\relax
Kosuke Imai <\email{kimai@princeton.edu}>; Gary King
<\email{king@harvard.edu}>; Olivia Lau <\email{olau@fas.harvard.edu}>
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{zelig}{zelig}}, \code{\LinkA{setx}{setx}}, and
\code{\LinkA{sim}{sim}}.  In addition, the full Zelig manual may be
accessed online at \url{http://gking.harvard.edu/zelig}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
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)
\end{ExampleCode}
\end{Examples}

