forked from ThiagoCF05/NeuralREG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatistics.R
56 lines (43 loc) · 2.5 KB
/
statistics.R
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
54
55
# == Data
datav <- read.csv(header=T, row.names=NULL, sep = ";", "/Users/thiagocastroferreira/Documents/Doutorado/NeuralREG/humaneval/official_results.csv")
# Fluency
print("Fluency")
# Friedman Test
fluency <- matrix(c(datav$original_fluency, datav$only_fluency, datav$ferreira_fluency, datav$seq2seq_fluency, datav$catt_fluency, datav$hier_fluency), nrow = nrow(datav))
friedman.test(fluency)
# Post-hoc: Wilcoxon
install.packages("reshape2")
library("reshape2")
fluency <- data.frame(matrix(c(datav$resp, datav$original_fluency, datav$only_fluency, datav$ferreira_fluency, datav$seq2seq_fluency, datav$catt_fluency, datav$hier_fluency),
nrow = nrow(datav)))
colnames(fluency) <- c("fluency/resp", "original", "only", "ferreira", "seq2seq", "catt", "hieratt")
datav.long <- melt(fluency, id.vars=c("fluency/resp"))
summary(fluency)
library("stats")
pairwise.wilcox.test(datav.long$value, datav.long$variable, paired = TRUE, p.adjust.method = "bonferroni")
# Grammar
print("Grammaticality")
# Friedman Test
grammar <- matrix(c(datav$original_grammar, datav$only_grammar, datav$ferreira_grammar, datav$seq2seq_grammar, datav$catt_grammar, datav$hier_grammar), nrow = nrow(datav))
friedman.test(grammar)
# Post-hoc: Wilcoxon
grammar <- data.frame(matrix(c(datav$resp, datav$original_grammar, datav$only_grammar, datav$ferreira_grammar, datav$seq2seq_grammar, datav$catt_grammar, datav$hier_grammar),
nrow = nrow(datav)))
colnames(grammar) <- c("grammar/resp", "original", "only", "ferreira", "seq2seq", "catt", "hieratt")
datav.long <- melt(grammar, id.vars=c("grammar/resp"))
summary(grammar)
library("stats")
pairwise.wilcox.test(datav.long$value, datav.long$variable, paired = TRUE, p.adjust.method = "bonferroni")
# Clarity
print("Clarity")
# Friedman Test
clarity <- matrix(c(datav$original_clarity, datav$only_clarity, datav$ferreira_clarity, datav$seq2seq_clarity, datav$catt_clarity, datav$hier_clarity), nrow = nrow(datav))
friedman.test(clarity)
# Post-hoc: Wilcoxon
clarity <- data.frame(matrix(c(datav$resp, datav$original_clarity, datav$only_clarity, datav$ferreira_clarity, datav$seq2seq_clarity, datav$catt_clarity, datav$hier_clarity),
nrow = nrow(datav)))
colnames(clarity) <- c("clarity/resp", "original", "only", "ferreira", "seq2seq", "catt", "hieratt")
datav.long <- melt(clarity, id.vars=c("clarity/resp"))
summary(clarity)
library("stats")
pairwise.wilcox.test(datav.long$value, datav.long$variable, paired = TRUE, p.adjust.method = "bonferroni")