Quick Overview
For any statistical model, Zelig does its work with a combination of
three commands.
Figure:
Main Zelig commands (solid arrows) and some options (dashed arrows)
8#8 |
- Use zelig() to run the chosen statistical model on a
given data set, with a specific set of variables. For standard
likelihood models, for example, this step estimates the coefficients,
other model parameters, and a variance-covariance matrix. In
addition, you may choose from a variety of options:
- Pre-process data: Prior to calling zelig(), you may
choose from a variety of data pre-processing commands (matching or
multiple imputation, for example) to make your statistical
inferences more accurate.
- Summarize model: After calling zelig(), you may summarize
the fitted model output using summary().
- Validate model: After calling zelig(), you may choose to
validate the fitted model. This can be done, for example, by using
cross-validation procedures and diagnostics tools.
- Use setx() to set each of the explanatory variables to
chosen (actual or counterfactual) values in preparation for
calculating quantities of interest. After calling setx(), you
may use WhatIf
to evaluate these choices by
determining whether they involve interpolation (i.e., are inside the
convex hull of the observed data) or extrapolation, as well as how
far these counterfactuals are from the data. Counterfactuals chosen
in setx() that involve extrapolation far from the data can
generate considerably more model dependence (see (),
(), ()).
- Use sim() to draw simulations of your quantity of
interest (such as a predicted value, predicted probability, risk
ratio, or first difference) from the model. (These simulations may
be drawn using an asymptotic normal approximation (the default),
bootstrapping, or other methods when available, such as directly
from a Bayesian posterior.) After calling sim(), use any of
the following to summarize the simulations:
- The summary() function gives a numerical display. For
multiple setx() values, summary() lets you summarize
simulations by choosing one or a subset of observations.
- If the setx() values consist of only one observation, plot() produces density plots for each quantity of interest.
Whenever possible, we use z.out as the zelig() output
object, x.out as the setx() output object, and s.out as the sim() output object, but you may choose other
names.
Gary King
2011-11-29