library(MASS)
set.seed(123)
X1=mvrnorm(20, mu=rep(0, 40), Sigma=diag(40))
X2=mvrnorm(100, mu=rep(5, 40), Sigma=diag(40))
# create two groups of random observations
# with different means and sample sizes,
# but the same covariance matrix
# We expect that the two groups will have the same
# variance (disparity/morphospace occupation)
# and therefore the test will be non-significant
disparity_test(X1, X2, perm=999)
# This is, indeed, the case
Run the code above in your browser using DataLab