# The "example_pair" data contains the paired data 'data_pair'.
# It is a n by 2p matrix with n being the number of pairs and p being the dimension of
# observations.
# For each row, the first p columns represent the observation from sample 1, and the
# second p columns represent the paired observation from sample 2.
# The data is generated from a paired design with mean shift.
data(example_pair)
n = nrow(data_pair)
p = ncol(data_pair)/2
k = 5
data1 = data_pair[,1:p]
data2 = data_pair[,(p+1):(2*p)]
case = rbind(data1,data2)
dist1 = as.matrix(dist(case))
library("ade4")
E = mstree(as.dist(dist1),k)
g.tests_pair(E,n)
# Get permutation p-value with 300 permutations.
g.tests_pair(E, n, perm = 300)
Run the code above in your browser using DataLab