# Friedman and Kruskal

I have a data with 4 groups and multiple variables with measured values. my groups are ES, EP, PP and PS. ES and EP are associated and PP and PS are too. So i would like to compare my groups in non parametric design (my professor said to use only kruskal or friedman and then wilcoxon and mann withney respectively).

I'm using R and I would like to use friedman on ES-EP and PP-PS because they are depend groups. So for other comparisons i would like to use a kruskal wallis test, but I struggled a lot in how to do. In my opinion because it's impossible to test more than two groups here without dependency. So use mann witheney and wilcox directly considering dependent groups.

Here is how look my data, Bloc indicates which groups is dependent and Groupes the groups:

data <- structure(list(Groupes = structure(c(3L, 3L, 3L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L,
1L, 1L), .Label = c("EP", "ES", "PP", "PS"), class = "factor"),
Bloc = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("E",
"P"), class = "factor"), sujet = 1:24, E2.I = c(73.3, 80,
86.7, 50, 57.5, 46.7, 56.3, 32, 26, 38, 33, 62.9, 52.9, 72.2,
70.9, 69, 74, 40.5, 73.3, 57.9, 61.2, 60.6, 61.4, 81), E2.OV = c(14L,
5L, 6L, 7L, 14L, 16L, 12L, 18L, 9L, 4L, 2L, 7L, 6L, 7L, 7L,
21L, 13L, 9L, 11L, 18L, 9L, 11L, 19L, 12L), E2.OA = c(22L,
14L, 14L, 11L, 15L, 19L, 15L, 10L, 4L, 4L, 2L, 14L, 6L, 9L,
5L, 12L, 11L, 12L, 11L, 12L, 11L, 22L, 26L, 24L), E1.T = c(6L,
26L, 22L, 15L, 15L, 20L, 0L, 5L, 8L, 39L, 27L, 3L, 8L, 4L,
5L, 12L, 25L, 13L, 15L, 17L, 43L, 11L, 24L, 32L), E1.F = c(119L,
100L, 118L, 150L, 83L, 122L, 93L, 72L, 86L, 72L, 81L, 92L,
122L, 117L, 98L, 112L, 167L, 131L, 116L, 125L, 85L, 127L,
174L, 108L), E1.C = c(3L, 6L, 4L, 0L, 1L, 0L, 3L, 0L, 2L,
0L, 0L, 5L, 3L, 7L, 4L, 4L, 5L, 8L, 0L, 5L, 7L, 8L, 4L, 9L
), E3.T = c(16L, 34L, 17L, 26L, 35L, 49L, 42L, 17L, 6L, 14L,
27L, 133L, 8L, 22L, 12L, 15L, 12L, 35L, 39L, 37L, 17L, 21L,
22L, 8L), E3.R = c(11L, 16L, 10L, 20L, 14L, 22L, 16L, 7L,
1L, 4L, 6L, 11L, 12L, 19L, 8L, 7L, 8L, 9L, 9L, 11L, 17L,
13L, 15L, 11L), E4.T = c(3L, 0L, 5L, 7L, 10L, 5L, 16L, 7L,
17L, 2L, 4L, 8L, 8L, 6L, 11L, 3L, NA, 10L, 10L, 3L, 2L, 5L,
9L, 5L), E4.R = c(3L, 0L, 6L, 2L, 2L, 6L, 5L, 5L, 8L, 3L,
3L, 6L, 8L, 7L, 6L, 2L, NA, 4L, 4L, 5L, 2L, 8L, 7L, 1L)), class = "data.frame", row.names = c(NA,
-24L))


So should i make a friedman.test(E2.I, Groupes, Bloc, data=data) for dependent groups. And kruskal.test(data$E2.I~data$Groupes) but in this case dependent groups will be taken and kruskal Wallis has the assumption that groups are not dependent if I remember well. And after I could make comparison between 2 groups (with correction of Bonferroni).