Test association between correlation sturucture and variable
Source:R/other_corr_tests.R
delaneau.test.Rd
Score impact of each sample on correlation sturucture and then peform test of association with variable using Kruskal-Wallis test
Usage
delaneau.test(Y, variable, method = c("pearson", "kendall", "spearman"))
Arguments
- Y
data matrix with samples on rows and variables on columns
- variable
variable with number of entries must equal nrow(Y). Can be discrete or continuous.
- method
specify which correlation method: "pearson", "kendall" or "spearman"
Details
The statistical test used depends on the variable specified. if variable is factor with multiple levels, use Kruskal-Wallis test if variable is factor with 2 levels, use Wilcoxon test if variable is continuous, use Wilcoxon test
Examples
# load iris data
data(iris)
# variable is factor with multiple levels
# use kruskal.test
delaneau.test( iris[,1:4], iris[,5] )
#> $p.value
#> [1] 5.648845e-05
#>
#> $estimate
#> Kruskal-Wallis chi-squared
#> 19.56295
#>
#> $method
#> [1] "kruskal.test"
#>
# variable is factor with 2 levels
# use wilcox.test
delaneau.test( iris[1:100,1:4], iris[1:100,5] )
#> $p.value
#> [1] 0.2510425
#>
#> $estimate
#> [1] -0.0005950244
#>
#> $method
#> [1] "wilcox.test"
#>
# variable is continuous
# use cor.test with spearman
delaneau.test( iris[,1:4], iris[,1] )
#> $p.value
#> [1] 0.0504917
#>
#> $estimate
#> rho
#> -0.1599965
#>
#> $method
#> [1] "cor.test"
#>