View source: R/con_multitest.R
1 | con_multitest(i, k, n, variable, select, testdata, testlevel, method, psigalpha = 0.05)
|
i |
|
k |
|
n |
|
variable |
|
select |
|
testdata |
|
testlevel |
|
method |
|
psigalpha |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (i, k, n, variable, select, testdata, testlevel, method,
psigalpha = 0.05)
{
group <- testdata[[variable]]
indx <- 1:n
indx0 <- sample(indx, n - k)
indx1 <- indx[!indx %in% indx0]
group[indx1] <- group[sample(indx1)]
otu.test <- apply(testlevel, 2, function(x) {
ct <- cor.test(x = x, y = group, method = method)
return(data.frame(pv = ct$p.value, es = ct$statistic,
cr = ct$estimate))
})
otu.test <- do.call(rbind, otu.test)
psig <- sum(!otu.test$pv > psigalpha, na.rm = T)
pvalue <- -log10(otu.test$pv[select])
effectsize <- otu.test$es[select]
correlation <- otu.test$cr[select]
return(list(psig = psig, pvalue = pvalue, effectsize = effectsize,
correlation = correlation))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.