\HeaderA{untangle.specials}{Help Process the `specials' Argument of the `terms' Function.}{untangle.specials}
\keyword{survival}{untangle.specials}
\begin{Description}\relax
Given a \code{terms} structure and a desired special name, this returns an
index appropriate for subscripting the \code{terms} structure and another
appropriate for the data frame.
\end{Description}
\begin{Usage}
\begin{verbatim}
untangle.specials(tt, special, order=1)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{tt}] a \code{terms} object.

\item[\code{special}] the name of a special function, presumably used in the terms object.

\item[\code{order}] the order of the desired terms.  If set to 2, interactions with the special
function will be included.

\end{ldescription}
\end{Arguments}
\begin{Value}
a list with two components:
\begin{ldescription}
\item[\code{vars}] a vector of variable names, as would be found in the data frame, of the
specials.

\item[\code{terms}] a numeric vector, suitable for subscripting the terms structure, that indexes
the terms in the expanded model formula which involve the special.

\end{ldescription}
\end{Value}
\begin{Examples}
\begin{ExampleCode}
formula<-Surv(tt,ss)~x+z*strata(id)
tms<-terms(formula,specials="strata")
## the specials attribute
attr(tms,"specials")
## main effects 
untangle.specials(tms,"strata")
## and interactions
untangle.specials(tms,"strata",order=1:2)
\end{ExampleCode}
\end{Examples}

