-
Notifications
You must be signed in to change notification settings - Fork 3
/
same_stat.R
29 lines (26 loc) · 1004 Bytes
/
same_stat.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
rm(list=ls())
require("energy")
require("kernlab")
require("HHG")
# change to your file path
#filepath = setwd("/Users/sampan501/workspace/hyppo/benchmarks/same_stat/indep")
filepath = setwd("/Users/sampan501/workspace/hyppo/benchmarks/same_stat/ksample")
times = seq(1, 100, by=1)
statistics <- list()
for (t in times){
#df <- read.csv(paste(filepath, "/", t, ".csv", sep=""), sep=",")
df1 <- read.csv(paste(filepath, "/sim1_", t, ".csv", sep=""), sep=",")
df2 <- read.csv(paste(filepath, "/sim2_", t, ".csv", sep=""), sep=",")
#x <- df[, 1]
#y <- df[, 2]
x <- df1[,]
y <- df2[,]
#stat <- bcdcor(x, y)
#Dx = as.matrix(dist((x), diag = TRUE, upper = TRUE))
#Dy = as.matrix(dist((y), diag = TRUE, upper = TRUE))
#stat <- hhg.test(Dx, Dy, nr.perm=0)$sum.chisq
stat <- kmmd(x, y, ntimes=0)@mmdstats[2]
statistics <- c(statistics, list(stat))
}
df <- data.frame(matrix(unlist(statistics), nrow=length(statistics), byrow=T), stringsAsFactors=FALSE)
write.csv(df, row.names=FALSE)