Learn R Programming

RobLoxBioC (version 0.9)

KolmogorovMinDist: Generic Function for Computing Minimum Kolmogorov Distance for Biological Data

Description

Generic function for computing minimum Kolmogorov distance for biological data.

Usage

KolmogorovMinDist(x, D, ...)

# S4 method for matrix,Norm KolmogorovMinDist(x, D, mad0 = 1e-4)

# S4 method for AffyBatch,AbscontDistribution KolmogorovMinDist(x, D, bg.correct = TRUE, pmcorrect = TRUE, verbose = TRUE)

# S4 method for BeadLevelList,AbscontDistribution KolmogorovMinDist(x, D, log = FALSE, imagesPerArray = 1, what = "G", probes = NULL, arrays = NULL)

Arguments

x

biological data.

D

object of class "UnivariateDistribution".

additional parameters.

mad0

scale estimate used if computed MAD is equal to zero. Median and MAD are used as start parameter for optimization.

bg.correct

if TRUE MAS 5.0 background correction is performed; confer bg.correct.mas.

pmcorrect

if TRUE log2(PM/MM) is used. If FALSE only log2(PM) is used.

verbose

logical: if TRUE, some messages are printed.

log

if TRUE, then the log2 intensities for each bead-type are summarized.

imagesPerArray

Specifies how many images (strips) there are per array. Normally 1 for a SAM and 1 or 2 for a BeadChip. The images (strips) from the same array will be combined so that each column in the output represents a sample.

what

character string specifying which intensities/values to summarize.

probes

Specify particular probes to summarize. If left NULL then all the probes on the first array are used.

arrays

integer (scalar or vector) specifying the strips/arrays to summarize. If NULL, then all strips/arrays are summarized.

Value

List with components dist containing a numeric vector or matrix with minimum Kolmogorov distances and n a numeric vector or matrix with the corresponding sample sizes.

Details

The minimum Kolmogorov distance is computed for each row of a matrix, each Affymetrix probe, or each Illumina bead, respectively.

So far, only the minimum distance to the set of normal distributions can be computed.

References

Huber, P.J. (1981) Robust Statistics. New York: Wiley.

Rieder, H. (1994) Robust Asymptotic Statistics. New York: Springer.

See Also

KolmogorovDist, MDEstimator

Examples

Run this code
# NOT RUN {
set.seed(123) # to have reproducible results for package checking

## matrix method for KolmogorovMinDist
ind <- rbinom(200, size=1, prob=0.05) 
X <- matrix(rnorm(200, mean=ind*3, sd=(1-ind) + ind*9), nrow = 2)
KolmogorovMinDist(X, D = Norm())

## using Affymetrix-Data
data(SpikeIn)
probes <- log2(pm(SpikeIn))
(res <- KolmogorovMinDist(probes, Norm()))
boxplot(res$dist)

# }
# NOT RUN {
## "Not run" just because of computation time
require(affydata)
data(Dilution)
res <- KolmogorovMinDist(Dilution[,1], Norm())
summary(res$dist)
boxplot(res$dist)
plot(res$n, res$dist, pch = 20, main = "Kolmogorov distance vs. sample size",
     xlab = "sample size", ylab = "Kolmogorov distance",
     ylim = c(0, max(res$dist)))
uni.n <- min(res$n):max(res$n)
lines(uni.n, 1/(2*uni.n), col = "orange", lwd = 2)
legend("topright", legend = "minimal possible distance", fill = "orange")
# }
# NOT RUN {
## using Illumina-Data
# }
# NOT RUN {
## "Not run" just because of computation time
data(BLData)
res <- KolmogorovMinDist(BLData, Norm(), arrays = 1)
res1 <- KolmogorovMinDist(BLData, log = TRUE, Norm(), arrays = 1)
summary(cbind(res$dist, res1$dist))
boxplot(list(res$dist, res1$dist), names = c("raw", "log-raw"))
sort(unique(res1$n))
plot(res1$n, res1$dist, pch = 20, main = "Kolmogorov distance vs. sample size",
     xlab = "sample size", ylab = "Kolmogorov distance",
     ylim = c(0, max(res1$dist)), xlim = c(min(res1$n), 56))
uni.n <- min(res1$n):56
lines(uni.n, 1/(2*uni.n), col = "orange", lwd = 2)
legend("topright", legend = "minimal possible distance", fill = "orange")
# }

Run the code above in your browser using DataLab