\HeaderA{effects}{Effects from Fitted Model}{effects}
\methaliasA{effects.glm}{effects}{effects.glm}
\methaliasA{effects.lm}{effects}{effects.lm}
\keyword{models}{effects}
\keyword{regression}{effects}
\begin{Description}\relax
Returns (orthogonal) effects from a fitted model, usually a linear
model. This is a generic function, but currently only has a methods for
objects inheriting from classes \code{"lm"} and \code{"glm"}.
\end{Description}
\begin{Usage}
\begin{verbatim}
effects(object, ...)

## S3 method for class 'lm':
effects(object, set.sign = FALSE, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] an \R{} object; typically, the result of a model fitting function
such as \code{\LinkA{lm}{lm}}.
\item[\code{set.sign}] logical. If \code{TRUE}, the sign of the effects
corresponding to coefficients in the model will be set to agree with the
signs of the corresponding coefficients, otherwise the sign is
arbitrary.
\item[\code{...}] arguments passed to or from other methods.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
For a linear model fitted by \code{\LinkA{lm}{lm}} or \code{\LinkA{aov}{aov}},
the effects are the uncorrelated single-degree-of-freedom values
obtained by projecting the data onto the successive orthogonal
subspaces generated by the QR decomposition during the fitting
process. The first \eqn{r}{} (the rank of the model) are associated with
coefficients and the remainder span the space of residuals (but are
not associated with particular residuals).

Empty models do not have effects.
\end{Details}
\begin{Value}
A (named) numeric vector of the same length as
\code{\LinkA{residuals}{residuals}}, or a matrix if there were multiple responses
in the fitted model, in either case of class \code{"coef"}.

The first \eqn{r}{} rows are labelled by the corresponding coefficients,
and the remaining rows are unlabelled.  Note that in rank-deficient
models the corresponding coefficients will be in a different
order if pivoting occurred.
\end{Value}
\begin{References}\relax
Chambers, J. M. and Hastie, T. J. (1992)
\emph{Statistical Models in S.}
Wadsworth \& Brooks/Cole.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{coef}{coef}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
y <- c(1:3,7,5)
x <- c(1:3,6:7)
( ee <- effects(lm(y ~ x)) )
c(round(ee - effects(lm(y+10 ~ I(x-3.8))),3))# just the first is different
\end{ExampleCode}
\end{Examples}

