Learn R Programming

Zelig (version 4.2-1)

sim: Generic Method for Computing and Organizing Simulated Quantities of Interest 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.

Description

Generic Method for Computing and Organizing Simulated Quantities of Interest 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.

Usage

sim(obj, x = NULL, x1 = NULL, y = NULL, num = 1000,
    bootstrap = F, bootfn = NULL, cond.data = NULL, ...)

Arguments

obj
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) particular computations of quantities of interest
y
a parameter reserved for the computation of particular quantities of interest (average treatment effects). Few models currently support this parameter
num
an integer specifying the number of simulations to compute
bootstrap
currently unsupported
bootfn
currently unsupported
cond.data
currently unsupported
...
arguments reserved future versions of Zelig

Value

  • The output stored in s.out varies by model. Use the names command to view the output stored in s.out. Common elements include:
  • xthe setx values for the explanatory variables, used to calculate the quantities of interest (expected values, predicted values, etc.).
  • x1the optional setx object used to simulate first differences, and other model-specific quantities of interest, such as risk-ratios.
  • callthe options selected for sim, used to replicate quantities of interest.
  • zelig.callthe original command and options for zelig, used to replicate analyses.
  • numthe number of simulations requested.
  • parthe 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$evsimulations of the expected values given the model and x.
  • qi$prsimulations of the predicted values given by the fitted values.
  • qi$fdsimulations of the first differences (or risk difference for binary models) for the given x and x1. The difference is calculated by subtracting the expected values given x from the expected values given x1. (If do not specify x1, you will not get first differences or risk ratios.)
  • qi$rrsimulations of the risk ratios for binary and multinomial models. See specific models for details.
  • qi$ate.evsimulations 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}\sum_{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.prsimulations 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}\sum_{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$.