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.3935 0.9307 0.5571 0.8579 0.0335 ...
#> $ statistic: num [1:300] 0.272 -1.515 -0.145 -1.087 1.889 ...
#> $ estimate : num [1:300] 0.0453 -0.2448 -0.0241 -0.1783 0.3002 ...