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.
sim(object, x = NULL, ...) ## Default S3 method: sim(object, x=NULL, x1=NULL, num=c(1000, 100), prev = NULL, bootstrap = FALSE, bootfn=NULL, cond.data = NULL, ...)
object |
the output object from |
x |
values of explanatory variables used for simulation,
generated by |
x1 |
optional values of explanatory variables (generated by a
second call of |
num |
the number of simulations, i.e., posterior draws. If the
|
prev |
a previous setx object to use to simulate |
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 |
cond.data |
specify conditional data |
... |
additional optional arguments passed to
|
The output stored in s.out
varies by model. Use the
names
command to view the output stored in s.out
.
Common elements include:
x |
the |
x1 |
the optional |
call |
the options selected for |
zelig.call |
the original command and options for
|
num |
the number of simulations requested. |
par |
the parameters (coefficients, and additional model-specific parameters). You may wish to use the same set of simulated parameters to calculate quantities of interest rather than simulating another set. |
qi\$ev |
simulations of the expected values given the
model and |
qi\$pr |
simulations of the predicted values given by the fitted values. |
qi\$fd |
simulations of the first differences (or risk
difference for binary models) for the given |
qi\$rr |
simulations of the risk ratios for binary and multinomial models. See specific models for details. |
qi\$ate.ev |
simulations of the average expected treatment effect for the treatment group, using conditional prediction. Let t_i be a binary explanatory variable defining the treatment (t_i=1) and control (t_i=0) groups. Then the average expected treatment effect for the treatment group is \frac{1}{n}∑_{i=1}^n [ \, Y_i(t_i=1) - E[Y_i(t_i=0)] \mid t_i=1 \,], where Y_i(t_i=1) is the value of the dependent variable for observation i in the treatment group. Variation in the simulations are due to uncertainty in simulating E[Y_i(t_i=0)], the counterfactual expected value of Y_i for observations in the treatment group, under the assumption that everything stays the same except that the treatment indicator is switched to t_i=0. |
qi\$ate.pr |
simulations of the average predicted treatment effect for the treatment group, using conditional prediction. Let t_i be a binary explanatory variable defining the treatment (t_i=1) and control (t_i=0) groups. Then the average predicted treatment effect for the treatment group is \frac{1}{n}∑_{i=1}^n [ \, Y_i(t_i=1) - \widehat{Y_i(t_i=0)} \mid t_i=1 \,], where Y_i(t_i=1) is the value of the dependent variable for observation i in the treatment group. Variation in the simulations are due to uncertainty in simulating \widehat{Y_i(t_i=0)}, the counterfactual predicted value of Y_i for observations in the treatment group, under the assumption that everything stays the same except that the treatment indicator is switched to t_i=0. |
In the case of censored $Y$ in the exponential, Weibull, and lognormal
models, sim
first imputes the uncensored values for $Y$ before
calculating the ATE.
You may use the \$
operator to extract any of the
above from s.out
. For example, s.out\$qi\$ev
extracts the
simulated expected values.
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
.