\HeaderA{getResidPerGene}{Row-by-Row Linear-Model Residuals for Gene Expression (or similar)
Data Structures}{getResidPerGene}
\keyword{methods}{getResidPerGene}
\begin{Description}\relax
This produces residuals of an identical linear model applied to each
row of a gene expression matrix (or similar dataset). Computation
speed is achieved via straightforward matrix algebra. Most
commonly-used residual types are available.
\end{Description}
\begin{Usage}
\begin{verbatim}
getResidPerGene(lmobj, type = "extStudent")\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{lmobj}] An object produced by function \code{\LinkA{lmPerGene}{lmPerGene}}. 
\item[\code{type}] A string indicating the type of residual requeseted
(defaults to externally-Studentized). 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Types of residuals now available:
\describe{
\item["response"] Response residuals, observed minus fitted
\item["normalized"] Response residuals divided by the estimated residual
S.E.
\item["intStudent"] Internally Studentized residuals, often referred
to as "Standardized"
\item[default] Externally Studentized residuals, which can be used
directly for outlier identification
}
\end{Details}
\begin{Value}
Returns a instance of \code{ExpressionSet} where the expression matrix
contains the residuals. The \code{phenoData} are inherited from
\code{lmobj\$eS}.
\end{Value}
\begin{Author}\relax
Robert Gentleman, Assaf Oron
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{lmPerGene}{lmPerGene}}, \code{\LinkA{resplot}{resplot}},\code{\LinkA{dfbetasPerGene}{dfbetasPerGene}},\code{\LinkA{influence.measures}{influence.measures}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(sample.ExpressionSet)
lm1 = lmPerGene(sample.ExpressionSet,~sex)
r1 = getResidPerGene(lm1)
### now a boxplot of all residuals by sample
resplot(resmat=exprs(r1),fac=sample.ExpressionSet$sex)
### This plot is not very informative because of some gross outliers;
### try this instead
resplot(resmat=exprs(r1),fac=sample.ExpressionSet$sex,lims=c(-5,5))

\end{ExampleCode}
\end{Examples}

