robustCorr: Calculate a robust correlation value

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/robustCorr.R

Description

This function is intended to calculate robust correlation values between pairs of rows of numerical matrix or between two numerical vectors.

Usage

1

Arguments

x

numerical matrix or vector. If a matrix the method calculates the robust correlations between all pairs of rows. If x is a vector, y must be specified as another vector of same length as x and the robust correlation between them is calculate.

y

optional numeric vector, must be specified if x is a vector.

Details

This function calculates a robust correlation value in a procedure similar to the leave-one-out used for cross-validation of classification results. The algorithm removes one point at a time and calculates a usual Pearson correlation value. Them, with a vector r of correlation values that has the same length as the columns of x (or vectors x and y), the algorithm decides by the min(r) or max(r), according with that one that is more distant from the median value.

Value

If x is a matrix, the method return a list with two square matrices, the first one containing the robust correlation values between all pairs of rows from x and the second containing the index of the point removed from calculation. If x is a vector, y must be specified and the function return a list with the robust correlation value between them and the index of the point removed.

Author(s)

Gustavo H. Esteves <gesteves@vision.ime.usp.br>

See Also

cor from package stats.

Examples

1
2
3
4
5
6
x <- runif(50, 0, 1)
y <- rbeta(50, 1, 2)
robustCorr(x, y)

z <- matrix(rnorm(100, 0, 1), 4, 25)
robustCorr(z)

Example output

Loading required package: convert
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package:BiocGenericsThe following objects are masked frompackage:parallel:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked frompackage:stats:

    IQR, mad, sd, var, xtabs

The following objects are masked frompackage:base:

    anyDuplicated, append, as.data.frame, basename, cbind, colnames,
    dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which.max, which.min

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: limma

Attaching package:limmaThe following object is masked frompackage:BiocGenerics:

    plotMA

Loading required package: marray
Loading required package: graph
$Rcor
[1] 0.1133295

$idx
[1] 25

$Rcor
            [,1]        [,2]        [,3]        [,4]
[1,]  1.00000000  0.10650746 -0.09407205  0.22639472
[2,]  0.10650746  1.00000000  0.12148067 -0.04311688
[3,] -0.09407205  0.12148067  1.00000000  0.26829051
[4,]  0.22639472 -0.04311688  0.26829051  1.00000000

$idx
     [,1] [,2] [,3] [,4]
[1,]    0   17   11   11
[2,]   17    0    6   17
[3,]   11    6    0   21
[4,]   11   17   21    0

maigesPack documentation built on Nov. 8, 2020, 6:23 p.m.