| Previous: Saving Replication Materials | Up: Replication Procedures | Next: Graphing Commands |
If the data set and analyses are all saved in one .RData file, located in your working directory, you may simply type:
> load("replication.RData") # Loads the replication file.
> z.rep <- repl(z.out) # To replicate the model only.
> s.rep <- repl(s.out) # To replicate the model and
# quantities of interest.
By default, repl() uses the same options used to create the
original output object. Thus, if the original s.out object used
bootstrapping with 245 simulations, the s.rep object will
similarly have 245 bootstrapped simulations. In addition, you may use
the prev option when replicating quantities of interest to reuse
rather than recreate simulated parameters. Type help.zelig("repl") to view the complete list of options for
repl().
If the data were saved in a text file, use read.table() to load the data, and then replicate the analysis:
> dat <- read.table("mydata.tab", header = TRUE) # Where `dat' is the same
> load("replication.RData") # as the name used in
> z.rep <- repl(z.out) # `z.out'.
> s.rep <- repl(s.out)
If you have problems loading the data, please refer to Section
.
Finally, you may use the identical() command to ensure that the replicated regression output is in every way identical to the original zelig() output.4.4 For example:
> identical(z.out$coef, z.rep$coef) # Checks the coefficients.Simulated quantities of interest will vary from the original quantities if parameters are re-simulated or re-sampled. If you wish to use identical() to verify that the quantities of interest are identical, you may use
# Re-use the parameters simulated (and stored) in the original sim() output. > s.rep <- repl(s.out, prev = s.out$par) # Check that the expected values are identical. You may do this for each qi. > identical(s.out$qi$ev, s.rep$qi$ev)