\include{zinput} \begin{document}\section{{\tt model.frame.multiple}: Extracting the ``environment'' of a model formula}\label{ss:model.frame.multiple}
\keyword{utilities}{model.frame.multiple}
\begin{Description}\relax
Use \code{model.frame.multiple} after \code{\LinkA{parse.par}{parse.par}} to create a
data frame of the unique variables identified in the formula (or list
of formulas).
\end{Description}
\begin{Usage}
\begin{verbatim}
model.frame.multiple(formula, data, eqn = NULL, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{formula}] a list of formulas of class \code{"multiple"}, returned from \code{\LinkA{parse.par}{parse.par}}
\item[\code{data}] a data frame containing all the variables used in \code{formula}
\item[\code{eqn}] an optional character string or vector of character strings specifying 
the equations (specified in \code{describe.mymodel}) for which you would like to 
pull out the relevant variables.
\item[\code{...}] additional arguments passed to 
\code{\LinkA{model.frame.default}{model.frame.default}}
\end{ldescription}
\end{Arguments}
\begin{Value}
The output is a data frame (with a terms attribute) containing all the
unique explanatory and response variables identified in the list of
formulas.  By default, missing (\code{NA}) values are listwise deleted.

If \code{as.factor} appears on the left-hand side, the response
variables will be returned as an indicator (0/1) matrix with columns
corresponding to the unique levels in the factor variable.  

If any formula contains more than one \code{tag} statement, \code{model.frame.multiple}
will return the original variable in the data frame and use the \code{tag} information in the terms 
attribute only.
\end{Value}
\begin{Author}\relax
Kosuke Imai <\email{kimai@princeton.edu}>; Gary King
<\email{king@harvard.edu}>; Olivia Lau <\email{olau@fas.harvard.edu}>; Ferdinand Alimadhi
<\email{falimadhi@iq.harvard.edu}>
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{model.matrix.default}{model.matrix.default}}, \code{\LinkA{parse.formula}{parse.formula}} and the full Zelig manual at
\url{http://gking.harvard.edu/zelig}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## Not run: 
data(sanction)
formulae <- list(import ~ coop + cost + target,
                 export ~ coop + cost + target)
fml <- parse.formula(formulae, model = "bivariate.logit")
D <- model.frame(fml, data = sanction)
## End(Not run)\end{ExampleCode}
\end{Examples}

\end{document}
