Test association between sparse leading eigen-value and variable
Source:R/other_corr_tests.R
sle.test.Rd
Score impact of each sample on sparse leading eigen-value and then peform test of association with variable using non-parametric test
Usage
sle.test(
Y,
variable,
method = c("pearson", "kendall", "spearman"),
rho = 0,
sumabs = 1
)
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"
- rho
a positive constant such that cor(Y) + diag(rep(rho,p)) is positive definite.
- sumabs
regularization paramter. Value of 1 gives no regularization, sumabs*sqrt(p) is the upperbound of the L_1 norm of v,controling the sparsity of solution. Must be between 1/sqrt(p) and 1.
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
sle.test( iris[,1:4], iris[,5] )
#> $p.value
#> [1] 1.604944e-08
#>
#> $estimate
#> Kruskal-Wallis chi-squared
#> 35.89518
#>
#> $method
#> [1] "kruskal.test"
#>
# variable is factor with 2 levels
# use wilcox.test
sle.test( iris[1:100,1:4], iris[1:100,5] )
#> $p.value
#> [1] 0.7329198
#>
#> $estimate
#> [1] -0.0005423853
#>
#> $method
#> [1] "wilcox.test"
#>
# variable is continuous
# use cor.test with spearman
sle.test( iris[,1:4], iris[,1] )
#> $p.value
#> [1] 0.000519093
#>
#> $estimate
#> rho
#> -0.280033
#>
#> $method
#> [1] "cor.test"
#>