outlierPair {factDesign} | R Documentation |
This function detects pairs of observations with unexpectedly large differences compared to the rest of the data. Pairs with large differences may include single outlier observations.
outlierPair(x, INDEX, p = 0.05, na.rm = TRUE)
x |
A vector of observations. |
INDEX |
A list of factors, each the same length as x, used to indicate the replicate observations. |
p |
The significance level at which to perform the test. |
na.rm |
If TRUE, will remove missing values. |
This outlier detection method is useful for small factorial designs in which the usual residuals from a linear model would have a large number of linear dependencies compared to the actual number of residuals. The function first calculates n difference between 2n replicates (call these pure residuals), and then constructs an F-statistic: f=(large squared p.r.)/((sum of remaining squared p.r.'s)/(n-1)). An p-value (adjusted for taking the largest of the p.r.'s) is calculated by n*Pr(F(1,n-1)>f). If f>=n-1, this p-value is exact, otherwise it is an upper bound.
test |
Returns TRUE if an outlier pair is detected at the specified level of significance p. |
pval |
The actual value of n*Pr(F(1,n-1)>f). |
whichPair |
The index of the pair of observations with the largest difference. |
Denise Scholtens
Scholtens et al. Analyzing Factorial Designed Microarray Experiments. Journal of Multivariate Analysis. To appear.
data(estrogen) outlierPair(exprs(estrogen)[1,],INDEX=pData(estrogen),p=.05) outlierPair(exprs(estrogen)[247,],INDEX=pData(estrogen),p=.05) outlierPair(exprs(estrogen)[495,],INDEX=pData(estrogen),p=.05)