sim {Zelig} | R Documentation |
Simulate quantities of interest from the estimated model
output from zelig()
given specified values of explanatory
variables established in setx()
. For classical maximum
likelihood models, sim()
uses asymptotic normal
approximation to the log-likelihood. For Bayesian models,
Zelig simulates quantities of interest from the posterior density,
whenever possible. For robust Bayesian models, simulations
are drawn from the identified class of Bayesian posteriors.
Alternatively, you may generate quantities of interest using
bootstrapped parameters.
s.out <- sim(object, x, x1 = NULL, num = c(1000, 100), prev = NULL, bootstrap = FALSE, bootfn = NULL, cond.data = NULL, ...)
object |
the output object from zelig . |
x |
values of explanatory variables used for simulation,
generated by setx . |
x1 |
optional values of explanatory variables (generated by a
second call of setx ), used to simulate first
differences and risk ratios. (Not available for conditional
prediction.) |
num |
the number of simulations, i.e., posterior draws. If the
num argument is omitted, sim draws 1,000
simulations by if bootstrap = FALSE (the default), or 100
simulations if bootstrap = TRUE . You may increase this
value to improve accuracy. (Not available for conditional
prediction.) |
bootstrap |
a logical value indicating if parameters should be generated by re-fitting the model for bootstrapped data, rather than from the likelihood or posterior. (Not available for conditional prediction.) |
bootfn |
a function which governs how the data is
sampled, re-fits the model, and returns the bootstrapped model
parameters. If bootstrap = TRUE and bootfn = NULL ,
\lnk{sim} will sample observations from the original data (with
replacement) until it creates a sampled dataset with the same
number of observations as the original data. Alternative
bootstrap methods include sampling the residuals rather than the
observations, weighted sampling, and parametric bootstrapping.
(Not available for conditional prediction.) |
cond.data |
a data frame, identical to the data
argument in setx . Required for conditional prediction
with the exponential, Weibull, and lognormal models. |
... |
additional optional arguments passed to
boot . |
Kosuke Imai <kimai@princeton.edu>; Gary King <king@harvard.edu>; Olivia Lau <olau@fas.harvard.edu>
The full Zelig at http://gking.harvard.edu/zelig, and boot
.