Learn R Programming

conMItion (version 0.2.1)

CORmat2vecPermu: Permuted Correlation Between Matrix and Vector

Description

Computes the correlation between a randomly sampled vector from a matrix and a given vector. The sampling is done multiple times to generate a distribution.

Usage

CORmat2vecPermu(
  mat,
  vec,
  cor_type = "pearson",
  bulkIdx = 0,
  permutationTimes = 1000,
  seedNum = 99999999
)

Value

A numeric vector of correlation values for each permutation.

Arguments

mat

A numeric matrix. For example, each row represents a gene and each column represents a sample.

vec

A numeric vector, with length equal to the number of columns in `mat`.

cor_type

Type of correlation to calculate: "Pearson", "Kendall", or "Spearman". Default is "Pearson".

bulkIdx

Index to divide the task when processing many permutations. Default is 0.

permutationTimes

Number of permutations for sampling. Default is 1000.

seedNum

Seed for random number generation. Default is 99999999.

Examples

Run this code
mat <- matrix(rnorm(10000), nrow = 100, ncol = 100)
vec <- rnorm(100)
CORmat2vecPermu(mat, vec)

Run the code above in your browser using DataLab