Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
R
 
 
man
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

CRAN version Build Status codecov dependencies Monthly Downloads

Matrix Tests

A package dedicated to running multiple statistical hypothesis tests on rows and columns of matrices.

illustration

Goals

  1. Fast execution via vectorization.
  2. Handling of edge cases (NA values, 0 row inputs).
  3. Output that is detailed and easy to use.
  4. Result compatibility with tests that are implemented in R.

Examples

1. Bartlett's test on columns

Bartlett's test on every column of iris dataset using Species as groups:

col_bartlett(iris[,-5], iris$Species)
             obs.tot obs.groups var.pooled df statistic                pvalue
Sepal.Length     150          3 0.26500816  2 16.005702 0.0003345076070163084
Sepal.Width      150          3 0.11538776  2  2.091075 0.3515028004158132768
Petal.Length     150          3 0.18518776  2 55.422503 0.0000000000009229038
Petal.Width      150          3 0.04188163  2 39.213114 0.0000000030547839322

2. Welch t-test on rows

Welch t-test on each row of 2 large (million row) matrices:

X <- matrix(rnorm(10000000), ncol=10)
Y <- matrix(rnorm(10000000), ncol=10)

row_t_welch(X, Y)  # running time: 2.4 seconds

Available Tests

Location tests (1 group)

|-----------------------------|-------------------------------|---------------------------------------|
|           Name              |           Function            |             R equivalent              |
|-----------------------------|-------------------------------|---------------------------------------|
| single sample t.test        | row_t_onesample(x)            | t.test(x)                             |
| single sample wilcoxon test | row_wilcoxon_onesample(x)     | wilcox.test(x)                        |
|-----------------------------|-------------------------------|---------------------------------------|

Location tests (2 groups)

|-----------------------------|-------------------------------|---------------------------------------|
|           Name              |           Function            |             R equivalent              |
|-----------------------------|-------------------------------|---------------------------------------|
| equal variance t.test       | row_t_equalvar(x, y)          | t.test(x, y, var.equal=TRUE)          |
| welch t.test                | row_t_welch(x, y)             | t.test(x, y)                          |
| two sample wilcoxon test    | row_wilcoxon_twosample(x, y)  | wilcox.test(x, y)                     |
|-----------------------------|-------------------------------|---------------------------------------|

Location tests (2+ groups)

|-----------------------------|-------------------------------|---------------------------------------|
|           Name              |           Function            |             R equivalent              |
|-----------------------------|-------------------------------|---------------------------------------|
| equal variance oneway anova | row_oneway_equalvar(x, g)     | oneway.test(x ~ g, var.equal=TRUE)    |
| welch oneway anova          | row_oneway_welch(x, g)        | oneway.test(x ~ g)                    |
| kruskal-wallis test         | row_kruskalwallis(x, g)       | kruskal.test(x, g)                    |
| van der waerden test        | row_waerden(x, g)             | PMCMR::vanWaerden.test(x, g)          |
|-----------------------------|-------------------------------|---------------------------------------|

Location tests (paired)

|-----------------------------|-------------------------------|---------------------------------------|
|           Name              |           Function            |             R equivalent              |
|-----------------------------|-------------------------------|---------------------------------------|
| paired t.test               | row_t_paired(x, y)            | t.test(x, y, paired=TRUE)             |
| paired wilcoxon test        | row_wilcoxon_paired(x, y)     | wilcox.test(x, y, paired=TRUE)        |
|-----------------------------|-------------------------------|---------------------------------------|

Scale tests (2 groups)

|-----------------------------|-------------------------------|---------------------------------------|
|           Name              |           Function            |             R equivalent              |
|-----------------------------|-------------------------------|---------------------------------------|
| f variance test             | row_f_var(x, y)               | var.test(x, y)                        |
|-----------------------------|-------------------------------|---------------------------------------|

Scale tests (2+ groups)

|-----------------------------|-------------------------------|---------------------------------------|
|           Name              |           Function            |             R equivalent              |
|-----------------------------|-------------------------------|---------------------------------------|
| bartlett's test             | row_bartlett(x, g)            | bartlett.test(x, g)                   |
| fligner-killeen test        | row_flignerkilleen(x, g)      | fligner.test(x, g)                    |
| levene's test               | row_levene(x, g)              | car::leveneTest(x, g, "mean")         |
| brown-forsythe test         | row_brownforsythe(x, g)       | car::leveneTest(x, g, "median")       |
|-----------------------------|-------------------------------|---------------------------------------|

Assosiation tests

|-----------------------------|-------------------------------|---------------------------------------|
|           Name              |           Function            |             R equivalent              |
|-----------------------------|-------------------------------|---------------------------------------|
| pearson's correlation test  | row_cor_pearson(x, y)         | cor.test(x, y)                        |
|-----------------------------|-------------------------------|---------------------------------------|

Periodicity tests

|-----------------------------|-------------------------------|---------------------------------------|
|           Name              |           Function            |             R equivalent              |
|-----------------------------|-------------------------------|---------------------------------------|
| cosinor                     | row_cosinor(x, t, period)     | cosinor::cosinor.lm(x ~ t, period)    |
|-----------------------------|-------------------------------|---------------------------------------|

Distribution tests

|-----------------------------|-------------------------------|---------------------------------------|
|           Name              |           Function            |             R equivalent              |
|-----------------------------|-------------------------------|---------------------------------------|
| jarque-bera test            | row_jarquebera(x)             | moments::jarque.test(x)               |
|-----------------------------|-------------------------------|---------------------------------------|

Test based procedures

|-----------------------------|-------------------------------|---------------------------------------|
|           Name              |           Function            |             R equivalent              |
|-----------------------------|-------------------------------|---------------------------------------|
| evora                       | row_ievora(x, b)              |                  ---                  |
|-----------------------------|-------------------------------|---------------------------------------|

Further Information

For more information please refer to the Wiki page:

  1. Installation Instructions
  2. Design Decisions
  3. Speed Benchmarks

See Also

Literature

Computing thousands of test statistics simultaneously in R, Holger Schwender, Tina Müller.
Statistical Computing & Graphics. Volume 18, No 1, June 2007.

Packages

CRAN:

  1. ttests() in the Rfast package.
  2. row.ttest.stat() in the metaMA package.
  3. MultiTtest() in the ClassComparison package.
  4. bartlettTests() in the heplots package.
  5. harmonic.regression() in the HarmonicRegression package.

BioConductor:

  1. lmFit() in the limma package.
  2. rowttests() in the genefilter package.
  3. mt.teststat() in the multtest package.
  4. row.T.test() in the HybridMTest package.
  5. rowTtest() in the viper package.
  6. lmPerGene() in the GSEAlm package.

GitHub:

  1. rowWilcoxonTests() in the sanssouci package.
  2. matrix.t.test() in the pi0 package.

About

R package for computing multiple hypothesis tests on rows/columns of a matrix or a data.frame

Topics

Resources

Languages

You can’t perform that action at this time.