Pearson's correlation test for rows of a matrix
Source:R/rowPearsonCorrelationTests.R
rowPearsonCorrelationTests.Rd
Pearson's correlation test for rows of a matrix
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.
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.003 0.000 0.003
str(fwt)
#> List of 3
#> $ p.value : num [1:300] 0.746 0.11 0.813 0.784 0.162 ...
#> $ statistic: num [1:300] -0.67 1.246 -0.9 -0.796 1.002 ...
#> $ estimate : num [1:300] -0.111 0.203 -0.148 -0.132 0.165 ...