Skip to content

Commit

Permalink
Added redundant DM example
Browse files Browse the repository at this point in the history
  • Loading branch information
jwcarr committed Jan 31, 2021
1 parent 8b2eb8c commit 4bd3384
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
import mantel

dists1 = [0.2, 0.4, 0.3, 0.6, 0.9, 0.4] # E.g. genetic distances
dists2 = [0.3, 0.3, 0.2, 0.7, 0.8, 0.3] # E.g. geographical distances
# Example with condendensed distance matrices

result = mantel.test(dists1, dists2, perms=10000, method='pearson', tail='upper')
dists1 = [0.2, 0.4, 0.3, 0.6, 0.9, 0.4]
dists2 = [0.3, 0.3, 0.2, 0.7, 0.8, 0.3]

result = mantel.test(dists1, dists2, method="pearson", tail="upper")
print(result)

# Example with redundant distance matrices

dists1 = [[0.0,0.2,0.4,0.3],
[0.2,0.0,0.6,0.9],
[0.4,0.6,0.0,0.4],
[0.3,0.9,0.4,0.0]]
dists2 = [[0.0,0.3,0.3,0.2],
[0.3,0.0,0.7,0.8],
[0.3,0.7,0.0,0.3],
[0.2,0.8,0.3,0.0]]

result = mantel.test(dists1, dists2, method="pearson", tail="upper")
print(result)

0 comments on commit 4bd3384

Please sign in to comment.