\HeaderA{alias}{Find Aliases (Dependencies) in a Model}{alias}
\methaliasA{alias.formula}{alias}{alias.formula}
\methaliasA{alias.lm}{alias}{alias.lm}
\keyword{models}{alias}
\begin{Description}\relax
Find aliases (linearly dependent terms) in a linear model specified by
a formula.
\end{Description}
\begin{Usage}
\begin{verbatim}
alias(object, ...)

## S3 method for class 'formula':
alias(object, data, ...)

## S3 method for class 'lm':
alias(object, complete = TRUE, partial = FALSE,
      partial.pattern = FALSE, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] A fitted model object, for example from \code{lm} or
\code{aov}, or a formula for \code{alias.formula}.
\item[\code{data}] Optionally, a data frame to search for the objects
in the formula.
\item[\code{complete}] Should information on complete aliasing be included?
\item[\code{partial}] Should information on partial aliasing be included?
\item[\code{partial.pattern}] Should partial aliasing be presented in a
schematic way? If this is done, the results are presented in a
more compact way, usually giving the deciles of the coefficients.
\item[\code{...}] further arguments passed to or from other methods.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Although the main method is for class \code{"lm"}, \code{alias} is
most useful for experimental designs and so is used with fits from
\code{aov}.
Complete aliasing refers to effects in linear models that cannot be estimated
independently of the terms which occur earlier in the model and so
have their coefficients omitted from the fit. Partial aliasing refers
to effects that can be estimated less precisely because of
correlations induced by the design.
\end{Details}
\begin{Value}
A list (of \code{\LinkA{class}{class} "listof"}) containing components
\begin{ldescription}
\item[\code{Model}] Description of the model; usually the formula.
\item[\code{Complete}] A matrix with columns corresponding to effects that
are linearly dependent on the rows; may be of class \code{"mtable"}
which has its own \code{\LinkA{print}{print}} method.
\item[\code{Partial}] The correlations of the estimable effects, with a zero
diagonal.
\end{ldescription}
\end{Value}
\begin{Note}\relax
The aliasing pattern may depend on the contrasts in use: Helmert
contrasts are probably most useful.

The defaults are different from those in S.
\end{Note}
\begin{Author}\relax
The design was inspired by the S function of the same name described
in Chambers \emph{et al.} (1992).
\end{Author}
\begin{References}\relax
Chambers, J. M., Freeny, A and Heiberger, R. M. (1992)
\emph{Analysis of variance; designed experiments.}
Chapter 5 of \emph{Statistical Models in S}
eds J. M. Chambers and T. J. Hastie, Wadsworth \& Brooks/Cole.
\end{References}
\begin{Examples}
\begin{ExampleCode}
had.VR <- "package:MASS" %in% search()
## The next line is for fractions() which gives neater results
if(!had.VR) res <- require(MASS)
## From Venables and Ripley (2002) p.165.
N <- c(0,1,0,1,1,1,0,0,0,1,1,0,1,1,0,0,1,0,1,0,1,1,0,0)
P <- c(1,1,0,0,0,1,0,1,1,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0)
K <- c(1,0,0,1,0,1,1,0,0,1,0,1,0,1,1,0,0,0,1,1,1,0,1,0)
yield <- c(49.5,62.8,46.8,57.0,59.8,58.5,55.5,56.0,62.8,55.8,69.5,55.0,
           62.0,48.8,45.5,44.2,52.0,51.5,49.8,48.8,57.2,59.0,53.2,56.0)
npk <- data.frame(block=gl(6,4), N=factor(N), P=factor(P),
                  K=factor(K), yield=yield)

op <- options(contrasts=c("contr.helmert", "contr.poly"))
npk.aov <- aov(yield ~ block + N*P*K, npk)
alias(npk.aov)
if(!had.VR && res) detach(package:MASS)
options(op)# reset
\end{ExampleCode}
\end{Examples}

