forked from SophieTax/CovPred_ACE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Repeated_ttest.R
43 lines (42 loc) · 1.13 KB
/
Repeated_ttest.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
Repeated_ttest=function(channels, triangle, list_triangle_Yt, list_triangle_Yc){
corresp_elem_Yt=vector()
corresp_elem_Yc=vector()
ttest=list()
#Upper triangle
if (triangle=="UPPER"){
i=1
for (col in 2:(length(channels))){
i=i
for (row in 1:(col-1)){
i=i
for (s in 1:length(list_triangle_Yt)){
corresp_elem_Yt[s]=list_triangle_Yt[[s]][row,col]
corresp_elem_Yc[s]=list_triangle_Yc[[s]][row,col]
}
test_current=t.test(x=c(corresp_elem_Yt), y=c(corresp_elem_Yc), paired=TRUE, alternative="two.sided")
ttest[[i]]=list()
ttest[[i]]=test_current
i=i+1
}
}
}
#Lower triangle
else {
i=1
for (col in 1:(length(channels)-1)){
i=i
for (row in (col+1):length(channels)){
i=i
for (s in 1:length(list_triangle_Yc)){
corresp_elem_Yt[s]=list_triangle_Yt[[s]][row,col]
corresp_elem_Yc[s]=list_triangle_Yc[[s]][row,col]
}
test_current=t.test(x=c(corresp_elem_Yt), y=c(corresp_elem_Yc), paired=TRUE, alternative="two.sided")
ttest[[i]]=list()
ttest[[i]]=test_current
i=i+1
}
}
}
ttest
}