bootstrapCor: Calculate bootstrap p-values for correlation measures

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

View source: R/bootstrapCor.R


This function takes a numerical matrix (or two vectors) and calculates bootstrapped (by permutation) p-values to test if the correlation value is equal to zero. If the first argument is a matrix, the p-values are calculated between all pairs of rows of the matrix.


bootstrapCor(x, y=NULL, bRep, type="Rpearson", ret="p-value",



numerical matrix or vector to be analysed. If a vector, the argument y must be informed.


numerical vector. Must be informed if x is a vector. If x is a matrix, this argument is ignored. Defaults to NULL.


number of permutation to be done in the test.


character string specifying the type of correlation statistic to be used. Possible values are 'Rpearson', 'pearson', 'spearman' or 'kendall'.


character string with the value to return. Must be 'p-value' (default) for the usual p-value or 'max', to return the maximum absolute correlation value obtained by the permutation.


character specifying the type of test to do, must be 'two.sided' (default), 'less' or 'greater'.


Pearson, spearman and kendall types of correlation values are calculated by cor function from package stats. The method Rpearson was developed in this package and is a generalisation of the jackniffe correlation proposed by Heyer et al. (1999), it is calculated using the function robustCorr.


The result of this function is a square matrix (length equal to the number of rows of x) if x is a matrix or a numerical value if x and y are vectors. The result is the p-values or maximum correlation values calculated by permutation tests.


Gustavo H. Esteves <>


Heyer, L.J.; Kruglyak, S. and Yooseph, S. Exploring expression data: identification and analysis of coexpressed genes, Genome Research, 9, 1106-1115, 1999 (

See Also

cor, robustCorr


x <- runif(50, 0, 1)
y <- rbeta(50, 1, 2)
bootstrapCor(x, y, bRep=100)

z <- matrix(rnorm(100, 0, 1), 4, 25)
bootstrapCor(z, bRep=100)

Example output

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

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

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

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,, cbind, colMeans, colSums, colnames,,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, lengths, mapply, match, mget, order, paste, pmax,,
    pmin,, rank, rbind, rowMeans, rowSums, rownames, sapply,
    setdiff, sort, table, tapply, union, unique, unsplit, which,
    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: 'limma'

The following object is masked from 'package:BiocGenerics':


Loading required package: marray
Loading required package: graph
[1] 0.78
     [,1] [,2] [,3] [,4]
[1,] 1.00 0.87 0.32 0.28
[2,] 0.87 1.00 0.49 0.92
[3,] 0.32 0.49 1.00 0.17
[4,] 0.28 0.92 0.17 1.00

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