# Row-by-Row Linear-Model Residuals for Gene Expression (or similar) Data Structures

### Description

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.

### Usage

1 | ```
getResidPerGene(lmobj, type = "extStudent")
``` |

### Arguments

`lmobj` |
An object produced by function |

`type` |
A string indicating the type of residual requeseted (defaults to externally-Studentized). |

### Details

Types of residuals now available:

- "response"
Response residuals, observed minus fitted

- "normalized"
Response residuals divided by the estimated residual S.E.

- "intStudent"
Internally Studentized residuals, often referred to as "Standardized"

- default
Externally Studentized residuals, which can be used directly for outlier identification

### Value

Returns a instance of `ExpressionSet`

where the expression matrix
contains the residuals. The `phenoData`

are inherited from
`lmobj$eS`

.

### Author(s)

Robert Gentleman, Assaf Oron

### See Also

`lmPerGene`

, `resplot`

,`dfbetasPerGene`

,`influence.measures`

### Examples

1 2 3 4 5 6 7 8 | ```
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))
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.