\chapter{Main Commands}\label{s:main}

Help for each command in Zelig and R is available through {\tt
  help.zelig()}.  For example, typing {\tt help.zelig(setx)} will
launch a web browser with the appropriate reference manual page for
the {\tt setx()} command.  (Occasionally, you may need to use, for example, {\tt
  help(print)} rather than {\tt help.zelig(print)}, to access the R
  help page instead of the default Zelig help page.)  

\include{commandsRd/zelig}
\include{commandsRd/setx}
\include{commandsRd/sim}
\include{commandsRd/summary}
\include{commandsRd/plot.zelig}
\include{commands/print}
\include{commandsRd/repl}

\chapter{Supplementary Commands}

\include{commands/matchit}
\include{commandsRd/mi}
\include{commandsRd/network}
\include{commandsRd/plot.ci}
\include{commandsRd/plot.surv}
\include{commandsRd/rocplot}
\include{commandsRd/ternaryplot}
\include{commandsRd/ternarypoints}

\chapter{Models Zelig Can Run}\label{s:model.details}

This section describes the mathematical components of the models
supported by Zelig, using whenever possible the classification and
notation of \cite{King89}.  Most models have a \emph{stochastic
  component} (probability density given certain parameters) and
a \emph{systematic component} (deterministic functional form that
specifies how one or more of the parameters varies over the observed
values $y_i$ as a function of the explanatory variables $x_i$).

Let $Y_i$ be a random outcome variable, realized as $i = 1, \dots, n$
observations $y_i$.  For the probability density $f(\cdot)$ with
systematic feature $\theta_i$ varying over $i$ and a scalar ancillary
parameter $\alpha$ (constant over $i$), the stochastic component is
given by
\begin{equation*}
Y_i \sim f(y_i \mid \theta_i, \alpha).
\end{equation*}

For a functional form $g(\cdot)$, $k$ explanatory variables $X_i$, and
effect parameters $\beta$, the systematic component is:  
\begin{equation*}
\theta_i = g(x_i, \beta).
\end{equation*}

Using the definitions of \hlink{King, Tomz, and Wittenberg,
    2000}{http://gking.harvard.edu/files/abs/making-abs.shtml},
  \nocite{KinTomWit00}
Zelig generates at least two quantities of interest:   
\begin{itemize}
\item The predicted value is a random draw from the stochastic component
  given random draws of $\beta$ and $\alpha$ from their sampling (or
  posterior) distribution.  
\item The expected value is the \emph{mean} of the stochastic component
  given random draws of $\beta$ and $\alpha$ from their sampling (or
  posterior) distributions.  For computational efficiency, Zelig
  deterministically calculates the expected values from the simulated
  parameters whenever possible. 
\end{itemize}

Both the predicted values and expected values produced by Zelig can be
displayed as histograms or density estimates (to summarize the full
sampling or posterior density), or summarized with confidence
intervals (by sorting the simulations and taking the 5th and 95th
percentile values for a 90\% confidence interval for example),
standard errors (by taking the standard deviation of the simulations),
or point estimates (by averaging the simulations).  The point estimate
of predicted and expected values are the same only in linear models.
In almost all situations, simulations from predicted values have more
variance than expected values.  As the number of simulations increases
the distribution of the expected values tends toward a constant; the
distribution of the predicted values does not collapse as the number
of simulations increases.

\include{aov}
\include{arima}
\include{blogit}
\include{bprobit}
\include{chopit}
\include{cloglog.net}
\include{coxph}
\include{ei.dynamic}
\include{ei.hier}
\include{ei.RxC}
\include{exp}
\include{factor.bayes}
\include{factor.mix}
\include{factor.ord}
\include{gamma}
\include{gamma.gee}
\include{gamma.mixed}
\include{gamma.net}
\include{gamma.survey}
\include{irt1d}
\include{irtkd}
\include{logit}
\include{logit.bayes}
\include{logit.gam}
\include{logit.gee}
\include{logit.gee}
\include{logit.mixed}
\include{logit.mixed}
\include{logit.net}
\include{logit.survey}
\include{lognorm}
\include{ls}
\include{ls.mixed}
\include{ls.net}
\include{mlogit}
\include{mlogit.bayes}
\include{mloglm}
\include{negbin}
\include{normal}
\include{normal.bayes}
\include{normal.gam}
\include{normal.gee}
\include{normal.net}
\include{normal.survey}
\include{ologit}
\include{oprobit}
\include{oprobit.bayes}
\include{poisson}
\include{poisson.bayes}
\include{poisson.gam}
\include{poisson.gee}
\include{poisson.mixed}
\include{poisson.net}
\include{poisson.survey}
\include{probit}
\include{probit.bayes}
\include{probit.gam}
\include{probit.gee}
\include{probit.mixed}
\include{probit.net}
\include{probit.survey}
\include{relogit}
\include{sur}
\include{threesls}
\include{tobit}
\include{tobit.bayes}
\include{twosls}
\include{weibull}


\chapter{Commands for Programmers and Contributors}

\include{describe.mymodel}
\include{commands/model.end}
\include{commands/model.frame.multiple}
\include{commands/model.matrix.multiple}
\include{commands/parse.formula}
\include{commands/parse.par}
\include{commands/put.start}
\include{commands/set.start}
\include{commands/tag}


%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "zelig"
%%% End: 
