n = 20
size <- 10
covariances <- rWishart(2,size,diag(size))
A <- covariances[,,1]
B <- covariances[,,2]
# Two groups, each with one covariance. Creates n Gaussian data for each covariance.
# more generally, we could have two groups each with "g_i" covariances in them
g1 <- g2 <- 1
grp <- rep(1:(g1+g2),rep(n,g1+g2))
data <- rbind(matrix(rnorm(n*NCOL(A)),n*g1)%*%A,
matrix(rnorm(n*NCOL(B)),n*g2)%*%B)
wassersteinTest(data,grp, B=100,r="HS")$p.value
# \donttest{
data(phoneme)
wassersteinTest(logPeriodogram, Phoneme, B=100,r="HS")$p.value
# }
Run the code above in your browser using DataLab