\HeaderA{factor.scope}{Compute Allowed Changes in Adding to or Dropping from a Formula}{factor.scope}
\aliasA{add.scope}{factor.scope}{add.scope}
\aliasA{drop.scope}{factor.scope}{drop.scope}
\keyword{models}{factor.scope}
\begin{Description}\relax
\code{add.scope} and \code{drop.scope} compute those terms that can be
individually added to or dropped from a model while respecting the
hierarchy of terms.
\end{Description}
\begin{Usage}
\begin{verbatim}
add.scope(terms1, terms2)

drop.scope(terms1, terms2)

factor.scope(factor, scope)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{terms1}] the terms or formula for the base model.
\item[\code{terms2}] the terms or formula for the upper (\code{add.scope}) or
lower (\code{drop.scope}) scope. If missing for \code{drop.scope} it is
taken to be the null formula, so all terms (except any intercept) are
candidates to be dropped.
\item[\code{factor}] the \code{"factor"} attribute of the terms of the base object.
\item[\code{scope}] a list with one or both components \code{drop} and
\code{add} giving the \code{"factor"} attribute of the lower and
upper scopes respectively.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{factor.scope} is not intended to be called directly by users.
\end{Details}
\begin{Value}
For \code{add.scope} and \code{drop.scope} a character vector of
terms labels.  For \code{factor.scope}, a list with components
\code{drop} and \code{add}, character vectors of terms labels.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{add1}{add1}}, \code{\LinkA{drop1}{drop1}},
\code{\LinkA{aov}{aov}}, \code{\LinkA{lm}{lm}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
add.scope( ~ a + b + c + a:b,  ~ (a + b + c)^3)
# [1] "a:c" "b:c"
drop.scope( ~ a + b + c + a:b)
# [1] "c"   "a:b"
\end{ExampleCode}
\end{Examples}

