taba.matrix: Robust Correlation Matrix

Description Usage Arguments Details Value References See Also Examples

View source: R/TabaMatrix.R

Description

Calculates a correlation, distance, and p-value matrix using one of the specified robust methods Taba linear or Taba rank correlation.

Usage

1
2
3
taba.matrix(x, y = NULL, ..., method = c("taba","tabarank","tabwil","tabwilrank"),
            alternative = c("less", "greater", "two.sided"),
            omega)

Arguments

x

A numeric vector of length greater than 2 must be same length as all other vectors.

y

A numeric vector of length greater than 2 must be same length as all other vectors.

...

Numeric vector(s) of length equal to x and y. May be of class matrix or data.frame, whose columns will be compared and whose column's length must be of equal length to x and y. Not one vector or column name can be "x" or "y."

method

A character string of "taba", "tabarank", "tabwil", or "tabwilrank" determining if one wants to calculate Taba linear, Taba rank (monotonic), TabWil, or TabWil rank correlation, respectively. If no method is specified, the function will output Taba Linear correlation.

alternative

Character string specifying the alternative hypothesis must be one of "less" for negative association, "greater" for positive association, or "two.sided" for difference in association. If the alternative is not specified, the function will default to a two sided test.

omega

Numeric allowing the user to alter the tuning constant. If one is not specified, the function will default to 0.45 for Taba and Taba rank, and 0.1 for TabWil and TabWil rank. Range is between 0 and 1.

Details

This function uses Taba linear, Taba rank (monotonic), TabWil, or TabWil rank correlation to calculate the association of two or more numeric vectors. Numeric vectors under ... are combined colomn-wise with x and y. When inserting a single matrix x, the function will calculate the correlation matix using the columns of matrix x.
Matricies or data frames with numeric cells can be inserted in ..., whereby each column in the matrix or data frame will be treated as a different vector for comparison. Columns must all have different names from each other. No vector or column should be named "x" or "y," as these refer to the first two vectors respectively, if inserted as a vector or matrix with no name. Missing values in any of the vectors are deleted row-wise.
The default for this function is a two sided test using Taba linear partial correlation, with the tuning constant omega equal to 0.45.

Value

This function returns the robust association between two or more numeric vectors, as a matrix; the distance matrix, as type dist; and a p-value matrix corresponding to the correlation matrix.

References

Tabatabai, M., Bailey, S., Bursac, Z. et al. An introduction to new robust linear and monotonic correlation coefficients. BMC Bioinformatics 22, 170 (2021). https://doi.org/10.1186/s12859-021-04098-4

doi: 10.1186/s12859-021-04098-4

See Also

taba for calculating Taba linear or Taba rank (monotonic) correlations
taba.test for testing Taba linear or Taba rank (monotonic) correlations
taba.gpartial for generalized partial correlations
taba.partial for partial and semipartial correlations

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x = rnorm(100)
y = rnorm(100)
z1 = rnorm(100)
z2 = rnorm(100)
z3 = rnorm(100)
Z = cbind(z1,z3)
colnames(Z) = c("A","B")
taba.matrix(x, y, z1, z2, z3, method = "tabarank")
taba.matrix(x, y, z2, Z, alternative = "less", omega = 0.4)
taba.matrix(Z, method = "tabarank")

Example output

$cmatrix
             x           y          z1         z2          z3
x   1.00000000 -0.05347454 -0.06470041 -0.1187783 -0.00799149
y  -0.05347454  1.00000000 -0.01965872  0.1335821 -0.06539639
z1 -0.06470041 -0.01965872  1.00000000 -0.1851103  0.03692166
z2 -0.11877826  0.13358211 -0.18511030  1.0000000  0.13028463
z3 -0.00799149 -0.06539639  0.03692166  0.1302846  1.00000000

$distance
           x         y        z1        z2
y  0.5267373                              
z1 0.5323502 0.5098294                    
z2 0.5593891 0.4332089 0.5925552          
z3 0.5039957 0.5326982 0.4815392 0.4348577

$pmatrix
           x         y         z1         z2        z3
x  1.0000000 0.5972213 0.52247156 0.23918703 0.9371031
y  0.5972213 1.0000000 0.84607066 0.18518002 0.5179981
z1 0.5224716 0.8460707 1.00000000 0.06521243 0.7153361
z2 0.2391870 0.1851800 0.06521243 1.00000000 0.1963638
z3 0.9371031 0.5179981 0.71533611 0.19636383 1.0000000

$cmatrix
             x           y          z2           A           B
x   1.00000000 -0.04190065 -0.10318600 -0.02586631  0.01154209
y  -0.04190065  1.00000000  0.12992774 -0.03122069 -0.09428171
z2 -0.10318600  0.12992774  1.00000000 -0.17084227  0.09401193
A  -0.02586631 -0.03122069 -0.17084227  1.00000000  0.07337713
B   0.01154209 -0.09428171  0.09401193  0.07337713  1.00000000

$distance
           x         y        z2         A
y  0.5209503                              
z2 0.5515930 0.4350361                    
A  0.5129332 0.5156103 0.5854211          
B  0.4942290 0.5471409 0.4529940 0.4633114

$pmatrix
           x         y        z2         A         B
x  1.0000000 0.6605338 0.8465189 0.6008137 0.5453706
y  0.6605338 1.0000000 0.9011986 0.6210946 0.8246014
z2 0.8465189 0.9011986 1.0000000 0.9553839 0.8239082
A  0.6008137 0.6210946 0.9553839 1.0000000 0.7659349
B  0.5453706 0.8246014 0.8239082 0.7659349 1.0000000

$cmatrix
           A          B
A 1.00000000 0.03692166
B 0.03692166 1.00000000

$distance
          A
B 0.4815392

$pmatrix
          A         B
A 1.0000000 0.7153361
B 0.7153361 1.0000000

Taba documentation built on April 1, 2021, 1:06 a.m.

Related to taba.matrix in Taba...