wmw: Wilcoxon-Mann Whitney U test

Description Usage Arguments Details Author(s) Examples

View source: R/wmw.R

Description

This function is implemented in the unique function for univariate statistical analysis 'univariate'. This function performs Wilcoxon-mann Whitney U test of each variable in the data set according to the class definition provided in the second column of the file.

Usage

1

Arguments

file

a connection or a character string giving the name of the file containing the variables (matrix columns) to test.

Details

For details see ?univariate.

Author(s)

Edoardo Gaude, Dimitrios Spiliotopoulos, Francesca Chignola, Silvia Mari, Andrea Spitaleri and Michela Ghitti

Examples

 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
## The function is currently defined as
function (file) 
{
    pwdfile = paste(getwd(), "/Univariate/DataTable.csv", sep = "")
    file = pwdfile
    x <- read.csv(file, sep = ",", header = TRUE)
    x.x = x[, 3:ncol(x)]
    rownames(x.x) = x[, 2]
    k = matrix(x[, 1], ncol = 1)
    x.n = cbind(k, x.x)
    sorted = x.n[order(x.n[, 1]), ]
    g = c()
    for (i in 1:nrow(sorted)) {
        if (any(g == sorted[i, 1])) {
            g = g
        }
        else {
            g = matrix(c(g, sorted[i, 1]), ncol = 1)
        }
    }
    NoF = nrow(g)
    dirout.wm = paste(getwd(), "/Univariate/Mann-Whitney_Tests/", 
        sep = "")
    dir.create(dirout.wm)
    for (i in 1:NoF) {
        for (j in 1:NoF) {
            if (i < j) {
                ni = paste("r.", i, ".csv", sep = "")
                nj = paste("r.", j, ".csv", sep = "")
                pwdi = paste(getwd(), "/Univariate/Groups/", 
                  ni, sep = "")
                pwdj = paste(getwd(), "/Univariate/Groups/", 
                  nj, sep = "")
                I = read.csv(pwdi, header = TRUE)
                J = read.csv(pwdj, header = TRUE)
                I = I[, -1]
                J = J[, -1]
                fin = ncol(sorted) - 1
                wilx.pv <- matrix(rep(NA, fin))
                for (q in 1:fin) {
                  wilx.pv[q, ] <- wilcox.test(I[, q], J[, q], 
                    paired = FALSE, exact = NULL, correct = FALSE, 
                    conf.level = 0.95, alternative = "two.sided")$p.value
                }
                wmw.ij.pv = paste("WMWTest_pvalues_", i, "vs", 
                  j, ".csv", sep = "")
                assign(wmw.ij.pv, wilx.pv)
                write.csv(wilx.pv, paste(dirout.wm, wmw.ij.pv, 
                  sep = ""))
            }
        }
    }
  }


muma documentation built on May 19, 2017, 11:28 p.m.
Search within the muma package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.