Skip to contents

Pearson's correlation test for rows of a matrix

Usage

rowPearsonCorrelationTests(X, categ, alternative = "two.sided")

Arguments

X

A m x n numeric matrix whose rows correspond to variables and columns to observations

categ

Either a numeric vector of continuous covariate for the observations

alternative

A character string specifying the alternative hypothesis. Must be one of "two.sided" (default), "greater" or "less". As in t.test, alternative = "greater" is the alternative that class 1 has a larger mean than class 0.

Value

A list containing the following components:

statistic

the value of the t-statistics

parameter

the degrees of freedom for the t-statistics

p.value

the p-values for the tests

estimate

the correlation

Each of these elements is a matrix of size m x B, coerced to a vector of length m if B=1

Details

This function is a wrapper around the row_cor_pearson function in the 'matrixTests' package.

Author

Nicolas Enjalbert Courrech

Examples


m <- 300
n <- 38
mat <- matrix(rnorm(m*n), ncol=n)
categ <- rnorm(n, mean = 10)
system.time(fwt <- rowPearsonCorrelationTests(mat, categ, alternative = "greater"))
#>    user  system elapsed 
#>   0.002   0.000   0.002 
str(fwt)
#> List of 3
#>  $ p.value  : num [1:300] 0.2404 0.8942 0.9924 0.0029 0.8454 ...
#>  $ statistic: num [1:300] 0.713 -1.272 -2.55 2.933 -1.031 ...
#>  $ estimate : num [1:300] 0.118 -0.207 -0.391 0.439 -0.169 ...